X-Git-Url: http://average.org/gitweb/?a=blobdiff_plain;f=gps303%2FGT06mod.py;h=86cc8aacdc6542bab99a64a40b4befe90e42ddad;hb=d0da38575fdb1c67188c3bfc9cbdf5f03ba58b69;hp=c3918c754b0e5350ad1601f9f66326b2a9758180;hpb=f3789569d00b94f5fd63cdcd2f958238985bd216;p=loctrkd.git diff --git a/gps303/GT06mod.py b/gps303/GT06mod.py index c3918c7..86cc8aa 100755 --- a/gps303/GT06mod.py +++ b/gps303/GT06mod.py @@ -99,9 +99,15 @@ class LOGIN(_GT06pkt): return super().response(b"") -class SUPERVISION(_GT06pkt): +class SUPERVISION(_GT06pkt): # Server sends supervision number status PROTO = 0x05 + def response(self, supnum=0): + # 1: The device automatically answers Pickup effect + # 2: Automatically Answering Two-way Calls + # 3: Ring manually answer the two-way call + return super().response(b"") + class HEARTBEAT(_GT06pkt): PROTO = 0x08 @@ -150,26 +156,41 @@ class STATUS(_GT06pkt): def from_packet(cls, length, proto, payload): self = super().from_packet(length, proto, payload) if len(payload) == 5: - self.batt, self.ver, self.intvl, self.signal, _ = unpack( - "BBBBB", payload - ) + ( + self.batt, + self.ver, + self.timezone, + self.intvl, + self.signal, + ) = unpack("BBBBB", payload) elif len(payload) == 4: - self.batt, self.ver, self.intvl, _ = unpack("BBBB", payload) + self.batt, self.ver, self.timezone, self.intvl = unpack( + "BBBB", payload + ) self.signal = None return self + def response(self, upload_interval=25): # Set interval in minutes + return super().response(pack("B", upload_interval)) + class HIBERNATION(_GT06pkt): PROTO = 0x14 -class RESET(_GT06pkt): +class RESET(_GT06pkt): # Device sends when it got reset SMS PROTO = 0x15 + def response(self): # Server can send to initiate factory reset + return super().response(b"") + -class WHITELIST_TOTAL(_GT06pkt): +class WHITELIST_TOTAL(_GT06pkt): # Server sends to initiage sync (0x58) PROTO = 0x16 + def response(self, number=3): # Number of whitelist entries + return super().response(pack("B", number)) + class _WIFI_POSITIONING(_GT06pkt): @classmethod @@ -215,10 +236,24 @@ class TIME(_GT06pkt): return super().response(payload) +class PROHIBIT_LBS(_GT06pkt): + PROTO = 0x33 + + def response(self, status=1): # Server sent, 0-off, 1-on + return super().response(pack("B", status)) + + class MOM_PHONE(_GT06pkt): PROTO = 0x43 +class STOP_UPLOAD(_GT06pkt): # Server response to LOGIN to thwart the device + PROTO = 0x44 + + def response(self): + return super().response(b"") + + class STOP_ALARM(_GT06pkt): PROTO = 0x56 @@ -310,6 +345,10 @@ class POSITION_UPLOAD_INTERVAL(_GT06pkt): return super().response(pack("!H", self.interval)) +class SOS_ALARM(_GT06pkt): + PROTO = 0x99 + + # Build a dict protocol number -> class CLASSES = {} if True: # just to indent the code, sorry!