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; 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 +}