Exemple #1
0
 def test_to_protobuf_serialization(self):
     from FreeTAKServer.model.FTSModel.Event import Event
     xmlstring = '<event version="2.0" uid="ANDROID-R5CN70EYKQH" type="a-f-G-U-C" how="h-e" start="2020-12-24T18:16:22.325Z" time="2020-12-24T18:16:22.325Z" stale="2020-12-24T18:22:37.325Z"><detail><__group name="Teal" role="Team Member"/><status battery="76"/><takv version="4.2.0.4 (47e136dd).1607456856-CIV" platform="ATAK-CIV" device="SAMSUNG SM-N986U" os="29"/><track course="159.1462509079387" speed="0.0"/><contact callsign="SPAC3SLOTH" endpoint="*:-1:stcp" /><uid Droid="SPAC3SLOTH"/><precisionlocation altsrc="GPS" geopointsrc="GPS"/></detail><point le="9999999.0" ce="11.0" hae="178.84407323983876" lon="-76.675505" lat="39.664392"/></event>'
     fts_obj = XmlSerializer().from_format_to_fts_object(
         xmlstring, Event.Connection())
     y = ProtobufSerializer().from_fts_object_to_format(fts_obj)
     1 == 1
Exemple #2
0
 def test_from_protobuf_serialization(self):
     from FreeTAKServer.model.FTSModel.Event import Event
     from FreeTAKServer.model.protobufModel.fig_pb2 import FederatedEvent
     import lxml
     protobufString = b'\n\x83\x04\x08\xbe\xb9\xfb\x85\xeb.\x10\xbe\xb9\xfb\x85\xeb.\x18\x96\xab\x92\x86\xeb.!\xaf\xf6b\x88\\d<@) {Mcr\x1aG\xc01\x00\x00\x00\xe0\xcf\x12cA9\x00\x00\x00\xe0\xcf\x12cAA\x00\x00\x00\xe0\xcf\x12cAJ.S-1-5-21-2720623347-3037847324-4167270909-1002R\x0ba-f-G-U-C-IZ\x03h-eb\xfa\x02<detail><takv version="4.0.0.117" platform="WinTAK-CIV" os="Microsoft Windows 10 Home" device="Micro-Star International Co., Ltd MS-7C02"/><contact callsign="FEATHER" endpoint="*:-1:stcp"/><uid Droid="FEATHER"/><__group name="Cyan" role="Team Member"/><_flow-tags_ TAK-Server-c0581fed97ff4cb89eb8666a8794670cc9f77ddb-badf-48da-abe7-84545ecda69d="2020-12-29T23:04:27Z"/></detail>hd'
     # protobufString2 = b'"\x00\x00\x00="\x12;\x08\x01\x12.S-1-5-21-2720623347-3037847324-4167270909-1002\x1a\x07FEATHER'
     protobufObj = FederatedEvent()
     protobufObj.ParseFromString(protobufString)
     # protobufObj.ParseFromString(protobufString2)
     #y = [name.name for name in protobufObj.event.DESCRIPTOR.fields]
     fts_obj = ProtobufSerializer().from_format_to_fts_object(protobufObj, Event.Connection())
     z = lxml.etree.tostring(XmlSerializer().from_fts_object_to_format(fts_obj))
     1 == 1
Exemple #3
0
 def intstantiateClientInformationModelFromConnection(
         self, rawClientInformation, queue):
     try:
         tempObject = Event.Connection()
         self.clientInformation = ClientInformation()
         argument = "initialConnection"
         self.clientInformation.dataQueue = queue
         self.clientInformation.socket = rawClientInformation.socket
         self.clientInformation.IP = rawClientInformation.ip
         self.clientInformation.idData = rawClientInformation.xmlString
         self.clientInformation.alive = 1
         self.clientInformation.ID = uuid.uuid1().int
         self.clientInformation.modelObject = XmlSerializer(
         ).from_format_to_fts_object(
             rawClientInformation.xmlString.encode(), tempObject)
         return self.clientInformation
     except Exception as e:
         logger.debug('error in client information controller ' + str(e))
         return -1