| 
    Open Storm
    
   | 
 
Functions for connecting to the cellular network, and sending/receiving packets. More...
#include <project.h>

Go to the source code of this file.
Functions | |
| uint8 | modem_startup (int *conn_attempts) | 
| Startup sequence to power on the modem, start modem components and prepare for sending/receiving messages over the network.  More... | |
| uint8 | modem_shutdown () | 
| Shutdown sequence to stop/power down modem components.  More... | |
| void | modem_start () | 
| Initialize modem.  | |
| void | modem_stop () | 
| Deinitialize modem.  | |
| uint8 | at_write_command (char *uart_string, char *expected_response, uint32 uart_timeout) | 
| Write AT command to cell module.  More... | |
| uint8 | modem_connect () | 
| Establish modem connection with internet.  More... | |
| uint8 | modem_disconnect () | 
| Close modem connection to network.  More... | |
| uint8 | modem_setup () | 
| Initialize configurations for the modem.  More... | |
| uint8 | modem_check_network () | 
| Network Registration Report. Function wrapper for AT+CREG command.  More... | |
| int | modem_get_socket_status () | 
| Socket Status. Function wrapper for AT::SS command.  More... | |
| uint8 | modem_get_meid (char *meid) | 
| Mobile Equipment Identifier. Function wrapper for AT::MEID command.  More... | |
| uint8 | modem_check_signal_quality (int *rssi, int *fer) | 
| Signal Quality Check. Function wrapper for AT+CSQ command.  More... | |
| uint8 | modem_set_flow_control (uint8 param) | 
| Set Flow Control. Set command controls the RS232 flow control behaviour.  More... | |
| uint8 | modem_set_error_reports (uint8 param) | 
| Report Mobile Equipment Error. Set command enables/disables the report of result code.  More... | |
| uint8 | modem_reset () | 
| Resets the modem.  More... | |
| uint8 | modem_power_on () | 
| Powers on the modem.  More... | |
| uint8 | modem_power_off () | 
| Powers off the modem.  More... | |
| uint8 | modem_socket_dial (char *socket_dial_str, char *endpoint, int port, int construct_new, int ssl_enabled) | 
| Opens a remote connection via socket.  More... | |
| uint8 | modem_socket_close (int ssl_enabled) | 
| Closes the socket on the modem.  More... | |
| int | send_chunked_request (char *send_str, char *chunk, int chunk_len, char *send_cmd, char *ring_cmd, char *term_char) | 
| Breaks request string into packets and sends them.  More... | |
| int | read_response (char message[], char *recv_cmd, char *ring_cmd, uint8 get_response, int max_loops, int max_message_size) | 
| Reads a HTTP response with a chunked of fixed-length transfer encoding over multiple modem buffers.  More... | |
| uint8 | modem_send_recv (char *send_str, char *response, uint8 get_response, int ssl_enabled) | 
| TODO.  More... | |
| void | construct_generic_request (char *send_str, char *body, char *host, char *route, int port, char *method, char *connection_type, char *extra_headers, int extra_len, char *http_protocol) | 
| Constructs a generic HTTP request.  More... | |
| uint8 | modem_pdp_context_toggle (uint8 activate_pdp) | 
| Context Activation. Execution command is used to activate or deactivate the specified PDP context.  More... | |
| void | uart_string_reset () | 
| Reset modem_received_buffer, clear RX buffer, and reset string index.  More... | |
Variables | |
| uint8 | modem_state | 
| uint8 | lock_acquired | 
| uint32 | feed_id | 
| char * | api_key | 
Functions for connecting to the cellular network, and sending/receiving packets.
| uint8 at_write_command | ( | char * | uart_string, | 
| char * | expected_response, | ||
| uint32 | uart_timeout | ||
| ) | 
Write AT command to cell module.
| uart_string | AT command to write to buffer | 
| expected_response | Substring that is expected in the response | 
| uart_timeout | Timeout in milliseconds | 
expected response is found; 0u otherwise. 

| void construct_generic_request | ( | char * | send_str, | 
| char * | body, | ||
| char * | host, | ||
| char * | route, | ||
| int | port, | ||
| char * | method, | ||
| char * | connection_type, | ||
| char * | extra_headers, | ||
| int | extra_len, | ||
| char * | http_protocol | ||
| ) | 
Constructs a generic HTTP request.
| send_str | Buffer to store generated HTTP request. | 
| body | HTTP Body. | 
| host | Host. | 
| route | Route. | 
| port | Port. | 
| method | HTTP Method. | 
| connection_type | HTTP Connection. | 
| extra_headers | Any extra HTTP headers. | 
| extra_len | Length of the extra headers. | 
| http_protocol | HTTP protocol. | 

