Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Release 0.40.7
Browse files Browse the repository at this point in the history
Support msg 8035
  • Loading branch information
doudz committed Aug 29, 2020
2 parents d1ec44f + 0560046 commit 7ea7dfc
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
10 changes: 10 additions & 0 deletions tests/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,16 @@ def test_response_004d(self):
])
)

def test_response_8035(self):
msg_data = unhexlify(b'030000f104')
r = responses.R8035(msg_data, 255)
self.assertDictEqual(r.cleaned_data(),
OrderedDict([('status', 3),
('record', 0x0000f104),
('lqi', 255),
]))
self.assertEqual(r.status_text(), 'E_PDM_SYSTEM_EVENT_LARGEST_RECORD_FULL_SAVE_NO_LONGER_POSSIBLE')


if __name__ == '__main__':
unittest.main()
2 changes: 2 additions & 0 deletions zigate/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,8 @@ def interpret_response(self, response):
continue
device = Device(dict(d), self)
self._set_device(device)
elif response.msg == 0x8035: # PDM event
LOGGER.warning('PDM Event : %s %s', response['status'], response.status_text())
elif response.msg == 0x8042: # node descriptor
addr = response['addr']
d = self.get_device_from_addr(addr)
Expand Down
33 changes: 33 additions & 0 deletions zigate/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,39 @@ class R8031(R8030):
type = 'unBind response'


@register_response
class R8035(Response):
msg = 0x8035
type = 'PDM Event'
s = OrderedDict([('status', 'B'),
('record', 'I'),
])

def status_text(self):
status_codes = ['E_PDM_SYSTEM_EVENT_WEAR_COUNT_TRIGGER_VALUE_REACHED',
'E_PDM_SYSTEM_EVENT_DESCRIPTOR_SAVE_FAILED',
'E_PDM_SYSTEM_EVENT_PDM_NOT_ENOUGH_SPACE',
'E_PDM_SYSTEM_EVENT_LARGEST_RECORD_FULL_SAVE_NO_LONGER_POSSIBLE',
'E_PDM_SYSTEM_EVENT_SEGMENT_DATA_CHECKSUM_FAIL',
'E_PDM_SYSTEM_EVENT_SEGMENT_SAVE_OK',
'E_PDM_SYSTEM_EVENT_EEPROM_SEGMENT_HEADER_REPAIRED',
'E_PDM_SYSTEM_EVENT_SYSTEM_INTERNAL_BUFFER_WEAR_COUNT_SWAP',
'E_PDM_SYSTEM_EVENT_SYSTEM_DUPLICATE_FILE_SEGMENT_DETECTED',
'E_PDM_SYSTEM_EVENT_SYSTEM_ERROR',
'E_PDM_SYSTEM_EVENT_SEGMENT_PREWRITE',
'E_PDM_SYSTEM_EVENT_SEGMENT_POSTWRITE',
'E_PDM_SYSTEM_EVENT_SEQUENCE_DUPLICATE_DETECTED',
'E_PDM_SYSTEM_EVENT_SEQUENCE_VERIFY_FAIL',
'E_PDM_SYSTEM_EVENT_PDM_SMART_SAVE',
'E_PDM_SYSTEM_EVENT_PDM_FULL_SAVE',
]
try:
return status_codes[self.data.get('status')]
except IndexError:
return 'Unknown PDM event'



@register_response
class R8040(Response):
msg = 0x8040
Expand Down
2 changes: 1 addition & 1 deletion zigate/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
#


__version__ = '0.40.6'
__version__ = '0.40.7'

0 comments on commit 7ea7dfc

Please sign in to comment.