AppUart Module
The AppUartModule
and any associated software or projects are only provided as examples. They are not officially supported and there is no guarantee that they will be maintained in the future.
Purpose
The AppUartModule executes Terminal Commands received from nodes connected via MeshAccessConnection and transmits all terminal output. It is mainly intended for use in applications where wired terminal access via UART or SEGGER are not feasible. The firmware module is intended to be used together with smartphones.
Sample Smartphone App
The following smartphone applications can be used with the AppUartModule. Please refer to the linked documentation for details.
-
FruityMeshAppUart The smartphone app is an external project and is not supported or maintained by the maintainers of BlueRange Mesh.
Functionality
Receiving and Executing Terminal Commands
Since the maximum length of a packet (MAX_MESH_PACKET_SIZE
) that can be sent at one time is 200 (the number of payload bytes can be much smaller depending on the header), commands for some modules (such as the EnrollmentModule
) cannot be sent in a single packet. The AppUartModule deals with this problem by temporarily storing the received command parts if necessary, and then concatenating and executing the full command after confirming that all parts have been received.
Sending Terminal Output
If log sending is enabled, the terminal output will be sent to the connected device.
Note that if the log is output on the packet transmission itself, the log transmission will loop infinitely. (Output log A → send log A to the node → output log B accompanying the transmission of log A → send log B to the node → …) MeshAccessConnection logs (logs with the log tag MACONN) output logs for the packet transmission itself. Therefore, AppUartModule disables the MACONN log tag when sending logs is enabled. If the length of a single log exceeds the maximum packet length, the log is sent using the same mechanism as splitting terminal commands. In order to prevent commands that output a large amount of logs from overwhelming communication, the output logs are pushed to a queue once and then popped at regular intervals.
Usage
Add the AppUartModule
in the source file of the featuresets you are using, and activate APP_UART
in the corresponding header file.
// e.g. github_dev_nrf52.cpp
size += GS->InitializeModule<AppUartModule>(createModule, RECORD_STORAGE_RECORD_ID_VENDOR_MODULE_CONFIG_BASE + 0);
// e.g. github_dev_nrf52.h
#define ACTIVATE_APP_UART 1
Messages
Message Types
enum AppUartModuleTriggerActionMessages {
TERMINAL_COMMAND = 0,
SEND_LOG = 1,
};
enum AppUartModuleActionResponseMessages {
TERMINAL_RETURN_TYPE = 0,
RECEIVE_LOG = 1,
};
Send Terminal Commands
Request
actionType: TERMINAL_COMMAND
Bytes |
Type |
Description |
11 |
||
1 |
splitHeader |
Indicates the split status of the command to be sent using SPLIT_WRITE_CMD and SPLIT_WRITE_CMD_END of MessageType |
1 |
splitCount |
If command splitting is occurring, this indicates the number of messages to be sent. |
1 |
partLen |
Command length sent |
186 |
data |
terminal commands |
Send Log
Response
actionType: RECEIVE_LOG
Bytes |
Type |
Description |
11 |
||
1 |
splitHeader |
Indicates the split status of the log to be sent using SPLIT_WRITE_CMD and SPLIT_WRITE_CMD_END of MessageType |
1 |
splitCount |
If log splitting is occurring, this indicates the number of messages to be sent. |
1 |
partLen |
Log length sent |
186 |
data |
Log |