Skip to content

Commit 19ce41b

Browse files
juhaylinencarlescufi
authored andcommitted
tests: net: nrf_provisioning: remove header file
Remove file coap_client.h located in nrf_provisioning tests folder and use the same header file from Zephyr. Update header file nrf_modem_at.h Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
1 parent 363398a commit 19ce41b

3 files changed

Lines changed: 82 additions & 197 deletions

File tree

tests/subsys/net/lib/nrf_provisioning/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ elseif(CONFIG_NRF_PROVISIONING_COAP)
4545
-DCONFIG_MODEM_INFO_BUFFER_SIZE=128
4646
-DCONFIG_COAP_CLIENT_MAX_REQUESTS=2
4747
)
48-
cmock_handle(include/coap_client.h)
48+
cmock_handle(${ZEPHYR_BASE}/include/zephyr/net/coap_client.h)
4949
cmock_handle(${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/nrf_provisioning/include/nrf_provisioning_jwt.h)
5050

5151
elseif(CONFIG_NRF_PROVISIONING_HTTP)

tests/subsys/net/lib/nrf_provisioning/include/coap_client.h

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

tests/subsys/net/lib/nrf_provisioning/include/nrf_modem_at.h

Lines changed: 81 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -38,47 +38,6 @@ extern "C" {
3838
*/
3939
typedef void (*nrf_modem_at_notif_handler_t)(const char *notif);
4040

41-
/**
42-
* @brief AT response handler prototype.
43-
*
44-
* @note This handler is executed in an interrupt service routine.
45-
* Offload any intensive operations as necessary.
46-
*
47-
* @param resp The AT command response.
48-
*/
49-
typedef void (*nrf_modem_at_resp_handler_t)(const char *resp);
50-
51-
/** @brief AT filter callback function format
52-
*
53-
* @note This declaration is used for the callback functions
54-
* of AT commands in the nRF SDK.
55-
*
56-
* @param buf Buffer to receive the response into.
57-
* @param len Buffer length.
58-
* @param at_cmd AT command.
59-
*
60-
* @retval 0 On "OK" responses.
61-
* @returns A positive value On "ERROR", "+CME ERROR", and "+CMS ERROR" responses.
62-
* The type of error can be distinguished using @c nrf_modem_at_err_type.
63-
* The error value can be retrieved using @c nrf_modem_at_err.
64-
* @retval -NRF_EPERM The Modem library is not initialized.
65-
* @retval -NRF_EFAULT @c buf or @c fmt are @c NULL.
66-
* @retval -NRF_ENOMEM Not enough shared memory for this request.
67-
* @retval -NRF_E2BIG The response is larger than the supplied buffer @c buf.
68-
*/
69-
typedef int (*nrf_modem_at_cmd_handler_t)(char *buf, size_t len, char *at_cmd);
70-
71-
/* Struct for AT filter
72-
* Contains string for which the AT commands are compared
73-
* and a function pointer for the function to call on detection.
74-
*/
75-
struct nrf_modem_at_cmd_filter {
76-
const char * const cmd;
77-
const nrf_modem_at_cmd_handler_t callback;
78-
/** Whether filter is paused. */
79-
bool paused;
80-
};
81-
8241
/**
8342
* @brief Set a handler function for AT notifications.
8443
*
@@ -107,6 +66,7 @@ int nrf_modem_at_notif_handler_set(nrf_modem_at_notif_handler_t callback);
10766
* @retval -NRF_EPERM The Modem library is not initialized.
10867
* @retval -NRF_EFAULT @c fmt is @c NULL.
10968
* @retval -NRF_EINVAL Bad format @c fmt.
69+
* @retval -NRF_EAGAIN Timed out while waiting for another AT command to complete.
11070
* @retval -NRF_ENOMEM Not enough shared memory for this request.
11171
* @retval -NRF_ESHUTDOWN If modem was shut down.
11272
*/
@@ -128,6 +88,7 @@ int nrf_modem_at_printf(const char *fmt, ...);
12888
* @retval -NRF_EPERM The Modem library is not initialized.
12989
* @retval -NRF_EFAULT @c cmd or @c fmt are @c NULL.
13090
* @retval -NRF_EBADMSG No arguments were matched.
91+
* @retval -NRF_EAGAIN Timed out while waiting for another AT command to complete.
13192
* @retval -NRF_ENOMEM Not enough shared memory for this request.
13293
* @retval -NRF_ESHUTDOWN If the modem was shut down.
13394
*/
@@ -149,12 +110,23 @@ int nrf_modem_at_scanf(const char *cmd, const char *fmt, ...);
149110
* @retval -NRF_EPERM The Modem library is not initialized.
150111
* @retval -NRF_EFAULT @c buf or @c fmt are @c NULL.
151112
* @retval -NRF_EINVAL Bad format @c fmt, or @c len is zero.
113+
* @retval -NRF_EAGAIN Timed out while waiting for another AT command to complete.
152114
* @retval -NRF_ENOMEM Not enough shared memory for this request.
153115
* @retval -NRF_E2BIG The response is larger than the supplied buffer @c buf.
154116
* @retval -NRF_ESHUTDOWN If the modem was shut down.
155117
*/
156118
int nrf_modem_at_cmd(void *buf, size_t len, const char *fmt, ...);
157119

120+
/**
121+
* @brief AT response handler prototype.
122+
*
123+
* @note This handler is executed in an interrupt service routine.
124+
* Offload any intensive operations as necessary.
125+
*
126+
* @param resp The AT command response.
127+
*/
128+
typedef void (*nrf_modem_at_resp_handler_t)(const char *resp);
129+
158130
/**
159131
* @brief Send a formatted AT command to the modem
160132
* and receive the response asynchronously via a callback.
@@ -173,12 +145,79 @@ int nrf_modem_at_cmd(void *buf, size_t len, const char *fmt, ...);
173145
* @retval -NRF_EPERM The Modem library is not initialized.
174146
* @retval -NRF_EFAULT @c callback or @c fmt are @c NULL.
175147
* @retval -NRF_EINVAL Bad format @c fmt.
176-
* @retval -NRF_EINPROGRESS An asynchrounous request is already in progress.
148+
* @retval -NRF_EINPROGRESS Another AT command is executing.
177149
* @retval -NRF_ENOMEM Not enough shared memory for this request.
178150
* @retval -NRF_ESHUTDOWN If the modem was shut down.
179151
*/
180152
int nrf_modem_at_cmd_async(nrf_modem_at_resp_handler_t callback, const char *fmt, ...);
181153

154+
/** @brief AT command handler prototype.
155+
*
156+
* Implements a custom AT command in the application.
157+
*
158+
* @param buf Buffer to receive the response into.
159+
* @param len Buffer length.
160+
* @param at_cmd AT command.
161+
*
162+
* @retval 0 On "OK" responses.
163+
* @returns A positive value On "ERROR", "+CME ERROR", and "+CMS ERROR" responses.
164+
* The type of error can be distinguished using @c nrf_modem_at_err_type.
165+
* The error value can be retrieved using @c nrf_modem_at_err.
166+
* @retval -NRF_EPERM The Modem library is not initialized.
167+
* @retval -NRF_EFAULT @c buf or @c fmt are @c NULL.
168+
* @retval -NRF_ENOMEM Not enough shared memory for this request.
169+
* @retval -NRF_E2BIG The response is larger than the supplied buffer @c buf.
170+
*/
171+
typedef int (*nrf_modem_at_cmd_custom_handler_t)(char *buf, size_t len, char *at_cmd);
172+
173+
/**
174+
* @brief Custom AT command.
175+
*
176+
* Application-defined AT command implementation.
177+
*/
178+
struct nrf_modem_at_cmd_custom {
179+
/** The AT command to implement. */
180+
const char * const cmd;
181+
/** The function implementing the AT command. */
182+
const nrf_modem_at_cmd_custom_handler_t callback;
183+
};
184+
185+
/**
186+
* @brief Set a list of custom AT commands that are implemented in the application.
187+
*
188+
* When a custom AT command list is set, AT commands sent via @c nrf_modem_at_cmd that match any
189+
* AT command in the list, will be redirected to the custom callback function instead
190+
* of being sent to the modem.
191+
*
192+
* @note The custom commands are disabled by passing NULL to the @c custom_commands and
193+
* 0 to the @c len.
194+
*
195+
* @param custom_commands List of custom AT commands.
196+
* @param len Custom AT command list size.
197+
*
198+
* @retval 0 On success.
199+
* @retval -NRF_EINVAL On invalid parameters.
200+
*/
201+
int nrf_modem_at_cmd_custom_set(struct nrf_modem_at_cmd_custom *custom_commands, size_t len);
202+
203+
/**
204+
* @brief Configure how long to wait for ongoing AT commands to complete when sending AT commands.
205+
*
206+
* AT commands are executed one at a time. While one AT command is being executed, the other
207+
* AT commands wait on a semaphore for the ongoing AT command to complete.
208+
*
209+
* This function configures how long @c nrf_modem_at_printf, @c nrf_modem_at_scanf and
210+
* @c nrf_modem_at_cmd shall wait for ongoing AT commands to complete.
211+
*
212+
* By default, the timeout is infinite.
213+
*
214+
* @param timeout_ms Timeout in milliseconds. Use NRF_MODEM_OS_FOREVER for infinite timeout
215+
* or NRF_MODEM_OS_NO_WAIT for no timeout.
216+
*
217+
* @return int Zero on success, a negative errno otherwise.
218+
*/
219+
int nrf_modem_at_sem_timeout_set(int timeout_ms);
220+
182221
/**
183222
* @brief Return the error type represented by the return value of
184223
* @c nrf_modem_at_printf and @c nrf_modem_at_cmd.
@@ -201,29 +240,9 @@ int nrf_modem_at_err_type(int error);
201240
*/
202241
int nrf_modem_at_err(int error);
203242

204-
/**
205-
* @brief Set a list of AT commands to be filtered by @c nrf_modem_at_cmd.
206-
*
207-
* When a filter list is set, AT commands sent via @c nrf_modem_at_cmd that match any
208-
* AT command in the filter will be redirected to the filter callback function instead
209-
* of being sent to the modem.
210-
*
211-
* @note The filter is disabled by passing NULL to the @c filters and
212-
* 0 to the @c len.
213-
*
214-
* @param filters AT filter list.
215-
* @param len AT filter list size.
216-
*
217-
* @retval 0 On a success.
218-
* @retval -NRF_EINVAL On invalid parameters.
219-
*/
220-
int nrf_modem_at_cmd_filter_set(struct nrf_modem_at_cmd_filter *filters,
221-
size_t len);
222-
223243
#ifdef __cplusplus
224244
}
225245
#endif
226246

227247
#endif /* NRF_MODEM_AT_H__ */
228-
229248
/** @} */

0 commit comments

Comments
 (0)