Implement get_state status codes from appendix B on MDAC specification
Feature description
To implement the de-serialization of get_state
it is necessary to implement the protocol specification in Appendix B.
Possible solution
Write a static private method of cMdacRpc
as, then use it to read iteratively the data from the MDAC packet
def __readstatustype(_data):
""" _data: byte string from MDAC as described in appendix B"""
code = strunct.unpack('>H', _data[:2])
_data = _data[2:]
if code == 0: # we have a string
end = _data.find(b'\0')
fmt = '>{:d}s'.format(end)
msg, = struct.unpack(fmt, _data[:end])
return _data, msg
status, = struct.unpack('>i', _data[:4])
return _data, status