Skip to content

Commit 138ba28

Browse files
committed
app: Remove support for nRF Cloud MQTT
Use CoAP instead. Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
1 parent 033c2d7 commit 138ba28

File tree

6 files changed

+23
-348
lines changed

6 files changed

+23
-348
lines changed

app/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ config SM_NRF_CLOUD
253253
config SM_NRF_CLOUD_LOCATION
254254
bool "nRF Cloud Location support"
255255
depends on SM_NRF_CLOUD
256-
select NRF_CLOUD_LOCATION if NRF_CLOUD_MQTT
257256

258257
config SM_MQTTC
259258
bool "MQTT client support"

app/overlay-nrf_cloud-coap.conf

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/prj.conf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ CONFIG_NVS=y
9292
# nRF Cloud
9393
CONFIG_SM_NRF_CLOUD_LOCATION=y
9494
CONFIG_NRF_CLOUD=y
95-
CONFIG_NRF_CLOUD_MQTT=y
9695
CONFIG_NRF_CLOUD_FOTA=n
9796
CONFIG_NRF_CLOUD_AGNSS=y
9897
CONFIG_NRF_CLOUD_AGNSS_FILTERED=n
@@ -101,10 +100,18 @@ CONFIG_NRF_CLOUD_LOG_LEVEL_INF=y
101100
CONFIG_NRF_CLOUD_GPS_LOG_LEVEL_INF=y
102101
CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=y
103102
CONFIG_NRF_CLOUD_WIFI_LOCATION_ENCODE_OPT_MAC_RSSI=y
103+
CONFIG_NRF_CLOUD_COAP=y
104+
CONFIG_NRF_CLOUD_COAP_DOWNLOADS=n
104105
CONFIG_DATE_TIME=y
105106
CONFIG_MODEM_INFO=y
106107
CONFIG_MODEM_INFO_ADD_DATE_TIME=n
107108

109+
# CoAP client settings
110+
CONFIG_COAP_CLIENT_BLOCK_SIZE=1024
111+
CONFIG_COAP_CLIENT_THREAD_PRIORITY=0
112+
CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=96
113+
CONFIG_COAP_CLIENT_STACK_SIZE=2048
114+
108115
# UUID and JWT
109116
CONFIG_MODEM_JWT=y
110117

app/src/sm_at_gnss.c

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,9 @@ static struct k_work agnss_req_work;
6161
#endif
6262
#if defined(CONFIG_NRF_CLOUD_PGPS)
6363
static struct k_work pgps_req_work;
64-
#if defined(CONFIG_NRF_CLOUD_COAP)
6564
static struct k_work pgps_coap_req_work;
6665
static struct gps_pgps_request pgps_coap_request;
6766
#endif
68-
#endif
6967

7068
#endif /* CONFIG_SM_NRF_CLOUD */
7169

@@ -320,31 +318,17 @@ static void agnss_requestor(struct k_work *)
320318
{
321319
int err;
322320
struct nrf_modem_gnss_agnss_data_frame req;
321+
static char agnss_rest_data_buf[NRF_CLOUD_AGNSS_MAX_DATA_SIZE];
322+
struct nrf_cloud_rest_agnss_request request = {
323+
NRF_CLOUD_REST_AGNSS_REQ_CUSTOM,
324+
&req,
325+
};
323326

324327
err = read_agnss_req(&req);
325328
if (err) {
326329
LOG_ERR("Failed to read A-GNSS request (%d).", err);
327330
return;
328331
}
329-
#if defined(CONFIG_NRF_CLOUD_MQTT)
330-
err = nrf_cloud_agnss_request(&req);
331-
if (err) {
332-
LOG_ERR("Failed to request A-GNSS data (%d).", err);
333-
} else {
334-
LOG_INF("A-GNSS data requested.");
335-
/* When A-GNSS data is received it gets injected in the background by
336-
* nrf_cloud_agnss_process() without notification. In the case where
337-
* CONFIG_NRF_CLOUD_PGPS=y, nrf_cloud_pgps_inject() (called on PGPS_EVT_AVAILABLE)
338-
* plays a role as A-GNSS expects P-GPS to process some of the data.
339-
*/
340-
}
341-
#endif
342-
#if defined(CONFIG_NRF_CLOUD_COAP)
343-
static char agnss_rest_data_buf[NRF_CLOUD_AGNSS_MAX_DATA_SIZE];
344-
struct nrf_cloud_rest_agnss_request request = {
345-
NRF_CLOUD_REST_AGNSS_REQ_CUSTOM,
346-
&req,
347-
};
348332

349333
struct nrf_cloud_rest_agnss_result result = {agnss_rest_data_buf,
350334
sizeof(agnss_rest_data_buf), 0};
@@ -369,7 +353,6 @@ static void agnss_requestor(struct k_work *)
369353
return;
370354
}
371355
LOG_INF("A-GNSS data received via CoAP.");
372-
#endif
373356
}
374357
#endif /* CONFIG_NRF_CLOUD_AGNSS */
375358

