17#include "mmhal_uart.h"
21#include "mm_app_regdb.h"
23#if !defined(MBEDTLS_CONFIG_FILE)
24#include "mbedtls/mbedtls_config.h"
26#include MBEDTLS_CONFIG_FILE
28#ifdef MBEDTLS_THREADING_ALT
29#include "threading_alt.h"
33#ifndef APPLICATION_VERSION
34#error Please define APPLICATION_VERSION to an appropriate value.
109 char cli_mode[4] =
"cli";
115#ifdef MBEDTLS_THREADING_ALT
116 mbedtls_platform_threading_init();
121 if (strcasecmp(cli_mode,
"m2m"))
127 .reg_db = get_regulatory_db(),
130 printf(
"CLI interface enabled\n");
136 .reg_db = get_regulatory_db(),
140 printf(
"M2M interface enabled\n");
struct mmagic_cli * mmagic_cli_ctx
Pointer to context for CLI receive callback.
void cli_uart_rx_handler(const uint8_t *data, size_t length, void *arg)
Handler for the UART receive callback.
bool cli_set_deep_sleep_mode_handler(enum mmagic_deep_sleep_mode mode, void *arg)
Handler for the CLI set deep sleep mode callback.
void cli_tx_handler(const char *data, size_t length, void *arg)
Handler for the CLI transmit callback.
void app_init(void)
Main entry point to the application.
struct mmagic_m2m_agent * mmagic_m2m_agent_init(const struct mmagic_m2m_agent_init_args *args)
Initialize the M2M agent.
struct mmagic_cli * mmagic_cli_init(const struct mmagic_cli_init_args *args)
Initialize and enable the CLI.
void mmagic_cli_rx(struct mmagic_cli *ctx, const char *buf, size_t len)
This function is used to pass received characters to the MMAGIC CLI.
mmagic_deep_sleep_mode
Deep sleep modes for the agent MCU.
@ MMAGIC_DEEP_SLEEP_MODE_ONE_SHOT
Deep sleep is enabled until activity occurs on the datalink.
@ MMAGIC_DEEP_SLEEP_MODE_DISABLED
Deep sleep is disabled.
int mmconfig_read_string(const char *key, char *buffer, int bufsize)
Returns the persistent store string value identified by the key.
void mmhal_uart_tx(const uint8_t *data, size_t length)
Transmit data on the UART.
mmhal_uart_deep_sleep_mode
Enumeration of deep sleep modes for the UART HAL.
void mmhal_uart_init(mmhal_uart_rx_cb_t rx_cb, void *rx_cb_arg)
Initialize the UART HAL and perform any setup necessary.
bool mmhal_uart_set_deep_sleep_mode(enum mmhal_uart_deep_sleep_mode mode)
Set the deep sleep mode for the UART.
@ MMHAL_UART_DEEP_SLEEP_ONE_SHOT
Enable deep sleep until activity occurs on data-link transport.
@ MMHAL_UART_DEEP_SLEEP_DISABLED
Deep sleep mode is disabled.
void mmosal_task_sleep(uint32_t duration_ms)
Sleep for a period of time, yielding during that time.
#define MM_UNUSED(_x)
Casts the given expression to void to avoid "unused" warnings from the compiler.
CLI initialization arguments structure.
char app_version[MMAGIC_SYS_MAX_APP_VERSION_LENGTH+1]
Application version string.
char app_version[MMAGIC_SYS_MAX_APP_VERSION_LENGTH+1]
Application version string.