| uint8 modem_check_network | ( | ) | 
Network Registration Report. Function wrapper for AT+CREG command.


| uint8 modem_check_signal_quality | ( | int * | rssi, | 
| int * | fer | ||
| ) | 
Signal Quality Check. Function wrapper for AT+CSQ command.
| rssi | An int* where rssi is to be stored. | 
| fer | An int* where fer is to be stored. | 

| uint8 modem_connect | ( | ) | 
Establish modem connection with internet.


| uint8 modem_disconnect | ( | ) | 
Close modem connection to network.


| uint8 modem_get_meid | ( | char * | meid | ) | 
Mobile Equipment Identifier. Function wrapper for AT::MEID command.
| meid | String of size large enough to store an meid of 14 characters. In other words, sizeof(meid) > 14. | 


| int modem_get_socket_status | ( | ) | 
Socket Status. Function wrapper for AT::SS command.

| uint8 modem_pdp_context_toggle | ( | uint8 | activate_pdp | ) | 
Context Activation. Execution command is used to activate or deactivate the specified PDP context.
| activate_pdp | enable flag:
  | 


| uint8 modem_power_off | ( | ) | 
Powers off the modem.


| uint8 modem_power_on | ( | ) | 
Powers on the modem.


| uint8 modem_reset | ( | ) | 
Resets the modem.

| uint8 modem_send_recv | ( | char * | send_str, | 
| char * | response, | ||
| uint8 | get_response, | ||
| int | ssl_enabled | ||
| ) | 
TODO.
| send_str | |
| response | |
| get_response | |
| ssl_enabled | 


| uint8 modem_set_error_reports | ( | uint8 | param | ) | 
Report Mobile Equipment Error. Set command enables/disables the report of result code.
| param | enable flag:
  | 


| uint8 modem_set_flow_control | ( | uint8 | param | ) | 
Set Flow Control. Set command controls the RS232 flow control behaviour.
| param | One of the following ints:
  | 


| uint8 modem_setup | ( | ) | 
Initialize configurations for the modem.


| uint8 modem_shutdown | ( | ) | 
Shutdown sequence to stop/power down modem components.

| uint8 modem_socket_close | ( | int | ssl_enabled | ) | 
Closes the socket on the modem.
| ssl_enabled | Needs to know if ssl is enabled to close the socket properly. | 


| uint8 modem_socket_dial | ( | char * | socket_dial_str, | 
| char * | endpoint, | ||
| int | port, | ||
| int | construct_new, | ||
| int | ssl_enabled | ||
| ) | 
Opens a remote connection via socket.
| socket_dial_str | |
| endpoint | Endpoint | 
| port | Port | 
| construct_new | Contruct new socket dial string flag | 
| ssl_enabled | SSL enabled flag | 


| uint8 modem_startup | ( | int * | conn_attempts | ) | 
Startup sequence to power on the modem, start modem components and prepare for sending/receiving messages over the network.
| conn_attempts | Buffer to store the number of attempted connections | 


| int read_response | ( | char | message[], | 
| char * | recv_cmd, | ||
| char * | ring_cmd, | ||
| uint8 | get_response, | ||
| int | max_loops, | ||
| int | max_message_size | ||
| ) | 
Reads a HTTP response with a chunked of fixed-length transfer encoding over multiple modem buffers.
| message | The message buffer to write to | 
| recv_cmd | The Telit receive command to use: AT::SRECV=1,<BYTES> or AT::SSLRECV=1,<BYTES> | 
| ring_cmd | The Telit ring URC to seek: SRING: 1 or SSLRING: 1 | 
| get_response | 1u if the response is to be downloaded to the response buffer; 0u otherwise | 
| max_loops | The maximum number of times to loop; used as a safeguard | 
| max_message_size | The maximum size of the message  | 


| int send_chunked_request | ( | char * | send_str, | 
| char * | chunk, | ||
| int | chunk_len, | ||
| char * | send_cmd, | ||
| char * | ring_cmd, | ||
| char * | term_char | ||
| ) | 
Breaks request string into packets and sends them.
| send_str | The request string to be sent | 
| chunk | Empty buffer for holding string chunks | 
| chenk_len | The size of the chunks to send | 
| send_cmd | The AT command used to send data: SSEND, SSENDEXT or SSLSEND | 
| ring_cmd | The ring command to look for: SRING or SSLRING | 
| term_char | The termination character to use: '\032' for Telit | 


| void uart_string_reset | ( | ) | 
Reset modem_received_buffer, clear RX buffer, and reset string index.

 1.8.11