@@ -387,7 +370,6 @@ static void pgps_requestor(struct k_work *)
387370
}
388371
}
389372

390-
#if defined(CONFIG_NRF_CLOUD_COAP)
391373
static void pgps_coap_requestor(struct k_work *)
392374
{
393375
int err;
@@ -428,7 +410,6 @@ static void pgps_coap_requestor(struct k_work *)
428410

429411
LOG_INF("P-GPS predictions requested");
430412
}
431-
#endif
432413

433414
static void pgps_event_handler(struct nrf_cloud_pgps_event *event)
434415
{
@@ -481,10 +462,8 @@ static void pgps_event_handler(struct nrf_cloud_pgps_event *event)
481462
break;
482463
case PGPS_EVT_REQUEST:
483464
LOG_INF("PGPS_EVT_REQUEST");
484-
#if defined(CONFIG_NRF_CLOUD_COAP)
485465
memcpy(&pgps_coap_request, event->request, sizeof(pgps_coap_request));
486466
k_work_submit_to_queue(&sm_work_q, &pgps_coap_req_work);
487-
#endif
488467
break;
489468
}
490469
}
@@ -540,24 +519,11 @@ static int do_cloud_send_obj(struct nrf_cloud_obj *const obj)
540519
{
541520
int err;
542521

543-
#if defined(CONFIG_NRF_CLOUD_MQTT)
544-
struct nrf_cloud_tx_data msg = {
545-
.obj = obj,
546-
.topic_type = NRF_CLOUD_TOPIC_MESSAGE,
547-
.qos = MQTT_QOS_0_AT_MOST_ONCE
548-
};
549-
550-
err = nrf_cloud_send(&msg);
551-
if (err) {
552-
LOG_ERR("nrf_cloud_send failed, error: %d", err);
553-
}
554-
#endif
555-
#if defined(CONFIG_NRF_CLOUD_COAP)
556522
err = nrf_cloud_coap_obj_send(obj, false);
557523
if (err) {
558524
LOG_ERR("nrf_cloud_send failed, error: %d", err);
559525
}
560-
#endif
526+
561527
(void)nrf_cloud_obj_free(obj);
562528

563529
return err;
@@ -903,9 +869,7 @@ static int sm_at_gnss_init(void)
903869
#endif
904870
#if defined(CONFIG_NRF_CLOUD_PGPS)
905871
k_work_init(&pgps_req_work, pgps_requestor);
906-
#if defined(CONFIG_NRF_CLOUD_COAP)
907872
k_work_init(&pgps_coap_req_work, pgps_coap_requestor);
908-
#endif
909873
#endif /* CONFIG_NRF_CLOUD_PGPS */
910874
#endif /* CONFIG_SM_NRF_CLOUD */
911875
k_work_init(&gnss_fix_send_work, gnss_fix_sender);

0 commit comments

Comments
 (0)