コード例 #1
0
 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
コード例 #2
0
 def hexIoa(self):
     return structToHex(
         struct.pack('BBB', self.ioa & 0xFF, self.ioa >> 8 & 0xFF,
                     self.ioa >> 16 & 0xFF))
コード例 #3
0
 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
コード例 #4
0
 def hexCa(self):
     return structToHex(
         struct.pack('BB', self.ca & 0xFF, self.ca >> 8 & 0xFF))