File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
samples/nrf9160/serial_lte_modem Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ config SLM_AT_MODE
1212 bool "Serial LTE Modem by raw AT mode"
1313 default y
1414 select AT_CMD
15+ select AT_NOTIF
1516 select AT_CMD_PARSER
1617
1718config SLM_AT_MAX_PARAM
Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
55 */
66#include <logging/log.h>
7- LOG_MODULE_REGISTER (app , CONFIG_SLM_LOG_LEVEL );
87
98#include <zephyr.h>
109#include <stdio.h>
1110#include <uart.h>
1211#include <string.h>
1312#include <bsd.h>
1413#include <lte_lc.h>
15-
1614#include <hal/nrf_gpio.h>
1715#include <hal/nrf_power.h>
1816#include <hal/nrf_regulators.h>
19-
2017#include "slm_at_host.h"
2118
2219#if defined(CONFIG_SLM_CONNECT_UART_0 ) && defined(CONFIG_SLM_GPIO_WAKEUP )
2320#error CONFIG_SLM_GPIO_WAKEUP should not be defined when UART0 is used
2421#endif
2522
23+ LOG_MODULE_REGISTER (app , CONFIG_SLM_LOG_LEVEL );
24+
2625/* global variable used across different files */
2726struct at_param_list m_param_list ;
2827
Original file line number Diff line number Diff line change 1212#include <string.h>
1313#include <init.h>
1414#include <at_cmd.h>
15+ #include <at_notif.h>
1516
1617LOG_MODULE_REGISTER (at_host , CONFIG_SLM_LOG_LEVEL );
1718
@@ -71,9 +72,12 @@ static inline void write_uart_string(char *str, size_t len)
7172 }
7273}
7374
74- static void response_handler (char * response )
75+ static void response_handler (void * context , char * response )
7576{
7677 int len = strlen (response ) + 1 ;
78+
79+ ARG_UNUSED (context );
80+
7781 /* Forward the data over UART */
7882 if (len > 1 ) {
7983 write_uart_string (response , len );
@@ -307,7 +311,11 @@ int slm_at_host_init(void)
307311 return - EINVAL ;
308312 }
309313
310- at_cmd_set_notification_handler (response_handler );
314+ err = at_notif_register_handler (NULL , response_handler );
315+ if (err != 0 ) {
316+ LOG_ERR ("Can't register handler err=%d" , err );
317+ return err ;
318+ }
311319
312320 /* Initialize the UART module */
313321 err = at_uart_init (uart_dev_name );
You can’t perform that action at this time.
0 commit comments