]> www.average.org Git - loctrkd.git/blobdiff - gps303/gps303proto.py
Use config from the config file to config
[loctrkd.git] / gps303 / gps303proto.py
index 32aae55970b134409342ad766dfdf17710a7251e..46f12899e62b2d0f38cc087f774da20d6d6d1530 100755 (executable)
@@ -272,8 +272,32 @@ class PROHIBIT_LBS(GPS303Pkt):
         return self.make_packet(pack("B", status))
 
 
+class LBS_SWITCH_TIMES(GPS303Pkt):
+    PROTO = 0x34
+    INLINE = False
+
+    def response(self):
+        return self.make_packet(b"")
+
+
+class REMOTE_MONITOR_PHONE(GPS303Pkt):
+    PROTO = 0x40
+    INLINE = False
+
+
+class SOS_PHONE(GPS303Pkt):
+    PROTO = 0x41
+    INLINE = False
+
+
+class DAD_PHONE(GPS303Pkt):
+    PROTO = 0x42
+    INLINE = False
+
+
 class MOM_PHONE(GPS303Pkt):
     PROTO = 0x43
+    INLINE = False
 
 
 class STOP_UPLOAD(GPS303Pkt):  # Server response to LOGIN to thwart the device
@@ -290,35 +314,35 @@ class SETUP(GPS303Pkt):
 
     def response(
         self,
-        uploadIntervalSeconds=0x0300,
-        binarySwitch=0b00110001,
+        uploadintervalseconds=0x0300,
+        binaryswitch=0b00110001,
         alarms=[0, 0, 0],
-        dndTimeSwitch=0,
-        dndTimes=[0, 0, 0],
-        gpsTimeSwitch=0,
-        gpsTimeStart=0,
-        gpsTimeStop=0,
-        phoneNumbers=["", "", ""],
+        dndtimeswitch=0,
+        dndtimes=[0, 0, 0],
+        gpstimeswitch=0,
+        gpstimestart=0,
+        gpstimestop=0,
+        phonenumbers=["", "", ""],
     ):
         def pack3b(x):
             return pack("!I", x)[1:]
 
         payload = b"".join(
             [
-                pack("!H", uploadIntervalSeconds),
-                pack("B", binarySwitch),
+                pack("!H", uploadintervalseconds),
+                pack("B", binaryswitch),
             ]
             + [pack3b(el) for el in alarms]
             + [
-                pack("B", dndTimeSwitch),
+                pack("B", dndtimeswitch),
             ]
-            + [pack3b(el) for el in dndTimes]
+            + [pack3b(el) for el in dndtimes]
             + [
-                pack("B", gpsTimeSwitch),
-                pack("!H", gpsTimeStart),
-                pack("!H", gpsTimeStop),
+                pack("B", gpstimeswitch),
+                pack("!H", gpstimestart),
+                pack("!H", gpstimestop),
             ]
-            + [b";".join([el.encode() for el in phoneNumbers])]
+            + [b";".join([el.encode() for el in phonenumbers])]
         )
         return self.make_packet(payload)
 
@@ -347,6 +371,7 @@ class WIFI_POSITIONING(_WIFI_POSITIONING):
 
 class MANUAL_POSITIONING(GPS303Pkt):
     PROTO = 0x80
+    INLINE = False
 
 
 class BATTERY_CHARGE(GPS303Pkt):