Skip to content

update schemas to reflect what asset_tracker_v2 is actually sending #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 14 commits into
base: v1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,444 changes: 1,406 additions & 2,038 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"rollup-plugin-polyfill-node": "^0.7.0",
"ts-jest": "^27.0.3",
"tslint": "^5.20.1",
"typescript": "^4.3.5"
"typescript": "4.9.5"
},
"jest": {
"moduleFileExtensions": [
Expand Down
2 changes: 1 addition & 1 deletion schemas/cloudToDevice/ground_fix/ground-fix.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"maximum": 180
},
"Uncertainty":{
"type":"integer",
"type":"number",
"description":"HPE (horizontal positioning error) in meters"
},
"FulfilledWith": {
Expand Down
1 change: 0 additions & 1 deletion schemas/deviceShadow/ipShadow/ipShadow-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
},
"deviceInfo": {
"modemFirmware": "mfw_nrf9160_1.2.2",
"batteryVoltage": 4121,
"imei": "352656101397613",
"board": "thingy91_nrf9160",
"appVersion": "v1.4.0",
Expand Down
67 changes: 50 additions & 17 deletions schemas/deviceShadow/ipShadow/ipShadow.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
},
"reported": {
"$ref": "#/definitions/Reported"
},
"delta": {
"$ref": "#/definitions/Delta"
}
},
"required": [
Expand All @@ -23,7 +26,6 @@
"Desired": {
"type": "object",
"description": "The requested state of the device set by the application.",
"additionalProperties": false,
"properties": {
"pairing": {
"$ref": "#/definitions/Pairing"
Expand All @@ -44,10 +46,28 @@
],
"title": "Desired"
},
"Delta": {
"type": "object",
"description": "The difference between the desired and the reported properties.",
"properties": {
"pairing": {
"$ref": "#/definitions/Pairing"
},
"nrfcloud_mqtt_topic_prefix": {
"type": "string"
},
"config": {
"$ref": "config.json#/definitions/Config"
},
"control": {
"$ref": "#/definitions/Control"
}
},
"title": "Desired"
},
"Reported": {
"type": "object",
"description": "The current state reported by the device",
"additionalProperties": false,
"properties": {
"connection": {
"$ref": "#/definitions/Connection"
Expand Down Expand Up @@ -145,7 +165,6 @@
"Device": {
"type": "object",
"description": "Device meta data",
"additionalProperties": false,
"properties": {
"networkInfo": {
"$ref": "#/definitions/NetworkInfo"
Expand All @@ -165,7 +184,7 @@
"NetworkInfo": {
"type": "object",
"description": "Device's connected network information",
"additionalProperties": false,
"additionalProperties": true,
"properties": {
"currentBand": {
"type": "integer"
Expand All @@ -177,9 +196,9 @@
"type": "integer"
},
"mccmnc": {
"type": "string",
"type": "number",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the modem_info library provides a string for this value.
the nrf_cloud library reports this value as a string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current asset_tracker_v2 sends number:

"roam": {
          "v": {
            "band": 12,
            "nw": "LTE-M",
            "rsrp": -119,
            "area": 34635,
            "mccmnc": 310410,
            "cell": 141255696,
            "ip": "10.165.115.123",
            "eest": 7
          },
          "ts": 1681909040890
        },

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a breaking change for fw apps using modem_info library or nrf_cloud library to update the shadow.

"description": "Combination of the mobile country code and mobile network codes",
"pattern": "^\\d+$"
"minimum": 10000
},
"ipAddress": {
"type": "string"
Expand All @@ -192,6 +211,14 @@
},
"networkMode": {
"type": "string"
},
"rsrp": {
"type": "number",
"minimum": -199,
"maximum": 0,
"description":
"Reference Signal Received Power (RSRP). The average power level in dBm received from a single reference signal in an LTE (Long-term Evolution) network. Typically this value ranges from -140 to -40 dBm. ",
"examples": [-97, -104]
}
},
"required": [
Expand All @@ -200,15 +227,12 @@
"currentBand",
"ipAddress",
"mccmnc",
"networkMode",
"supportedBands",
"ueMode"
"networkMode"
],
"title": "NetworkInfo"
},
"SimInfo": {
"type": "object",
"additionalProperties": false,
"description": "Device sim information",
"properties": {
"uiccMode": {
Expand All @@ -231,14 +255,10 @@
"DeviceInfo": {
"type": "object",
"description": "Data describing the device's application, firmware, and hardware versions",
"additionalProperties": false,
"properties": {
"modemFirmware": {
"type": "string"
},
"batteryVoltage": {
"type": "integer"
},
"imei": {
"type": "string"
},
Expand All @@ -250,12 +270,25 @@
},
"appName": {
"type": "string"
},
"sdkVer": {
"type": "string",
"description": "nRF Connect SDK version",
"examples": ["v2.4.0"]
},
"zephyrVer": {
"type": "string",
"description": "Zephyr version",
"examples": ["v3.3.99-ncs1"]
},
"hwVer": {
"type": "string",
"description": "Hardware version",
"examples": ["nRF9160 SICA B1A"]
}
},
"required": [
"appName",
"appVersion",
"batteryVoltage",
"board",
"imei",
"modemFirmware"
Expand All @@ -272,7 +305,7 @@
"description": "List of application ids that let nRF Connect for Cloud know what cards to display before receiving messages. See schemas under device to cloud to see a list of supported application ids.",
"items": {
"type": "string",
"enum": ["GPS", "TEMP", "HUMID", "AIR_PRESS", "FLIP", "RSRP"]
"enum": ["GNSS", "BUTTON", "TEMP", "HUMID", "AIR_PRESS", "FLIP", "RSRP"]
},
"examples": [
[ "PRESS" ],
Expand Down
5 changes: 5 additions & 0 deletions schemas/deviceToCloud/battery/battery-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"appId": "BATTERY",
"messageType": "DATA",
"data": "50"
}
31 changes: 31 additions & 0 deletions schemas/deviceToCloud/battery/battery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"title":"Battery fuel gauge percentage",
"description":"Battery percentage provided by the PMIC's fuel gauge function.",
"type":"object",
"properties":{
"appId":{
"type":"string",
"const":"BATTERY"
},
"messageType":{
"type":"string",
"const":"DATA"
},
"data":{
"type":"string",
"description":"Percentage (0-100)",
"pattern":"^(0|[1-9][0-9]?|100)$"
},
"ts": {
"type": "number",
"description": "Unix timestamp given in milliseconds when the data was sampled"
}
},
"required":[
"appId",
"messageType",
"data",
"ts"
],
"additionalProperties":false
}
3 changes: 1 addition & 2 deletions schemas/deviceToCloud/device/device-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"currentBand": 12,
"supportedBands": "(2,3,4,8,12,13,20,28)\r\n",
"areaCode": 34049,
"mccmnc": "310410",
"mccmnc": 310410,
"ipAddress": "10.165.197.1",
"ueMode": 2,
"cellID": 128566289,
Expand All @@ -19,7 +19,6 @@
},
"deviceInfo": {
"modemFirmware": "mfw_nrf9160_1.2.2",
"batteryVoltage": 4121,
"imei": "352656101397613",
"board": "thingy91_nrf9160",
"appVersion": "v1.4.0",
Expand Down
19 changes: 9 additions & 10 deletions schemas/deviceToCloud/device/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
"type": "integer"
},
"mccmnc": {
"type": "string",
"type": "integer",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/nrfconnect/sdk-nrf/blob/3797fac81db0b317d14abded836b3ebc3220979c/lib/modem_info/modem_info_params.c#L71

this has been a string for a long time.
ATv2 has its own implementation, which is a number.
i have no preference, other than that all code in NCS is aligned.

"description": "Combination of the mobile country code and mobile network codes",
"pattern": "^\\d+$"
"minimum": 10000
},
"ipAddress": {
"type": "string"
Expand All @@ -69,6 +69,9 @@
},
"networkMode": {
"type": "string"
},
"rsrp": {
"type": "integer"
}
},
"required": [
Expand All @@ -77,9 +80,7 @@
"currentBand",
"ipAddress",
"mccmnc",
"networkMode",
"supportedBands",
"ueMode"
"networkMode"
],
"title": "NetworkInfo"
},
Expand Down Expand Up @@ -113,9 +114,6 @@
"modemFirmware": {
"type": "string"
},
"batteryVoltage": {
"type": "integer"
},
"imei": {
"type": "string"
},
Expand All @@ -127,12 +125,13 @@
},
"appName": {
"type": "string"
},
"iccid": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/nrfconnect/sdk-nrf/blob/3797fac81db0b317d14abded836b3ebc3220979c/lib/modem_info/modem_info_params.c#L39

ICCID, along with IMSI and UICC mode, has been reported in the "simInfo" section for a long time.
again, no preference, but all NCS code should be aligned.

"type": "string"
}
},
"required": [
"appName",
"appVersion",
"batteryVoltage",
"board",
"imei",
"modemFirmware"
Expand Down
17 changes: 16 additions & 1 deletion schemas/deviceToCloud/ground_fix/ground-fix.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
"earfcn": {
"$ref": "#/definitions/Earfcn"
},
"adv": {
"$ref": "#/definitions/Adv"
},
"nmr": {
"type": "array",
"items": {
Expand All @@ -97,7 +100,10 @@
},
"rsrq": {
"$ref": "#/definitions/Rsrq"
}
},
"timeDiff": {
"$ref": "#/definitions/TimeDiff"
}
},
"required": [
"earfcn",
Expand Down Expand Up @@ -159,6 +165,15 @@
"minimum": 0,
"maximum": 262143
},
"Adv": {
"type": "number",
"description": "TimingAdvance: The length of time a signal takes to reach the base station from a mobile phone (half of rtt=round trip time). The units are symbols (Ts) as specified in 3GPP TS 36.211 (LTE). The expected resolution for nRF Cloud API is 1 Ts. Range 0..20512.",
"minimum": 0
},
"TimeDiff": {
"type": "number",
"description": "Milliseconds that the neighbor cell was observed after the serving cell was observed. Improves accuracy for devices in motion."
},
"Pci": {
"type": "integer",
"description": "Physical Cell Identity (PCI).",
Expand Down