Morse Micro IoT SDK  2.9.7
cli.c File Reference

Detailed Description

Example command line interface (CLI) over UART.

Note
It is assumed that you have followed the steps in the Getting Started guide and are therefore familiar with how to build, flash, and monitor an application using the MM-IoT-SDK framework.

Definition in file cli.c.

#include "mmconfig.h"
#include "mmhal_uart.h"
#include "mmutils.h"
#include "mmagic.h"
#include "mm_app_regdb.h"
#include "mbedtls/mbedtls_config.h"
Include dependency graph for cli.c:

Go to the source code of this file.

Functions

void cli_uart_rx_handler (const uint8_t *data, size_t length, void *arg)
 Handler for the UART receive callback. More...
 
void cli_tx_handler (const char *data, size_t length, void *arg)
 Handler for the CLI transmit callback. More...
 
bool cli_set_deep_sleep_mode_handler (enum mmagic_deep_sleep_mode mode, void *arg)
 Handler for the CLI set deep sleep mode callback. More...
 
void app_init (void)
 Main entry point to the application. More...
 

Variables

struct mmagic_cli * mmagic_cli_ctx
 Pointer to context for CLI receive callback. More...
 

Function Documentation

◆ app_init()

void app_init ( void  )

Main entry point to the application.

This will be invoked in a thread once operating system and hardware initialization has completed. It may return, but it does not have to.

Definition at line 107 of file cli.c.

◆ cli_set_deep_sleep_mode_handler()

bool cli_set_deep_sleep_mode_handler ( enum mmagic_deep_sleep_mode  mode,
void *  arg 
)

Handler for the CLI set deep sleep mode callback.

Parameters
modeThe deep sleep mode to set.
argOpaque argument (unused).
Returns
true on success, false on failure.

Definition at line 78 of file cli.c.

◆ cli_tx_handler()

void cli_tx_handler ( const char *  data,
size_t  length,
void *  arg 
)

Handler for the CLI transmit callback.

Parameters
dataData to transmit.
lengthLength of data to transmit.
argOpaque argument (unused).

Definition at line 64 of file cli.c.

◆ cli_uart_rx_handler()

void cli_uart_rx_handler ( const uint8_t *  data,
size_t  length,
void *  arg 
)

Handler for the UART receive callback.

Parameters
dataReceived data.
lengthLength of received data.
argOpaque argument (unused).

Definition at line 47 of file cli.c.

Variable Documentation

◆ mmagic_cli_ctx

struct mmagic_cli* mmagic_cli_ctx

Pointer to context for CLI receive callback.

Definition at line 38 of file cli.c.