Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif bytes([x]) == b"\x13":
result["url"]+=".gov"
else:
result["url"]+=chr(x) #x.decode("ascii") #Yep ASCII only
url=aios.String("url")
url.decode(result["url"])
found.payload.append(url)
elif etype.val== ESType.tlm.value:
myinfo=aios.IntByte("version")
data=myinfo.decode(data)
found.payload.append(myinfo)
myinfo=aios.ShortInt("battery")
data=myinfo.decode(data)
result["battery"]=myinfo.val
found.payload.append(myinfo)
myinfo=aios.Float88("temperature")
data=myinfo.decode(data)
found.payload.append(myinfo)
result["temperature"]=myinfo.val
myinfo=aios.LongInt("pdu count")
data=myinfo.decode(data)
found.payload.append(myinfo)
result["pdu count"]=myinfo.val
myinfo=aios.LongInt("uptime")
data=myinfo.decode(data)
found.payload.append(myinfo)
result["uptime"]=myinfo.val*100 #in msecs
return result
#elif etype.val== ESType.tlm.eid:
else:
result["data"]=data
xx=Itself("data")
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
encodedurl.append(aios.ULongInt("Uptime"))
if "uptime" in self.type_payload:
encodedurl[-1].val = self.type_payload["uptime"]
else:
encodedurl[-1].val = 0