From b246ec14314b2cd8bc0d2ea3f5abe28a01fdb108 Mon Sep 17 00:00:00 2001 From: Cole Hafner Date: Tue, 27 Jun 2023 15:55:58 -0700 Subject: [PATCH 1/4] feat: added 'requestId' to device <<< cloud --- __tests__/schemas.spec.ts | 2 +- .../cell_position/cell-position-example.json | 3 ++- schemas/cloudToDevice/cell_position/cell-position.json | 7 +++++++ schemas/cloudToDevice/ground_fix/ground-fix-example.json | 3 ++- schemas/cloudToDevice/ground_fix/ground-fix.json | 7 +++++++ schemas/cloudToDevice/wifi/wifi-position-example.json | 3 ++- schemas/cloudToDevice/wifi/wifi-position.json | 9 ++++++++- 7 files changed, 29 insertions(+), 5 deletions(-) diff --git a/__tests__/schemas.spec.ts b/__tests__/schemas.spec.ts index 7cc5e13..1ea7c4b 100644 --- a/__tests__/schemas.spec.ts +++ b/__tests__/schemas.spec.ts @@ -37,7 +37,7 @@ describe(header('device >>> cloud'), () => { describe.each(schemasRecords)('$schemaName', testGroup); }); -describe(header('cloud >>> device'), () => { +describe(header('device <<< cloud'), () => { const { schemasRecords } = getSchemaTestCollection( SchemaCollectionName.CloudToDevice, ); diff --git a/schemas/cloudToDevice/cell_position/cell-position-example.json b/schemas/cloudToDevice/cell_position/cell-position-example.json index df82bb8..dc3ce54 100644 --- a/schemas/cloudToDevice/cell_position/cell-position-example.json +++ b/schemas/cloudToDevice/cell_position/cell-position-example.json @@ -4,6 +4,7 @@ "data": { "lat": -45, "lon": 100, - "uncertainty": 500 + "uncertainty": 500, + "requestId": "df633a1b-06ab-4a3e-9a29-3cc5e7e1f0d6" } } diff --git a/schemas/cloudToDevice/cell_position/cell-position.json b/schemas/cloudToDevice/cell_position/cell-position.json index eb6f167..115ad3d 100644 --- a/schemas/cloudToDevice/cell_position/cell-position.json +++ b/schemas/cloudToDevice/cell_position/cell-position.json @@ -25,6 +25,9 @@ }, "fulfilledWith":{ "$ref": "#/definitions/FulfilledWith" + }, + "requestId":{ + "$ref": "#/definitions/RequestId" } }, "additionalProperties":false @@ -58,6 +61,10 @@ "FulfilledWith": { "enum": ["MCELL", "SCELL"], "description": "How the request was fulfilled. MCELL if neighbor cells were used. SCELL if only serving cell." + }, + "RequestId": { + "type": "string", + "description": "Unique ID for the request" } } } diff --git a/schemas/cloudToDevice/ground_fix/ground-fix-example.json b/schemas/cloudToDevice/ground_fix/ground-fix-example.json index eab1a30..5981b0f 100644 --- a/schemas/cloudToDevice/ground_fix/ground-fix-example.json +++ b/schemas/cloudToDevice/ground_fix/ground-fix-example.json @@ -4,6 +4,7 @@ "data": { "lat": -45, "lon": 100, - "uncertainty": 500 + "uncertainty": 500, + "requestId": "df633a1b-06ab-4a3e-9a29-3cc5e7e1f0d6" } } diff --git a/schemas/cloudToDevice/ground_fix/ground-fix.json b/schemas/cloudToDevice/ground_fix/ground-fix.json index a16db30..4525355 100644 --- a/schemas/cloudToDevice/ground_fix/ground-fix.json +++ b/schemas/cloudToDevice/ground_fix/ground-fix.json @@ -25,6 +25,9 @@ }, "fulfilledWith":{ "$ref": "#/definitions/FulfilledWith" + }, + "requestId":{ + "$ref": "#/definitions/RequestId" } }, "additionalProperties":false @@ -58,6 +61,10 @@ "FulfilledWith": { "enum": ["MCELL", "SCELL", "WIFI"], "description": "How the request was fulfilled. WIFI is prioritized by the cloud. Falls back to SCELL/MCELL." + }, + "RequestId": { + "type": "string", + "description": "Unique ID for the request" } } } diff --git a/schemas/cloudToDevice/wifi/wifi-position-example.json b/schemas/cloudToDevice/wifi/wifi-position-example.json index 81de4ea..0ed7959 100644 --- a/schemas/cloudToDevice/wifi/wifi-position-example.json +++ b/schemas/cloudToDevice/wifi/wifi-position-example.json @@ -4,6 +4,7 @@ "data": { "lat": -45.39295402, "lon": 100.93402931, - "uncertainty": 70 + "uncertainty": 70, + "requestId": "df633a1b-06ab-4a3e-9a29-3cc5e7e1f0d6" } } \ No newline at end of file diff --git a/schemas/cloudToDevice/wifi/wifi-position.json b/schemas/cloudToDevice/wifi/wifi-position.json index f73fb2f..60f9526 100644 --- a/schemas/cloudToDevice/wifi/wifi-position.json +++ b/schemas/cloudToDevice/wifi/wifi-position.json @@ -22,7 +22,10 @@ }, "uncertainty": { "$ref": "#/definitions/Uncertainty" - } + }, + "requestId":{ + "$ref": "#/definitions/RequestId" + } }, "additionalProperties": false }, @@ -51,6 +54,10 @@ "Uncertainty": { "type": "integer", "description": "HPE (horizontal positioning error) in meters" + }, + "RequestId": { + "type": "string", + "description": "Unique ID for the request" } } } \ No newline at end of file From 1542c43f0f6e841b8f9f5571233ab1958bd2006e Mon Sep 17 00:00:00 2001 From: Cole Hafner Date: Tue, 17 Oct 2023 12:34:10 -0700 Subject: [PATCH 2/4] Revert "feat: added 'requestId' to device <<< cloud" This reverts commit b246ec14314b2cd8bc0d2ea3f5abe28a01fdb108. --- __tests__/schemas.spec.ts | 2 +- .../cell_position/cell-position-example.json | 3 +-- schemas/cloudToDevice/cell_position/cell-position.json | 7 ------- schemas/cloudToDevice/ground_fix/ground-fix-example.json | 3 +-- schemas/cloudToDevice/ground_fix/ground-fix.json | 7 ------- schemas/cloudToDevice/wifi/wifi-position-example.json | 3 +-- schemas/cloudToDevice/wifi/wifi-position.json | 9 +-------- 7 files changed, 5 insertions(+), 29 deletions(-) diff --git a/__tests__/schemas.spec.ts b/__tests__/schemas.spec.ts index 1ea7c4b..7cc5e13 100644 --- a/__tests__/schemas.spec.ts +++ b/__tests__/schemas.spec.ts @@ -37,7 +37,7 @@ describe(header('device >>> cloud'), () => { describe.each(schemasRecords)('$schemaName', testGroup); }); -describe(header('device <<< cloud'), () => { +describe(header('cloud >>> device'), () => { const { schemasRecords } = getSchemaTestCollection( SchemaCollectionName.CloudToDevice, ); diff --git a/schemas/cloudToDevice/cell_position/cell-position-example.json b/schemas/cloudToDevice/cell_position/cell-position-example.json index dc3ce54..df82bb8 100644 --- a/schemas/cloudToDevice/cell_position/cell-position-example.json +++ b/schemas/cloudToDevice/cell_position/cell-position-example.json @@ -4,7 +4,6 @@ "data": { "lat": -45, "lon": 100, - "uncertainty": 500, - "requestId": "df633a1b-06ab-4a3e-9a29-3cc5e7e1f0d6" + "uncertainty": 500 } } diff --git a/schemas/cloudToDevice/cell_position/cell-position.json b/schemas/cloudToDevice/cell_position/cell-position.json index 115ad3d..eb6f167 100644 --- a/schemas/cloudToDevice/cell_position/cell-position.json +++ b/schemas/cloudToDevice/cell_position/cell-position.json @@ -25,9 +25,6 @@ }, "fulfilledWith":{ "$ref": "#/definitions/FulfilledWith" - }, - "requestId":{ - "$ref": "#/definitions/RequestId" } }, "additionalProperties":false @@ -61,10 +58,6 @@ "FulfilledWith": { "enum": ["MCELL", "SCELL"], "description": "How the request was fulfilled. MCELL if neighbor cells were used. SCELL if only serving cell." - }, - "RequestId": { - "type": "string", - "description": "Unique ID for the request" } } } diff --git a/schemas/cloudToDevice/ground_fix/ground-fix-example.json b/schemas/cloudToDevice/ground_fix/ground-fix-example.json index 5981b0f..eab1a30 100644 --- a/schemas/cloudToDevice/ground_fix/ground-fix-example.json +++ b/schemas/cloudToDevice/ground_fix/ground-fix-example.json @@ -4,7 +4,6 @@ "data": { "lat": -45, "lon": 100, - "uncertainty": 500, - "requestId": "df633a1b-06ab-4a3e-9a29-3cc5e7e1f0d6" + "uncertainty": 500 } } diff --git a/schemas/cloudToDevice/ground_fix/ground-fix.json b/schemas/cloudToDevice/ground_fix/ground-fix.json index 4525355..a16db30 100644 --- a/schemas/cloudToDevice/ground_fix/ground-fix.json +++ b/schemas/cloudToDevice/ground_fix/ground-fix.json @@ -25,9 +25,6 @@ }, "fulfilledWith":{ "$ref": "#/definitions/FulfilledWith" - }, - "requestId":{ - "$ref": "#/definitions/RequestId" } }, "additionalProperties":false @@ -61,10 +58,6 @@ "FulfilledWith": { "enum": ["MCELL", "SCELL", "WIFI"], "description": "How the request was fulfilled. WIFI is prioritized by the cloud. Falls back to SCELL/MCELL." - }, - "RequestId": { - "type": "string", - "description": "Unique ID for the request" } } } diff --git a/schemas/cloudToDevice/wifi/wifi-position-example.json b/schemas/cloudToDevice/wifi/wifi-position-example.json index 0ed7959..81de4ea 100644 --- a/schemas/cloudToDevice/wifi/wifi-position-example.json +++ b/schemas/cloudToDevice/wifi/wifi-position-example.json @@ -4,7 +4,6 @@ "data": { "lat": -45.39295402, "lon": 100.93402931, - "uncertainty": 70, - "requestId": "df633a1b-06ab-4a3e-9a29-3cc5e7e1f0d6" + "uncertainty": 70 } } \ No newline at end of file diff --git a/schemas/cloudToDevice/wifi/wifi-position.json b/schemas/cloudToDevice/wifi/wifi-position.json index 60f9526..f73fb2f 100644 --- a/schemas/cloudToDevice/wifi/wifi-position.json +++ b/schemas/cloudToDevice/wifi/wifi-position.json @@ -22,10 +22,7 @@ }, "uncertainty": { "$ref": "#/definitions/Uncertainty" - }, - "requestId":{ - "$ref": "#/definitions/RequestId" - } + } }, "additionalProperties": false }, @@ -54,10 +51,6 @@ "Uncertainty": { "type": "integer", "description": "HPE (horizontal positioning error) in meters" - }, - "RequestId": { - "type": "string", - "description": "Unique ID for the request" } } } \ No newline at end of file From 02beec71ca649b71bdd346d547c482be074c9564 Mon Sep 17 00:00:00 2001 From: Cole Hafner Date: Tue, 17 Oct 2023 12:40:44 -0700 Subject: [PATCH 3/4] feat: added support for PGNSS --- .../pgnss-error/pgnss-err-example.json | 5 ++ schemas/cloudToDevice/pgnss-error/pgnss.json | 24 +++++++ .../pgnss/pgnss-config-example.json | 4 ++ schemas/cloudToDevice/pgnss/pgnss.json | 19 ++++++ .../pgnss/pgnss-default-example.json | 6 ++ .../deviceToCloud/pgnss/pgnss-example.json | 10 +++ schemas/deviceToCloud/pgnss/pgnss.json | 63 +++++++++++++++++++ 7 files changed, 131 insertions(+) create mode 100644 schemas/cloudToDevice/pgnss-error/pgnss-err-example.json create mode 100644 schemas/cloudToDevice/pgnss-error/pgnss.json create mode 100644 schemas/cloudToDevice/pgnss/pgnss-config-example.json create mode 100644 schemas/cloudToDevice/pgnss/pgnss.json create mode 100644 schemas/deviceToCloud/pgnss/pgnss-default-example.json create mode 100644 schemas/deviceToCloud/pgnss/pgnss-example.json create mode 100644 schemas/deviceToCloud/pgnss/pgnss.json diff --git a/schemas/cloudToDevice/pgnss-error/pgnss-err-example.json b/schemas/cloudToDevice/pgnss-error/pgnss-err-example.json new file mode 100644 index 0000000..2021ca5 --- /dev/null +++ b/schemas/cloudToDevice/pgnss-error/pgnss-err-example.json @@ -0,0 +1,5 @@ +{ + "appId": "PGNSS", + "messageType": "DATA", + "err": 42200 +} diff --git a/schemas/cloudToDevice/pgnss-error/pgnss.json b/schemas/cloudToDevice/pgnss-error/pgnss.json new file mode 100644 index 0000000..faae591 --- /dev/null +++ b/schemas/cloudToDevice/pgnss-error/pgnss.json @@ -0,0 +1,24 @@ +{ + "title":"PGNSS Position Error Response", + "description":"Responds with error. Successful response is documented in 'pgnss' directory.", + "type":"object", + "properties":{ + "appId":{ + "type":"string", + "const":"PGNSS" + }, + "messageType":{ + "type":"string", + "const":"DATA" + }, + "err": { + "type":"integer" + } + }, + "additionalProperties":false, + "required":[ + "appId", + "messageType", + "err" + ] +} diff --git a/schemas/cloudToDevice/pgnss/pgnss-config-example.json b/schemas/cloudToDevice/pgnss/pgnss-config-example.json new file mode 100644 index 0000000..92b6fc4 --- /dev/null +++ b/schemas/cloudToDevice/pgnss/pgnss-config-example.json @@ -0,0 +1,4 @@ +[ + "pgps.nrfcloud.com", + "public/15286-79200_15293-64800.bin" +] \ No newline at end of file diff --git a/schemas/cloudToDevice/pgnss/pgnss.json b/schemas/cloudToDevice/pgnss/pgnss.json new file mode 100644 index 0000000..b74be5e --- /dev/null +++ b/schemas/cloudToDevice/pgnss/pgnss.json @@ -0,0 +1,19 @@ +{ + "title": "PGNSS Success Response", + "description": "Responds with link to PGNSS file on success.", + "type": "array", + "prefixItems": [ + { + "type": "string", + "description": "Host. The protocol agnostic URL for accessing PGNSS prediction files.", + "pattern": "pgps\\.nrfcloud\\.com" + }, + { + "type": "string", + "description": "Path. The path to the file that contains PGNSS prediction data.", + "pattern": "public\\/.+.bin" + } + ], + "minItems": 2, + "items": false +} \ No newline at end of file diff --git a/schemas/deviceToCloud/pgnss/pgnss-default-example.json b/schemas/deviceToCloud/pgnss/pgnss-default-example.json new file mode 100644 index 0000000..9ba5026 --- /dev/null +++ b/schemas/deviceToCloud/pgnss/pgnss-default-example.json @@ -0,0 +1,6 @@ +{ + "appId": "PGNSS", + "messageType": "DATA", + "data": { + } +} diff --git a/schemas/deviceToCloud/pgnss/pgnss-example.json b/schemas/deviceToCloud/pgnss/pgnss-example.json new file mode 100644 index 0000000..dd19788 --- /dev/null +++ b/schemas/deviceToCloud/pgnss/pgnss-example.json @@ -0,0 +1,10 @@ +{ + "appId": "PGNSS", + "messageType": "DATA", + "data": { + "startGpsDay": 234234, + "startGpsTimeOfDaySeconds": 85399, + "predictionCount": 84, + "predictionIntervalMinutes": 240 + } +} diff --git a/schemas/deviceToCloud/pgnss/pgnss.json b/schemas/deviceToCloud/pgnss/pgnss.json new file mode 100644 index 0000000..8728184 --- /dev/null +++ b/schemas/deviceToCloud/pgnss/pgnss.json @@ -0,0 +1,63 @@ +{ + "title": "PGNSS", + "description": "PGNSS request", + "type": "object", + "properties": { + "appId": { + "type": "string", + "const": "PGNSS" + }, + "messageType": { + "type": "string", + "const": "DATA" + }, + "data": { + "type": "object", + "properties": { + "startGpsDay": { + "$ref": "#/definitions/StartGpsDay" + }, + "startGpsTimeOfDaySeconds": { + "$ref": "#/definitions/StartGpsTimeOfDaySeconds" + }, + "predictionCount": { + "$ref": "#/definitions/PredictionCount" + }, + "predictionIntervalMinutes": { + "$ref": "#/definitions/PredictionIntervalMinutes" + } + } + } + }, + "definitions": { + "StartGpsDay": { + "type": "integer", + "description": "GPS day to start the predictions." + }, + "StartGpsTimeOfDaySeconds": { + "type": "integer", + "description": "Time of day (in seconds) to start collecting the GPS predictions.", + "minimum": 0, + "maximum": 86400 + }, + "PredictionCount": { + "type": "integer", + "description": "Number of GPS predictions (4 hour periods) to return. There are 6 predictions per day. You can request up to 14 days.", + "minimum": 1, + "maximum": 84 + }, + "PredictionIntervalMinutes": { + "type": "integer", + "description": "The interval (in minutes) at which predictions are spaced.", + "minimum": 120, + "maximum": 480, + "multipleOf": 60 + } + }, + "required":[ + "appId", + "messageType", + "data" + ], + "additionalProperties": false +} From ff0cffce694f55510bda268a86123e85d47c0c9a Mon Sep 17 00:00:00 2001 From: Cole Hafner Date: Tue, 17 Oct 2023 12:47:27 -0700 Subject: [PATCH 4/4] fix: added schema test fix for pgnss --- __tests__/schemas.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/schemas.spec.ts b/__tests__/schemas.spec.ts index 7cc5e13..b325803 100644 --- a/__tests__/schemas.spec.ts +++ b/__tests__/schemas.spec.ts @@ -11,9 +11,9 @@ import { isValidSchema, getValidationWithDependencies } from '../utilities'; // @ts-ignore const testGroup = ({ schemaName, schema, schemaTests }) => { - // pgps has an array response that is valid that needs to be converted to an array of arrays + // pgps and pgnss have an array response that is valid that needs to be converted to an array of arrays const chosen = - schemaName === 'pgps' && Array.isArray(schemaTests) + ['pgps', 'pgnss'].includes(schemaName.toLowerCase()) && Array.isArray(schemaTests) ? [schemaTests] : schemaTests;