Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "app_common.h"
#include "button.h"
#include "network.h"
#include "cloud_module.h"
#include "cloud.h"
#include "fota.h"
#include "location.h"
#include "cbor_helper.h"
Expand Down
4 changes: 2 additions & 2 deletions app/src/modules/cloud/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cloud_module.c)
target_sources_ifdef(CONFIG_APP_CLOUD_SHELL app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cloud_module_shell.c)
target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cloud.c)
target_sources_ifdef(CONFIG_APP_CLOUD_SHELL app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cloud_shell.c)
target_include_directories(app PRIVATE .)

if (CONFIG_NRF_CLOUD_COAP_SEC_TAG GREATER_EQUAL 2147483648 AND CONFIG_NRF_CLOUD_COAP_SEC_TAG LESS_EQUAL 2147483667)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <memfault/panics/coredump.h>
#endif /* CONFIG_MEMFAULT */

#include "cloud_module.h"
#include "cloud.h"
#include "app_common.h"
#include "network.h"

Expand Down Expand Up @@ -735,7 +735,7 @@ static void state_connected_paused_run(void *o)

/* End of state handlers */

static void cloud_module_thread(void)
static void cloud_thread(void)
{
int err;
int task_wdt_id;
Expand Down Expand Up @@ -787,6 +787,6 @@ static void cloud_module_thread(void)
}
}

K_THREAD_DEFINE(cloud_module_thread_id,
K_THREAD_DEFINE(cloud_thread_id,
CONFIG_APP_CLOUD_THREAD_STACK_SIZE,
cloud_module_thread, NULL, NULL, NULL, K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0);
cloud_thread, NULL, NULL, NULL, K_LOWEST_APPLICATION_THREAD_PRIO, 0, 0);
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#ifndef _CLOUD_MODULE_H_
#define _CLOUD_MODULE_H_
#ifndef _CLOUD_H_
#define _CLOUD_H_

#include <zephyr/kernel.h>
#include <zephyr/zbus/zbus.h>
Expand Down Expand Up @@ -55,4 +55,4 @@ struct cloud_msg {
}
#endif

#endif /* _CLOUD_MODULE_H_ */
#endif /* _CLOUD_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <net/nrf_cloud_defs.h>
#include <date_time.h>

#include "cloud_module.h"
#include "cloud.h"

LOG_MODULE_DECLARE(cloud, CONFIG_APP_CLOUD_LOG_LEVEL);

Expand Down
2 changes: 1 addition & 1 deletion docs/common/tooling_troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ The listed configurations configure the thread analyzer to print thread informat
[00:00:30.726,593] <inf> thread_analyzer: : Total CPU cycles used: 37
[00:00:30.726,715] <inf> thread_analyzer: coap_client_recv_thread: STACK: unused 592 usage 688 / 1280 (53 %); CPU: 0 %
[00:00:30.726,745] <inf> thread_analyzer: : Total CPU cycles used: 273
[00:00:30.726,867] <inf> thread_analyzer: cloud_module_thread_id: STACK: unused 328 usage 3000 / 3328 (90 %); CPU: 0 %
[00:00:30.726,867] <inf> thread_analyzer: cloud_thread_id: STACK: unused 328 usage 3000 / 3328 (90 %); CPU: 0 %
[00:00:30.726,898] <inf> thread_analyzer: : Total CPU cycles used: 1081
[00:00:30.726,959] <inf> thread_analyzer: date_time_work_q : STACK: unused 80 usage 368 / 448 (82 %); CPU: 0 %
[00:00:30.726,989] <inf> thread_analyzer: : Total CPU cycles used: 11
Expand Down
8 changes: 4 additions & 4 deletions docs/modules/cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ The module's responsibilities include:

nRF Cloud over CoAP utilizes DTLS connection ID which allows the device to quickly re-establish a secure connection with the cloud after a network disconnection without the need for a full DTLS handshake. The module uses the nRF Cloud CoAP library to handle the CoAP communication and DTLS connection management.

Below, the module’s main messages, configurations, and state machine are covered. Refer to the source files (`cloud_module.c`, `cloud_module.h`, and `Kconfig.cloud`) for implementation details.
Below, the module’s main messages, configurations, and state machine are covered. Refer to the source files (`cloud.c`, `cloud.h`, and `Kconfig.cloud`) for implementation details.

## Messages

The cloud module publishes and receives messages over the zbus channel `CLOUD_CHAN`. All module message types are defined in `cloud_module.h` and used within `cloud_module.c`.
The cloud module publishes and receives messages over the zbus channel `CLOUD_CHAN`. All module message types are defined in `cloud.h` and used within `cloud.c`.

### Input Messages

Expand All @@ -37,7 +37,7 @@ The cloud module publishes and receives messages over the zbus channel `CLOUD_CH
- **CLOUD_SHADOW_RESPONSE**
Returns shadow data or a shadow delta received from nRF Cloud.

The message structure used by the cloud module is defined in `cloud_module.h`:
The message structure used by the cloud module is defined in `cloud.h`:

```c
struct cloud_msg {
Expand Down Expand Up @@ -101,7 +101,7 @@ For more details on these and other configurations, refer to `Kconfig.cloud`.

## State diagram

Below is a simplified representation of the state machine implemented in `cloud_module.c`. The module starts in the **STATE_RUNNING** context, which immediately transitions to **STATE_DISCONNECTED** upon initialization. From there, network events and internal conditions drive state transitions.
Below is a simplified representation of the state machine implemented in `cloud.c`. The module starts in the **STATE_RUNNING** context, which immediately transitions to **STATE_DISCONNECTED** upon initialization. From there, network events and internal conditions drive state transitions.

```mermaid
stateDiagram-v2
Expand Down
6 changes: 3 additions & 3 deletions docs/patches/magnetometer.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ index e68d98b..1901eca 100644
/ {
chosen {
zephyr,wifi = &nordic_wlan0;
diff --git a/app/src/modules/cloud/cloud_module.c b/app/src/modules/cloud/cloud_module.c
diff --git a/app/src/modules/cloud/cloud.c b/app/src/modules/cloud/cloud.c
index 9696914..a701140 100644
--- a/app/src/modules/cloud/cloud_module.c
+++ b/app/src/modules/cloud/cloud_module.c
--- a/app/src/modules/cloud/cloud.c
+++ b/app/src/modules/cloud/cloud.c
@@ -38,6 +38,7 @@ LOG_MODULE_REGISTER(cloud, CONFIG_APP_CLOUD_LOG_LEVEL);

#define CUSTOM_JSON_APPID_VAL_CONEVAL "CONEVAL"
Expand Down
2 changes: 1 addition & 1 deletion tests/module/cloud/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test_runner_generate(src/cloud_module_test.c)
target_sources(app
PRIVATE
src/cloud_module_test.c
../../../app/src/modules/cloud/cloud_module.c
../../../app/src/modules/cloud/cloud.c
)

zephyr_include_directories(${ZEPHYR_BASE}/include/zephyr/)
Expand Down
2 changes: 1 addition & 1 deletion tests/module/cloud/src/cloud_module_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <zephyr/zbus/zbus.h>

#include "environmental.h"
#include "cloud_module.h"
#include "cloud.h"
#include "power.h"
#include "network.h"
#include "app_common.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/module/main/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "power.h"
#include "network.h"
#include "environmental.h"
#include "cloud_module.h"
#include "cloud.h"
#include "fota.h"
#include "location.h"
#include "led.h"
Expand Down
Loading