diff --git a/codebase/AT_lib/AT_proc.h b/codebase/AT_lib/AT_proc.h index df89642..b94900e 100644 --- a/codebase/AT_lib/AT_proc.h +++ b/codebase/AT_lib/AT_proc.h @@ -121,44 +121,54 @@ typedef struct }AT_proc_init_t; - +/** + * This function saves the copy of function pointer. + * @brief Function to initialize the AT command modules. + * @param init Structure pointer to AT_Proc. + */ void AT_proc_init (AT_proc_init_t * init); /** + * This function will send an AT command to the AT based hardware. * @brief Function to send AT command. * @param cmd Structure pointer to structure which stores a AT command parameter. - * @return Return AT_CMD_INVALID if AT command is not terminated properly + * @return Return AT_CMD_INVALID if AT command is not terminated properly. */ at_proc_cmd_check_t AT_proc_send_cmd (at_proc_cmd_t * cmd); /** - * @brief Function to handle add ticks event for AT command process module - * @param ticks Number of ticks since last add_tick event + * The function to send Ticks to AT process module to keep common timebase. + * @brief Function to handle add ticks event for AT command process module. + * @param ticks Number of ticks since last add_tick event. */ void AT_proc_add_ticks (uint32_t ticks); /** - * @brief Function to handle event and data generated at interrupt level at thread level - * @note it has to be called in dependent module's process function + * This function is to be called to perform background operations. + * @brief Function to handle event and data generated at interrupt level at thread level. + * @note it has to be called in dependent module's process function. */ void AT_proc_process (); /** - * @brief Function to check if AT command process module is busy - * @return 1 if module is executing some AT command - * @return 0 if module is available + * The function to check if module is busy. + * @brief Function to check if AT command process module is busy. + * @return 1 if module is executing some AT command. + * @return 0 if module is available. */ uint8_t AT_proc_is_busy (); /** + * This function re-executes the last command again. * @brief Function to repeat the last instruction with same parameters. */ void AT_proc_repeat_last_cmd (); /** + * The function to execute a AT command where no response is needed (data streaming). * @brief Function to execute an AT command where response is not needed. - * @param cmd Command string - * @param len Length of command string + * @param cmd Command string. + * @param len Length of command string. * @param duration Duration for which module will be marked busy. * @note This function don't care if operation was successful or not. */ diff --git a/codebase/AT_lib/sim800_cmd_id.h b/codebase/AT_lib/sim800_cmd_id.h index 4635429..41c2e09 100644 --- a/codebase/AT_lib/sim800_cmd_id.h +++ b/codebase/AT_lib/sim800_cmd_id.h @@ -59,48 +59,80 @@ extern "C" { /** List of Command IDs for SIM800 module related commands */ enum SIM800_MOD_CMD { - SIM800_MOD_INIT = (SIM800_MOD_CMD_BASE+SIM800_CRITICAL_CMD_BASE+1),///AT - SIM800_MOD_FCT_RST = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+2),///AT&FZ - SIM800_MOD_TIME_FMT = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+3),///AT+CLTS=1 - SIM800_MOD_SAVE_NVM = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+4),///AT&W - SIM800_MOD_DIS_FUNC = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+5),///AT+CFUNC=0 - SIM800_MOD_EN_FUNC = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+6),///AT+CFUNC=1 - SIM800_MOD_CHK_SIM = (SIM800_MOD_CMD_BASE+SIM800_CRITICAL_CMD_BASE+7),///AT+CPIN? - SIM800_MOD_ECHO_OFF = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+8),///ATE0 + /** AT */ + SIM800_MOD_INIT = (SIM800_MOD_CMD_BASE+SIM800_CRITICAL_CMD_BASE+1), + /** AT&FZ */ + SIM800_MOD_FCT_RST = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+2), + /** AT+CLTS=1 */ + SIM800_MOD_TIME_FMT = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+3), + /** AT&W */ + SIM800_MOD_SAVE_NVM = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+4), + /** AT+CFUNC=0 */ + SIM800_MOD_DIS_FUNC = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+5), + /** AT+CFUNC=1 */ + SIM800_MOD_EN_FUNC = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+6), + /** AT+CPIN? */ + SIM800_MOD_CHK_SIM = (SIM800_MOD_CMD_BASE+SIM800_CRITICAL_CMD_BASE+7), + /** ATE0 */ + SIM800_MOD_ECHO_OFF = (SIM800_MOD_CMD_BASE+SIM800_NORMAL_CMD_BASE+8), }; /** List of Command IDs for Network related commands */ enum SIM800_NET_CMD { - SIM800_NET_CRT_CHK = (SIM800_NET_CMD_BASE+SIM800_CRITICAL_CMD_BASE+1),///AT+CREG? - SIM800_NET_BSET_CTYPE = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+2),///AT+SAPBR=3,1,"Contype","GPRS" - SIM800_NET_BSET_APN = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+3),///AT+SAPBR=3,1,"APN","apn" - SIM800_NET_BSET_USR = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+4),///AT+SAPBR=3,1,"USER","" - SIM800_NET_BSET_PWD = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+5),///AT+SAPBR=3,1,"PWD","" - SIM800_NET_BEN = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+6),///AT+SAPBR=1,1 - SIM800_NET_BCHK = (SIM800_NET_CMD_BASE+SIM800_INFO_CMD_BASE+7),///AT+SAPBR=2,1 - SIM800_NET_PDP_CNTX = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+8),///AT+CGDCONT=1,"IP","apn" - SIM800_NET_ACTV_CID = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+9),///AT+CGACT=1,1 - SIM800_NET_EN_MUX = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+10),///AT+CIPMUX=1 - SIM800_NET_SEL_DTX = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+11),///AT+CIPQSEND=1 - SIM800_NET_TSK_START = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+12),///AT+CSTT="apn","","" - SIM800_NET_EN_GPRS = (SIM800_NET_CMD_BASE+SIM800_CRITICAL_CMD_BASE+13),///AT+CIICR - SIM800_NET_GET_IP = (SIM800_NET_CMD_BASE+SIM800_INFO_CMD_BASE+14),///AT+CIFSR - SIM800_NET_CHK = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+15),//////AT+CREG? - SIM800_NET_CHK_GPRS = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+16)//////AT+GATT? + /** AT+CREG? */ + SIM800_NET_CRT_CHK = (SIM800_NET_CMD_BASE+SIM800_CRITICAL_CMD_BASE+1), + /** AT+SAPBR=3,1,"Contype","GPRS" */ + SIM800_NET_BSET_CTYPE = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+2), + /** AT+SAPBR=3,1,"APN","apn" */ + SIM800_NET_BSET_APN = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+3), + /** AT+SAPBR=3,1,"USER","" */ + SIM800_NET_BSET_USR = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+4), + /** AT+SAPBR=3,1,"PWD","" */ + SIM800_NET_BSET_PWD = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+5), + /** AT+SAPBR=1,1 */ + SIM800_NET_BEN = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+6), + /** AT+SAPBR=2,1 */ + SIM800_NET_BCHK = (SIM800_NET_CMD_BASE+SIM800_INFO_CMD_BASE+7), + /** AT+CGDCONT=1,"IP","apn" */ + SIM800_NET_PDP_CNTX = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+8), + /** AT+CGACT=1,1 */ + SIM800_NET_ACTV_CID = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+9), + /** AT+CIPMUX=1 */ + SIM800_NET_EN_MUX = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+10), + /** AT+CIPQSEND=1 */ + SIM800_NET_SEL_DTX = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+11), + /** AT+CSTT="apn","","" */ + SIM800_NET_TSK_START = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+12), + /** AT+CIICR */ + SIM800_NET_EN_GPRS = (SIM800_NET_CMD_BASE+SIM800_CRITICAL_CMD_BASE+13), + /** AT+CIFSR */ + SIM800_NET_GET_IP = (SIM800_NET_CMD_BASE+SIM800_INFO_CMD_BASE+14), + /** AT+CREG? */ + SIM800_NET_CHK = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+15), + /** AT+GATT? */ + SIM800_NET_CHK_GPRS = (SIM800_NET_CMD_BASE+SIM800_NORMAL_CMD_BASE+16) }; /** List of Command IDs for HTTP related commands */ enum SIM800_HTTP_CMD { - SIM800_HTTP_INIT = (SIM800_HTTP_CMD_BASE+SIM800_NORMAL_CMD_BASE+1),///AT+HTTPINIT - SIM800_HTTP_PARA_CID = (SIM800_HTTP_CMD_BASE+SIM800_NORMAL_CMD_BASE+2),///AT+HTTPPARA="CID",1 - SIM800_HTTP_PARA_URL = (SIM800_HTTP_CMD_BASE+SIM800_NORMAL_CMD_BASE+3),///AT+HTTPPARA="CONTENT","type" - SIM800_HTTP_PARA_CTYPE = (SIM800_HTTP_CMD_BASE+SIM800_NORMAL_CMD_BASE+4),///AT+HTTPPARA="URL","you_url.whatever" - SIM800_HTTP_RQST_GET = (SIM800_HTTP_CMD_BASE+SIM800_INFO_CMD_BASE+5),///AT+HTTPACTION=0 - SIM800_HTTP_RQST_POST = (SIM800_HTTP_CMD_BASE+SIM800_INFO_CMD_BASE+6),///AT+HTTPACTION=1 - SIM800_HTTP_DATA_READ = (SIM800_HTTP_CMD_BASE+SIM800_INFO_CMD_BASE+7),///AT+HTTPREAD - SIM800_HTTP_DATA_SEND = (SIM800_HTTP_CMD_BASE+SIM800_INFO_CMD_BASE+8),///AT+HTTPDATA=x,y x:len int, y:timeout int + /** AT+HTTPINIT */ + SIM800_HTTP_INIT = (SIM800_HTTP_CMD_BASE+SIM800_NORMAL_CMD_BASE+1), + /** AT+HTTPPARA="CID",1 */ + SIM800_HTTP_PARA_CID = (SIM800_HTTP_CMD_BASE+SIM800_NORMAL_CMD_BASE+2), + /** AT+HTTPPARA="URL","you_url.whatever" */ + SIM800_HTTP_PARA_URL = (SIM800_HTTP_CMD_BASE+SIM800_NORMAL_CMD_BASE+3), + /** AT+HTTPPARA="CONTENT","type" */ + SIM800_HTTP_PARA_CTYPE = (SIM800_HTTP_CMD_BASE+SIM800_NORMAL_CMD_BASE+4), + /** AT+HTTPACTION=0 */ + SIM800_HTTP_RQST_GET = (SIM800_HTTP_CMD_BASE+SIM800_INFO_CMD_BASE+5), + /** AT+HTTPACTION=1 */ + SIM800_HTTP_RQST_POST = (SIM800_HTTP_CMD_BASE+SIM800_INFO_CMD_BASE+6), + /** AT+HTTPREAD */ + SIM800_HTTP_DATA_READ = (SIM800_HTTP_CMD_BASE+SIM800_INFO_CMD_BASE+7), + /** AT+HTTPDATA=x,y x:len int, y:timeout int */ + SIM800_HTTP_DATA_SEND = (SIM800_HTTP_CMD_BASE+SIM800_INFO_CMD_BASE+8), }; #ifdef __cplusplus diff --git a/codebase/AT_lib/sim800_oper.h b/codebase/AT_lib/sim800_oper.h index 12bb81f..a8352e2 100644 --- a/codebase/AT_lib/sim800_oper.h +++ b/codebase/AT_lib/sim800_oper.h @@ -133,36 +133,38 @@ typedef struct }sim800_init_t; /** - * @brief Function to initialize basic operations of sim800 module + * This function add all the AT commands required to initialize the SIM800 + * hardware into circular buffer. + * @brief Function to initialize basic operations of sim800 module. * @param init Structure pointer to the structure holding initialization information * @note use to check if module is presented and connected properly */ void sim800_oper_init (sim800_init_t * init); /** + * This function is to be called to perform background operations. * @brief Function to process SIM800 operations. * @note it has to be called in while(true) */ void sim800_oper_process (); /** - * @brief Function to handle add ticks event for sim800 operation module + * The function to send Ticks to SIM800 module to keep common timebase. + * @brief Function to handle add ticks event for sim800 operation module. * @param ticks Number of ticks since last add_tick event */ void sim800_oper_add_ticks (uint32_t ticks); /** - * @brief Function to get current state of sim800 module + * This function returns SIM800 Operation module's status. + * @brief Function to get current state of sim800 module. * @return SIM800 status @ref sim800_oper_status_t */ sim800_oper_status_t sim800_oper_get_status (); /** - * @brief Function to enable SMS service. - */ -//void sim800_oper_enable_sms (void); - -/** + * This function push all the AT commands required to establish GPRS connection + * into the circular buffer. * @brief Function to enable GPRS service. * @param ip_addr Pointer to the memory where IP address is to be stored * @param len Pointer to the memory where length of IP address is to be stored @@ -170,26 +172,30 @@ sim800_oper_status_t sim800_oper_get_status (); void sim800_oper_enable_gprs (uint8_t * ip_addr, uint32_t * len); /** - * @brief Function to connect to a server + * This function edits the AT command to required to connect to any server. + * @brief Function to connect to a server. * @param conn_params Structure pointer to the structure to store connection parameters * @TODO Return Connection ID when multiple Connections are needed. */ void sim800_oper_conns (sim800_server_conn_t * conn_params); /** - * @brief Function to generate http request + * This function edits and adds the AT commands required to make HTTP request. + * @brief Function to generate http request. * @param http_req Structure pointer to structure to store http request parameters. */ void sim800_oper_http_req (sim800_http_req_t * http_req); /** - * @brief Function to get gprs_status + * This function returns GPRS status. + * @brief Function to get gprs_status. * @return GPRS connection status */ sim800_conn_status_t sim800_oper_get_gprs_status (); /** - * @brief Function to get server's connection status + * This function returns server connection status. + * @brief Function to get server's connection status. * @param server_id Server ID * @return Server status for given server ID */