def toHexFloatValue(self, qds, timetag): # Create ASDU hexValue = structToHex(struct.pack('f', self.value)) asdu = self.hexTrailer() + hexValue + self.hexFooter(qds, timetag) # Create APCI + ASDU hex representation return self.hexAPCI(len(asdu)) + asdu
def hexIoa(self): return structToHex( struct.pack('BBB', self.ioa & 0xFF, self.ioa >> 8 & 0xFF, self.ioa >> 16 & 0xFF))
def toHexNormalizedValue(self, qds, timetag): # Create ASDU hexValue = structToHex(struct.pack('<h', int(self.value * 32768))) asdu = self.hexTrailer() + hexValue + self.hexFooter(qds, timetag) # Create APCI + ASDU hex representation return self.hexAPCI(len(asdu)) + asdu
def hexCa(self): return structToHex( struct.pack('BB', self.ca & 0xFF, self.ca >> 8 & 0xFF))