PicoWAN SDK Documentation
|
Simple AT console. More...
#include <os.h>
Go to the source code of this file.
Data Structures | |
struct | command |
Enumerations | |
enum | cmd_ret_val_t { CMD_OK = 0, CMD_ERROR = 1, CMD_DELAYED = 2 } |
Functions | |
void | console_init (uint8_t usart) |
Initializes the console. More... | |
void | console_enable_commands (uint8_t en) |
Enables the AT command interface. More... | |
cmd_ret_val_t | console_commands_help (char *args) |
Built-in command that lists the available commands. More... | |
void | console_return_ok (void) |
Explicitly returns that the previously called AT command has succeeded. More... | |
void | console_return_error (void) |
Explicitly returns that the previously called AT command has failed. More... | |
void | console_register_cmds (struct command *list) |
Registers a list of AT commands. More... | |
void | console_register_raw_callback (void(*cb)(uint8_t *args, uint16_t length)) |
Registers a RAW callback. More... | |
Simple AT console.
Copyright (c) 2018, Archos S.A. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND AND EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARCHOS S.A. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmd_ret_val_t console_commands_help | ( | char * | args | ) |
Built-in command that lists the available commands.
This is a special built-in command that lists the registered commands. It is intended to be added in the command list as an "HELP" command.
args | The arguments (not used, and must be set to NULL if the function is directly called) |
cmd_ret_val_t | CMD_OK if the command succeeded, CMD_ERROR otherwise. |
void console_enable_commands | ( | uint8_t | en | ) |
Enables the AT command interface.
The function enables the AT command interface, which means that the USART output will be parsed as AT commands. If this is not enabled, the RAW data are directly sent to the main application using the RAW callback.
en | 1 to enable the AT command interface, 0 to disable it. |
void console_init | ( | uint8_t | usart | ) |
Initializes the console.
usart | The USART number to which the console will be attached. See usart.h for the available USARTs. |
void console_register_cmds | ( | struct command * | list | ) |
Registers a list of AT commands.
The function allows the main application to register a list of AT commands. It will only be used if the command interface is enabled.
list | The list of AT commands. |
void console_register_raw_callback | ( | void(*)(uint8_t *args, uint16_t length) | cb | ) |
Registers a RAW callback.
The function allows the main application to register a RAW callback. It will only be used if the command interface is disabled.
cb | The RAW callback to register. |
void console_return_error | ( | void | ) |
Explicitly returns that the previously called AT command has failed.
The function returns that the previously called AT command has failed. It should only be used if the last AT command called behaves asynchronously, and thus returned CMD_DELAYED.
void console_return_ok | ( | void | ) |
Explicitly returns that the previously called AT command has succeeded.
The function returns that the previously called AT command has succeeded. It should only be used if the last AT command called behaves asynchronously, and thus returned CMD_DELAYED.