Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def tlm_encoder(self):
encodedurl = []
encodedurl.append(aios.NBytes("VBATT",2))
if "battery" in self.type_payload:
encodedurl[-1].val = self.type_payload["battery"]
else:
encodedurl[-1].val = -128
encodedurl.append(aios.Float88("Temperature"))
if "temperature" in self.type_payload:
encodedurl[-1].val = self.type_payload["temperature"]
else:
encodedurl[-1].val = -128
encodedurl.append(aios.ULongInt("Count"))
if "count" in self.type_payload:
encodedurl[-1].val = self.type_payload["count"]
else:
encodedurl[-1].val = 0
def uid_encoder(self):
encodedurl = []
encodedurl.append(aios.IntByte("Tx Power",self.power))
encodedurl.append(aios.NBytes("Namespace",10))
encodedurl[-1].val = self.type_payload["namespace"]
encodedurl.append(aios.NBytes("Instance",6))
encodedurl[-1].val = self.type_payload["instance"]
encodedurl.append(aios.NBytes("RFU",2))
encodedurl[-1].val = b'\x00\x00'
self.service_data_length.val = 23 #Update the payload length/ways the same for uid
return encodedurl
def uid_encoder(self):
encodedurl = []
encodedurl.append(aios.IntByte("Tx Power",self.power))
encodedurl.append(aios.NBytes("Namespace",10))
encodedurl[-1].val = self.type_payload["namespace"]
encodedurl.append(aios.NBytes("Instance",6))
encodedurl[-1].val = self.type_payload["instance"]
encodedurl.append(aios.NBytes("RFU",2))
encodedurl[-1].val = b'\x00\x00'
self.service_data_length.val = 23 #Update the payload length/ways the same for uid
return encodedurl
def uid_encoder(self):
encodedurl = []
encodedurl.append(aios.IntByte("Tx Power",self.power))
encodedurl.append(aios.NBytes("Namespace",10))
encodedurl[-1].val = self.type_payload["namespace"]
encodedurl.append(aios.NBytes("Instance",6))
encodedurl[-1].val = self.type_payload["instance"]
encodedurl.append(aios.NBytes("RFU",2))
encodedurl[-1].val = b'\x00\x00'
self.service_data_length.val = 23 #Update the payload length/ways the same for uid
return encodedurl
def eid_encoder(self):
encodedurl = []
encodedurl.append(aios.IntByte("Tx Power",self.power))
encodedurl.append(aios.NBytes("Namespace",8))
encodedurl[-1].val = self.type_payload
self.service_data_length.val = 13
return encodedurl