def _get_firmware_id(self): guid, portnumber, length, valdef = self.FIRMWARE_ID data = self._client.getAttribute("M1", guid, portnumber, length) code, firmware_id = convert.bin2value(data, valdef) if code == 0: return firmware_id else: return ''
def getModuleVersion(self, moduleID): """ this function returns the module version or None """ guid, portnumber, length, valdef = self.MODULE_INFO data = self.client.getAttribute(moduleID, guid, portnumber, length) code, version = convert.bin2value(data, valdef) if not code: return version
def getObjectFromData(self, data, valDef, setter=False, count=1): if setter: return convert.bin2int(data) if count == 1: return convert.bin2value(data, valDef) if data[0] != "\0": # pylint: disable=W1401 # This is an error code, return it return convert.bin2value(data, valDef) # Remove the error byte data = data[1:] # get length of each port length = len(data) / count # Split the ports data_list = convert.slice_string(data, length) result = [] for data in data_list: result.append( convert.bin2value(data, valDef, checkErrorByte=False)[1]) return 0, result
def _get_module_version(self, module_id): guid, portnumber, length, valdef = self.MODULE_INFO data = self._client.getAttribute(module_id, guid, portnumber, length) return convert.bin2value(data, valdef)
def _get_firmware_version(self): guid, portnumber, length, valdef = self.FIRMWARE_INFO data = self._client.getAttribute("M1", guid, portnumber, length) return convert.bin2value(data, valdef)