nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
nrf_cloud_defs.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NRF_CLOUD_DEFS_H__
8#define NRF_CLOUD_DEFS_H__
9
10#include <zephyr/toolchain.h>
11
16/* Message schemas defined by nRF Cloud:
17 * https://github.com/nRFCloud/application-protocols/tree/v1/schemas
18 */
19
20/* nRF Cloud appID values */
21#define NRF_CLOUD_JSON_APPID_KEY "appId"
22#define NRF_CLOUD_JSON_APPID_VAL_AGNSS "AGNSS"
23#define NRF_CLOUD_JSON_APPID_VAL_PGPS "PGPS"
24#define NRF_CLOUD_JSON_APPID_VAL_GNSS "GNSS"
25#define NRF_CLOUD_JSON_APPID_VAL_LOCATION "GROUND_FIX"
26#define NRF_CLOUD_JSON_APPID_VAL_DEVICE "DEVICE"
27#define NRF_CLOUD_JSON_APPID_VAL_FLIP "FLIP"
28#define NRF_CLOUD_JSON_APPID_VAL_BTN "BUTTON"
29#define NRF_CLOUD_JSON_APPID_VAL_TEMP "TEMP"
30#define NRF_CLOUD_JSON_APPID_VAL_HUMID "HUMID"
31#define NRF_CLOUD_JSON_APPID_VAL_AIR_PRESS "AIR_PRESS"
32#define NRF_CLOUD_JSON_APPID_VAL_AIR_QUAL "AIR_QUAL"
33#define NRF_CLOUD_JSON_APPID_VAL_RSRP "RSRP"
34#define NRF_CLOUD_JSON_APPID_VAL_LIGHT "LIGHT"
35#define NRF_CLOUD_JSON_APPID_VAL_MODEM "MODEM"
36#define NRF_CLOUD_JSON_APPID_VAL_ALERT "ALERT"
37#define NRF_CLOUD_JSON_APPID_VAL_LOG "LOG"
38#define NRF_CLOUD_JSON_APPID_VAL_DICTIONARY_LOG "DICTLOG"
39
40/* Message type */
41#define NRF_CLOUD_JSON_MSG_TYPE_KEY "messageType"
42#define NRF_CLOUD_JSON_MSG_TYPE_VAL_CMD "CMD"
43#define NRF_CLOUD_JSON_MSG_TYPE_VAL_DATA "DATA"
44#define NRF_CLOUD_JSON_MSG_TYPE_VAL_DISCONNECT "DISCON"
45
46/* Misc message keys */
47#define NRF_CLOUD_JSON_DATA_KEY "data"
48#define NRF_CLOUD_JSON_ERR_KEY "err"
49#define NRF_CLOUD_JSON_FULFILL_KEY "fulfilledWith"
50#define NRF_CLOUD_JSON_FILTERED_KEY "filtered"
51#define NRF_CLOUD_MSG_TIMESTAMP_KEY "ts"
52
53/* Modem info key text */
54#define NRF_CLOUD_JSON_MCC_KEY "mcc"
55#define NRF_CLOUD_JSON_MNC_KEY "mnc"
56#define NRF_CLOUD_JSON_AREA_CODE_KEY "tac"
57#define NRF_CLOUD_JSON_CELL_ID_KEY "eci"
58#define NRF_CLOUD_JSON_PHYCID_KEY "phycid"
59#define NRF_CLOUD_JSON_RSRP_KEY "rsrp"
60
61/* Cellular positioning */
62#define NRF_CLOUD_CELL_POS_JSON_KEY_LTE "lte"
63#define NRF_CLOUD_CELL_POS_JSON_KEY_ECI NRF_CLOUD_JSON_CELL_ID_KEY
64#define NRF_CLOUD_CELL_POS_JSON_KEY_MCC NRF_CLOUD_JSON_MCC_KEY
65#define NRF_CLOUD_CELL_POS_JSON_KEY_MNC NRF_CLOUD_JSON_MNC_KEY
66#define NRF_CLOUD_CELL_POS_JSON_KEY_TAC NRF_CLOUD_JSON_AREA_CODE_KEY
67#define NRF_CLOUD_CELL_POS_JSON_KEY_AGE "age"
68#define NRF_CLOUD_CELL_POS_JSON_KEY_T_ADV "adv"
69#define NRF_CLOUD_CELL_POS_JSON_KEY_EARFCN "earfcn"
70#define NRF_CLOUD_CELL_POS_JSON_KEY_PCI "pci"
71#define NRF_CLOUD_CELL_POS_JSON_KEY_NBORS "nmr"
72#define NRF_CLOUD_CELL_POS_JSON_KEY_RSRP NRF_CLOUD_JSON_RSRP_KEY
73#define NRF_CLOUD_CELL_POS_JSON_KEY_RSRQ "rsrq"
74#define NRF_CLOUD_CELL_POS_JSON_KEY_TDIFF "timeDiff"
75
76/* Location */
77#define NRF_CLOUD_LOCATION_JSON_KEY_CONFIG "config"
78#define NRF_CLOUD_LOCATION_JSON_KEY_DOREPLY "doReply"
79#define NRF_CLOUD_LOCATION_JSON_KEY_HICONF "hiConf"
80#define NRF_CLOUD_LOCATION_JSON_KEY_FALLBACK "fallback"
81#define NRF_CLOUD_LOCATION_JSON_KEY_WIFI "wifi"
82#define NRF_CLOUD_LOCATION_JSON_KEY_APS "accessPoints"
83#define NRF_CLOUD_LOCATION_JSON_KEY_ANCHORS "anchors"
84#define NRF_CLOUD_LOCATION_JSON_KEY_ANC_NAME "name"
85#define NRF_CLOUD_LOCATION_JSON_KEY_ANC_MAC "macAddress"
86#define NRF_CLOUD_LOCATION_JSON_KEY_WIFI_MAC "macAddress"
87#define NRF_CLOUD_LOCATION_JSON_KEY_WIFI_CH "channel"
88#define NRF_CLOUD_LOCATION_JSON_KEY_WIFI_RSSI "signalStrength"
89#define NRF_CLOUD_LOCATION_JSON_KEY_WIFI_SSID "ssid"
90#define NRF_CLOUD_LOCATION_JSON_KEY_LAT "lat"
91#define NRF_CLOUD_LOCATION_JSON_KEY_LON "lon"
92#define NRF_CLOUD_LOCATION_JSON_KEY_UNCERT "uncertainty"
93#define NRF_CLOUD_LOCATION_TYPE_VAL_MCELL "MCELL"
94#define NRF_CLOUD_LOCATION_TYPE_VAL_SCELL "SCELL"
95#define NRF_CLOUD_LOCATION_TYPE_VAL_WIFI "WIFI"
96#define NRF_CLOUD_LOCATION_TYPE_VAL_ANCHOR "ANCHOR"
97
99#define NRF_CLOUD_LOCATION_DOREPLY_DEFAULT true
100#define NRF_CLOUD_LOCATION_HICONF_DEFAULT false
101#define NRF_CLOUD_LOCATION_FALLBACK_DEFAULT true
102
103/* P-GPS */
104#define NRF_CLOUD_JSON_PGPS_PRED_COUNT "predictionCount"
105#define NRF_CLOUD_JSON_PGPS_INT_MIN "predictionIntervalMinutes"
106#define NRF_CLOUD_JSON_PGPS_GPS_DAY "startGpsDay"
107#define NRF_CLOUD_JSON_PGPS_GPS_TIME "startGpsTimeOfDaySeconds"
108#define NRF_CLOUD_PGPS_RCV_ARRAY_IDX_HOST 0
109#define NRF_CLOUD_PGPS_RCV_ARRAY_IDX_PATH 1
110#define NRF_CLOUD_PGPS_RCV_REST_HOST "host"
111#define NRF_CLOUD_PGPS_RCV_REST_PATH "path"
112
113/* A-GNSS */
114#define NRF_CLOUD_JSON_KEY_ELEVATION_MASK "mask"
115#define NRF_CLOUD_JSON_KEY_AGNSS_TYPES "types"
116
117/* FOTA */
118#define NRF_CLOUD_FOTA_TYPE_MODEM_DELTA "MODEM"
119#define NRF_CLOUD_FOTA_TYPE_MODEM_FULL "MDM_FULL"
120#define NRF_CLOUD_FOTA_TYPE_BOOT "BOOT"
121#define NRF_CLOUD_FOTA_TYPE_APP "APP"
122#define NRF_CLOUD_FOTA_TYPE_SMP "SMP"
123#define NRF_CLOUD_FOTA_TYPE_CUSTOM "CUSTOM"
124#define NRF_CLOUD_FOTA_REST_KEY_JOB_DOC "jobDocument"
125#define NRF_CLOUD_FOTA_REST_KEY_JOB_ID "jobId"
126#define NRF_CLOUD_FOTA_REST_KEY_PATH "path"
127#define NRF_CLOUD_FOTA_REST_KEY_HOST "host"
128#define NRF_CLOUD_FOTA_REST_KEY_TYPE "firmwareType"
129#define NRF_CLOUD_FOTA_REST_KEY_SIZE "fileSize"
130#define NRF_CLOUD_FOTA_REST_KEY_VER "version"
132#define NRF_CLOUD_FOTA_VER 2
133
134/* REST */
135#define NRF_CLOUD_REST_ERROR_CODE_KEY "code"
136#define NRF_CLOUD_REST_ERROR_MSG_KEY "message"
137#define NRF_CLOUD_REST_TOPIC_KEY "topic"
138#define NRF_CLOUD_REST_MSG_KEY "message"
139
140/* GNSS - PVT */
141#define NRF_CLOUD_JSON_GNSS_PVT_KEY_LAT "lat"
142#define NRF_CLOUD_JSON_GNSS_PVT_KEY_LON "lon"
143#define NRF_CLOUD_JSON_GNSS_PVT_KEY_ACCURACY "acc"
144#define NRF_CLOUD_JSON_GNSS_PVT_KEY_ALTITUDE "alt"
145#define NRF_CLOUD_JSON_GNSS_PVT_KEY_SPEED "spd"
146#define NRF_CLOUD_JSON_GNSS_PVT_KEY_HEADING "hdg"
147
148/* Device Info */
149#define NRF_CLOUD_DEVICE_JSON_KEY_NET_INF "networkInfo"
150#define NRF_CLOUD_DEVICE_JSON_KEY_SIM_INF "simInfo"
151#define NRF_CLOUD_DEVICE_JSON_KEY_DEV_INF "deviceInfo"
152
153/* Alerts */
154#define NRF_CLOUD_JSON_ALERT_SEQUENCE "seq"
155#define NRF_CLOUD_JSON_ALERT_DESCRIPTION "desc"
156#define NRF_CLOUD_JSON_ALERT_TYPE "type"
157#define NRF_CLOUD_JSON_ALERT_VALUE "value"
158
159/* Logs */
160#define NRF_CLOUD_JSON_LOG_KEY_SEQUENCE "seq"
161#define NRF_CLOUD_JSON_LOG_KEY_DOMAIN "dom"
162#define NRF_CLOUD_JSON_LOG_KEY_SOURCE "src"
163#define NRF_CLOUD_JSON_LOG_KEY_LEVEL "lvl"
164#define NRF_CLOUD_JSON_LOG_KEY_MESSAGE "msg"
165
166/* Settings Module */
168#define NRF_CLOUD_SETTINGS_NAME "nrf_cloud"
169#define NRF_CLOUD_SETTINGS_FOTA_KEY "fota"
170#define NRF_CLOUD_SETTINGS_FOTA_JOB "job"
172#define NRF_CLOUD_SETTINGS_FULL_FOTA NRF_CLOUD_SETTINGS_NAME \
173 "/" \
174 NRF_CLOUD_SETTINGS_FOTA_KEY
176#define NRF_CLOUD_SETTINGS_FULL_FOTA_JOB NRF_CLOUD_SETTINGS_FULL_FOTA \
177 "/" \
178 NRF_CLOUD_SETTINGS_FOTA_JOB
179
180/* Shadow */
181#define NRF_CLOUD_JSON_KEY_STATE "state"
182#define NRF_CLOUD_JSON_KEY_REP "reported"
183#define NRF_CLOUD_JSON_KEY_DES "desired"
184#define NRF_CLOUD_JSON_KEY_DELTA "delta"
185#define NRF_CLOUD_JSON_KEY_DEVICE "device"
186#define NRF_CLOUD_JSON_KEY_SRVC_INFO "serviceInfo"
187#define NRF_CLOUD_JSON_KEY_SRVC_INFO_UI "ui"
188#define NRF_CLOUD_JSON_KEY_SRVC_INFO_FOTA NRF_CLOUD_FOTA_VER_STR
189#define NRF_CLOUD_JSON_KEY_CFG "config"
190#define NRF_CLOUD_JSON_KEY_CTRL "control"
191#define NRF_CLOUD_JSON_KEY_ALERT "alertsEn"
192#define NRF_CLOUD_JSON_KEY_LOG "logLvl"
193#define NRF_CLOUD_JSON_KEY_TOPICS "topics"
194#define NRF_CLOUD_JSON_KEY_STAGE "stage"
195#define NRF_CLOUD_JSON_KEY_PAIRING "pairing"
196#define NRF_CLOUD_JSON_KEY_PAIR_STAT "pairingStatus"
197#define NRF_CLOUD_JSON_KEY_TOPIC_PRFX "nrfcloud_mqtt_topic_prefix"
198#define NRF_CLOUD_JSON_KEY_KEEPALIVE "keepalive"
199#define NRF_CLOUD_JSON_KEY_CONN "connection"
200#define NRF_CLOUD_JSON_KEY_APP_VER "appVersion"
201#define NRF_CLOUD_JSON_KEY_SMP_APP_VER "smpDevAppVer"
202#define NRF_CLOUD_JSON_KEY_CONN_INFO "connectionInfo"
203#define NRF_CLOUD_JSON_KEY_PROTOCOL "protocol"
204#define NRF_CLOUD_JSON_KEY_METHOD "method"
205#define NRF_CLOUD_JSON_VAL_NOT_ASSOC "not_associated"
206#define NRF_CLOUD_JSON_VAL_PAIRED "paired"
207#define NRF_CLOUD_JSON_KEY_SHADOW_VERSION "version"
208#define NRF_CLOUD_JSON_KEY_SHADOW_TIMESTAMP "timestamp"
209/* Current FOTA version string used in device shadow */
210#define NRF_CLOUD_FOTA_VER_STR "fota_v" STRINGIFY(NRF_CLOUD_FOTA_VER)
211/* Max length of nRF Cloud's stage/environment name */
212#define NRF_CLOUD_STAGE_ID_MAX_LEN 8
214#define NRF_CLOUD_TENANT_ID_MAX_LEN 64
216#define NRF_CLOUD_CLIENT_ID_MAX_LEN 64
217
218/* Topics */
219#ifndef CONFIG_NRF_CLOUD_GATEWAY
220#define NRF_CLOUD_JSON_KEY_DEVICE_TO_CLOUD "d2c"
221#define NRF_CLOUD_JSON_KEY_CLOUD_TO_DEVICE "c2d"
222#else
223#define NRF_CLOUD_JSON_KEY_DEVICE_TO_CLOUD "g2c"
224#define NRF_CLOUD_JSON_KEY_CLOUD_TO_DEVICE "c2g"
225#endif
226#define NRF_CLOUD_BULK_MSG_TOPIC "/bulk"
227#define NRF_CLOUD_JSON_VAL_TOPIC_C2D "/" NRF_CLOUD_JSON_KEY_CLOUD_TO_DEVICE
228#define NRF_CLOUD_JSON_VAL_TOPIC_AGNSS "/agnss"
229#define NRF_CLOUD_JSON_VAL_TOPIC_PGPS "/pgps"
230#define NRF_CLOUD_JSON_VAL_TOPIC_GND_FIX "/ground_fix"
231#define NRF_CLOUD_JSON_VAL_TOPIC_RCV "/r"
232#define NRF_CLOUD_JSON_VAL_TOPIC_WILDCARD "/+"
233#define NRF_CLOUD_JSON_VAL_TOPIC_BIN "/bin"
234#define NRF_CLOUD_JSON_VAL_PROTO_MQTT "MQTT"
235#define NRF_CLOUD_JSON_VAL_PROTO_COAP "CoAP"
236#define NRF_CLOUD_JSON_VAL_PROTO_REST "REST"
237#define NRF_CLOUD_JSON_VAL_METHOD_LTE "LTE"
238#define NRF_CLOUD_JSON_VAL_METHOD_WIFI "Wi-Fi"
239
241#define NRF_CLOUD_TRANSFORM_MAX_RESPONSE_LEN 1792
242#define NRF_CLOUD_TRANSFORM_REQ_LEN_KEY "l"
243#define NRF_CLOUD_TRANSFORM_REQ_TF_KEY "t"
244#define NRF_CLOUD_TRANSFORM_RSP_TF_KEY "tf"
245#define NRF_CLOUD_TRANSFORM_RSP_ERR_KEY "err"
246#define NRF_CLOUD_TRANSFORM_RSP_POS_KEY "position"
247#define NRF_CLOUD_TRANSFORM_RSP_MSG_KEY "message"
248
250#endif /* NRF_CLOUD_DEFS_H__ */