Get/Set Gateway Info
Get or set the gateway info through the /cassia/info API, called via Call the RESTful API.
GET /cassia/info: Get the overall gateway status, including model, firmware version, feature list, cellular module (dongle) configuration, GPS state, etc.POST /cassia/info: Set the gateway configuration. The body only needs the changed fields; the other fields are preserved.
Note
The gateway reboots when the configuration changes, and the new configuration takes effect after the reboot. Posting the same configuration as the current one does not trigger a reboot.
After the gateway reboots, the APP resumes automatically only if
Run at Startupis enabled.
Example
1import asyncio
2import json
3
4import cassiablue
5
6
7async def get_info():
8 ok, ret = await cassiablue.send_cmd("/cassia/info")
9 print("get info done:", ok)
10 if not ok:
11 print("get info failed:", ret)
12 return None
13 return json.loads(ret)
14
15
16async def enable_gps_startup(info):
17 dongle = info.get("dongle") or {}
18 if str(dongle.get("gps_startup")) == "1":
19 print("gps_startup already enabled, skip")
20 return
21
22 body = json.dumps({"dongle": {"gps_startup": "1"}})
23 ok, ret = await cassiablue.send_cmd("/cassia/info", "POST", None, body)
24 print("set gps_startup done:", ok, ret)
25
26
27async def main():
28 info = await get_info()
29 if not info:
30 return
31
32 print("model:", info.get("model"))
33 print("version:", info.get("version"))
34 print("features:", info.get("features"))
35
36 await enable_gps_startup(info)
37
38
39asyncio.run(main())
API
Get Gateway Info
ok, result = await cassiablue.send_cmd("/cassia/info")
info = json.loads(result)
The response is the overall gateway status. The following is an excerpt (unrelated fields are omitted):
{
"model": "M2000",
"version": "2.2.0.2604281450",
"features": ["gps", "microapp"],
"dongle": {
"imsi": "",
"operator": "",
"band": "",
"ICCID": "",
"signal": 0,
"apn": "",
"gps_startup": "1"
},
"gps": {
"TIME": "",
"LON": "",
"LAT": "",
"NS": "",
"WE": "",
"SATELLITE1": 0,
"SATELLITE1_SNR": 0
}
}
Field |
Type |
Description |
|---|---|---|
model |
str |
Gateway model |
version |
str |
Gateway firmware version |
features |
list |
Features supported by the gateway (e.g. |
dongle |
dict |
Cellular module configuration and status (including |
gps |
dict |
GPS state (refer to GPS Positioning) |
Set Gateway Info
body = json.dumps({"dongle": {"gps_startup": "1"}})
ok, result = await cassiablue.send_cmd("/cassia/info", "POST", None, body)
The body only needs to contain the changed fields. On success, result returns OK.