API  2.3.0
TSmarT Software Library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Functions

int8_t TSMART_CELLULAR_2G_Init (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Initialization of the cellular 2g device. More...
 
int8_t TSMART_CELLULAR_2G_TurnOn (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t *TSMART_CELLULAR_2G_pin_code)
 Turns on the cellular 2g module. More...
 
int8_t TSMART_CELLULAR_2G_ConfigDevice (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_device_config_t *TSMART_CELLULAR_2G_device_config)
 Configures cellular 2g. More...
 
int8_t TSMART_CELLULAR_2G_StartTcpIpStack (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Starts TCP/IP Stack. More...
 
int8_t TSMART_CELLULAR_2G_StopTcpIpStack (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Stops TCP/IP Stack. More...
 
int8_t TSMART_CELLULAR_2G_ConfigTcpIpStack (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_tcp_ip_stack_config_t *TSMART_CELLULAR_2G_tcp_ip_stack_config)
 Cellular 2g device configuration. More...
 
int8_t TSMART_CELLULAR_2G_ConfigBearer (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_bearer_config_t *TSMART_CELLULAR_2G_bearer_config)
 Configures bearer. More...
 
int8_t TSMART_CELLULAR_2G_StopBearer (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Stops bearer. More...
 
int8_t TSMART_CELLULAR_2G_StartBearer (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Start bearer. More...
 
int8_t TSMART_CELLULAR_2G_Attach (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Attachs to GPRS network. More...
 
tsmart_cellular_2g_reg_t TSMART_CELLULAR_2G_CheckGsmRegistration (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Checks registration in GSM network. More...
 
tsmart_cellular_2g_reg_t TSMART_CELLULAR_2G_CheckGprsRegistration (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Checks the registration status of the GPRS network. More...
 
tsmart_cellular_2g_reg_t TSMART_CELLULAR_2G_CheckAttach (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Checks attach. More...
 
int8_t TSMART_CELLULAR_2G_SignalLevel (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Checks GSM signal level. More...
 
int8_t TSMART_CELLULAR_2G_GetMccMncCodes (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint16_t *TSMART_CELLULAR_2G_mcc, uint16_t *TSMART_CELLULAR_2G_mnc)
 Get MCC/MNC codes. More...
 
int8_t TSMART_CELLULAR_2G_GetMainCellInfo (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_cell_info_t *TSMART_CELLULAR_2G_cell_info)
 Gets cell info. More...
 
int8_t TSMART_CELLULAR_2G_GetTime (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_time_t *TSMART_CELLULAR_2G_time)
 Gets the current date and time. More...
 
int8_t TSMART_CELLULAR_2G_SetAlarm (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_time_t *TSMART_CELLULAR_2G_time)
 Sets date/time alarms in the cellular 2G device. More...
 
int64_t TSMART_CELLULAR_2G_GetIMSI (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Gets IMSI code. More...
 
int8_t TSMART_CELLULAR_2G_CheckDevice (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Checks if the module is active or not by sending a simple "AT" command. More...
 
int8_t TSMART_CELLULAR_2G_TurnOffSw (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Turns off. More...
 
int8_t TSMART_CELLULAR_2G_Reset (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_flag_t TSMART_CELLULAR_2G_flag)
 Resets module. More...
 
int8_t TSMART_CELLULAR_2G_ReadIp (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_ip_t *TSMART_CELLULAR_2G_ip)
 Reads the IP address. More...
 
int8_t TSMART_CELLULAR_2G_ReceiveNotifications (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_notif_t *TSMART_CELLULAR_2G_notif, portTickType TSMART_CELLULAR_timeout)
 Receives cellular 2G notifiactions. More...
 
int8_t TSMART_CELLULAR_2G_SendSms (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t *TSMART_CELLULAR_2G_phone, uint8_t *TSMART_CELLULAR_2G_text, uint8_t TSMART_CELLULAR_2G_text_size)
 Sends SMS. More...
 
int8_t TSMART_CELLULAR_2G_ReadSms (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_index, tsmart_cellular_2g_sms_inbox_t *TSMART_CELLULAR_2G_sms_inbox)
 Reads one SMS. More...
 
int8_t TSMART_CELLULAR_2G_DeleteSms (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_index)
 Deletes a SMS. More...
 
int32_t TSMART_CELLULAR_2G_ListSms (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_sms_label_t TSMART_CELLULAR_2G_label)
 Lists SMS stored in the SIM memory. More...
 
int8_t TSMART_CELLULAR_2G_CreateTcpServer (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_tcp_server_t *TSMART_CELLULAR_2G_tcp_server, uint32_t TSMART_CELLULAR_2G_timeout)
 Creates a TCP server. More...
 
int8_t TSMART_CELLULAR_2G_CloseTcpServer (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_id_session)
 Closes a TCP server. More...
 
int8_t TSMART_CELLULAR_2G_CreateTcpClient (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_tcp_client_t *TSMART_CELLULAR_2G_tcp_client, uint32_t TSMART_CELLULAR_2G_timeout)
 Creates a TCP client. More...
 
int8_t TSMART_CELLULAR_2G_CloseTcpClient (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_id_session)
 Closes a TCP client. More...
 
int8_t TSMART_CELLULAR_2G_StartTcpConnection (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_id_session)
 
tsmart_cellular_2g_flag_t TSMART_CELLULAR_2G_CheckDataFlowState (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Checks the connecion state in direct TCP flow data. More...
 
int16_t TSMART_CELLULAR_2G_SendTcpData (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t *TSMART_CELLULAR_2G_data, uint16_t TSMART_CELLULAR_2G_data_size)
 Sends TCP data. More...
 
int16_t TSMART_CELLULAR_2G_ReceiveTcpData (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t *TSMART_CELLULAR_2G_data, uint32_t TSMART_CELLULAR_2G_timeout)
 Receives TCP data. More...
 
int16_t TSMART_CELLULAR_2G_ReceiveTcpNData (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t *TSMART_CELLULAR_2G_data, uint16_t TSMART_CELLULAR_2G_data_size, uint32_t TSMART_CELLULAR_2G_timeout)
 Receives TCP N data bytes. More...
 
int8_t TSMART_CELLULAR_2G_StopTcpConnection (tsmart_cellular_2g_t *TSMART_CELLULAR_2G)
 Stops data flow. More...
 
int8_t TSMART_CELLULAR_2G_CheckSessions (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_sessions_t *TSMART_CELLULAR_2G_sessions)
 Checks the active sessions in the cellular 2g device. More...
 
int8_t TSMART_CELLULAR_2G_CreateFtpClient (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, tsmart_cellular_2g_ftp_client_t *TSMART_CELLULAR_2G_ftp_client, uint32_t TSMART_CELLULAR_2G_timeout)
 Creates a FTP client. More...
 
int8_t TSMART_CELLULAR_2G_CloseFtpClient (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_id_session)
 Closes FTP client. More...
 
int8_t TSMART_CELLULAR_2G_SendFtpFile (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_id_session, uint8_t *TSMART_CELLULAR_2G_path, uint8_t *TSMART_CELLULAR_2G_file_name, uint8_t *TSMART_CELLULAR_2G_data, uint16_t TSMART_CELLULAR_2G_data_size)
 Sends a FTP file. More...
 
int8_t TSMART_CELLULAR_2G_AppendDataToFtpFile (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_id_session, uint8_t *TSMART_CELLULAR_2G_path, uint8_t *TSMART_CELLULAR_2G_file_name, uint8_t *TSMART_CELLULAR_2G_data, uint16_t TSMART_CELLULAR_2G_data_size)
 Appends data to FTP file. More...
 
int32_t TSMART_CELLULAR_2G_ReceiveFtpFile (tsmart_cellular_2g_t *TSMART_CELLULAR_2G, uint8_t TSMART_CELLULAR_2G_id_session, uint8_t *TSMART_CELLULAR_2G_path, uint8_t *TSMART_CELLULAR_2G_file_name, tsmart_cellular_2g_file_location_t *TSMART_CELLULAR_2G_file_location)
 

Detailed Description

Function Documentation

int8_t TSMART_CELLULAR_2G_AppendDataToFtpFile ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_id_session,
uint8_t *  TSMART_CELLULAR_2G_path,
uint8_t *  TSMART_CELLULAR_2G_file_name,
uint8_t *  TSMART_CELLULAR_2G_data,
uint16_t  TSMART_CELLULAR_2G_data_size 
)

Appends data to FTP file.

Maximum size available for this operation is 8000 bytes.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_id_sessionSession Identifier.
TSMART_CELLULAR_2G_pathRemote path to put the file on.
TSMART_CELLULAR_2G_file_nameNew file name to be created remotely (with extension: txt or bin).
TSMART_CELLULAR_2G_dataData to send.
TSMART_CELLULAR_2G_data_sizeData size.
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Clossing data flow failure. Hardware reset is requiered.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Remote FTP server connection filure.
int8_t TSMART_CELLULAR_2G_Attach ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Attachs to GPRS network.

This function forces attach to the GPRS network.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - OK.
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Wrong answer.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Request failure.
tsmart_cellular_2g_reg_t TSMART_CELLULAR_2G_CheckAttach ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Checks attach.

This functions checks if the Cellular 2g module is attached to the GPRS network.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • state:
    • TSMART_CELLULAR_FAIL - Request failure
    • TSMART_CELLULAR_DETTACHED - Detached
    • TSMART_CELLULAR_ATTACHED - Attached
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
tsmart_cellular_2g_flag_t TSMART_CELLULAR_2G_CheckDataFlowState ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Checks the connecion state in direct TCP flow data.

Checking the connection, users can known if the connection is up or down.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_CELLULAR_2G_DISABLE - Connection is shoutdown by the peer.
  • TSMART_CELLULAR_2G_ENABLE - Connection is available to send/receive data.
Examples:
cellular_2g_ftp_receive.c, and cellular_2g_tcp_server.c.
int8_t TSMART_CELLULAR_2G_CheckDevice ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Checks if the module is active or not by sending a simple "AT" command.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - Module is active.
  • TSMART_FAIL - Module is frozen. It's advisable to restart the cellular 2g module.
tsmart_cellular_2g_reg_t TSMART_CELLULAR_2G_CheckGprsRegistration ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Checks the registration status of the GPRS network.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • State
    • TSMART_CELLULAR_FAIL - Request failure.
    • TSMART_CELLULAR_NOT_REGISTERED - Not registered, ME is not currently searching a new operator to register to.
    • TSMART_CELLULAR_REGISTERED_HOME - Registered, home network.
    • TSMART_CELLULAR_SEARCHING_OPERATOR - Not registered, but ME is currently searching a new operator to register to.
    • TSMART_CELLULAR_REGISTRATION_DENIED - Registration denied.
    • TSMART_CELLULAR_UNKNOWN - Unknown answer.
    • TSMART_CELLULAR_ REGISTERED_ROAMING - Registered, roaming.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
tsmart_cellular_2g_reg_t TSMART_CELLULAR_2G_CheckGsmRegistration ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Checks registration in GSM network.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • State:
    • TSMART_CELLULAR_2G_FAIL - Request failure.
    • TSMART_CELLULAR_2G_NOT_REGISTERED - Not registered, ME is not currently searching a new operator to register to.
    • TSMART_CELLULAR_2G_REGISTERED_HOME - Registered, home network.
    • TSMART_CELLULAR_2G_SEARCHING_OPERATOR - Not registered, but ME is currently searching a new operator to register to.
    • TSMART_CELLULAR_2G_REGISTRATION_DENIED - Registration denied.
    • TSMART_CELLULAR_2G_UNKNOWN - Unknown answer.
    • TSMART_CELLULAR_2G_REGISTERED_ROAMING - Registered, roaming.
Examples:
cellular_2g_sms.c.
int8_t TSMART_CELLULAR_2G_CheckSessions ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_sessions_t TSMART_CELLULAR_2G_sessions 
)

Checks the active sessions in the cellular 2g device.

Creates a list of the active sessions in the device. The tsmart_cellular_2g_sessions_t structure has 8 possibles active sessions and each one has a tsmart_cellular_2g_session_t structure:

  • type;
  • session_id
  • ip
  • port
  • min_id
  • max_id

Please check the documentation about tsmart_cellular_2g_session_t to known more details.

Note
: Due to Sierra Wireless SL6087 HW firmware restrictions, it's impossible to have more than 8 actives sessions at the same time.
Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_sessionsCheck sessions structure (output parameter).
Returns
  • Number of sessions - OK.
  • TSMART_FAIL - Request failure.
int8_t TSMART_CELLULAR_2G_CloseFtpClient ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_id_session 
)

Closes FTP client.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_id_sessionFTP session Identifier.
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Wrong answer.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Request failure.
Examples:
cellular_2g_ftp_receive.c, and cellular_2g_ftp_send.c.
int8_t TSMART_CELLULAR_2G_CloseTcpClient ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_id_session 
)

Closes a TCP client.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_id_sessionSession identifier.
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Wrong answer.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Request failure.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, and mqtt_cellular_2g_publisher.c.
int8_t TSMART_CELLULAR_2G_CloseTcpServer ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_id_session 
)

Closes a TCP server.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_id_sessionTCP sever session identifier.
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Wrong answer.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Clossing request failure.
int8_t TSMART_CELLULAR_2G_ConfigBearer ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_bearer_config_t TSMART_CELLULAR_2G_bearer_config 
)

Configures bearer.

This function set the network parameters, according to GSM/GPRS operator in use.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_bearer_configBearer config structure.
Returns
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - It's not possible set bearer as GPRS connection.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - It's not possible set APN.
  • TSMART_CELLULAR_2G_FAULT_CODE_3 - It's not possible set network login.
  • TSMART_CELLULAR_2G_FAULT_CODE_4 - It's not possible set network password.
  • TSMART_CELLULAR_2G_FAULT_CODE_5 - It's not possible set maximum time to connect GPRS bearer.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_ConfigDevice ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_device_config_t TSMART_CELLULAR_2G_device_config 
)

Configures cellular 2g.

It sets the basic parameters to work with the device 2g.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_device_configCellular 2g configuration structure.
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - It's not possible to set the flow control.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - It's not possible to set the level of RI mode.
  • TSMART_CELLULAR_2G_FAULT_CODE_3 - It's not possible to set the led status.
  • TSMART_CELLULAR_2G_FAULT_CODE_4 - It's not possible to set disabling network registration unsolicited result code.
  • TSMART_CELLULAR_2G_FAULT_CODE_5 - It's not possible to set disable network registration unsolicited result code.
  • TSMART_CELLULAR_2G_FAULT_CODE_6 - It's not possible to set the CME errors level.
  • TSMART_CELLULAR_2G_FAULT_CODE_7 - It's not possible to set the type of SMS.
  • TSMART_CELLULAR_2G_FAULT_CODE_8 - It's not possible to set the automatic time zone update.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_sms.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_ConfigTcpIpStack ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_tcp_ip_stack_config_t TSMART_CELLULAR_2G_tcp_ip_stack_config 
)

Cellular 2g device configuration.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_tcp_ip_stack_configTCP/IP stack configuration structure.
Returns
  • TSMART_PASS - Stack TCP/IP configured
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - It's not possible set the IP TLL.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - It's not possible set the time to live of incomplete fragments.
  • TSMART_CELLULAR_2G_FAULT_CODE_3 - It's not possible set the number of segments of initial TCP window.
  • TSMART_CELLULAR_2G_FAULT_CODE_4 - It's not possible set the packet segmentation on IP network side.
  • TSMART_CELLULAR_2G_FAULT_CODE_5 - It's not possible set '+++' escape sequence.
  • TSMART_CELLULAR_2G_FAULT_CODE_6 - It's not possible set maximum timeout of TCP packets.
  • TSMART_CELLULAR_2G_FAULT_CODE_7 - It's not possible set maximum number of TCP packet retransmissions.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_CreateFtpClient ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_ftp_client_t TSMART_CELLULAR_2G_ftp_client,
uint32_t  TSMART_CELLULAR_2G_timeout 
)

Creates a FTP client.

Note
Only one FTP session is currently supported.
Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_ftp_clientFTP client params structure.
TSMART_CELLULAR_2G_timeoutMaximum waiting timeout (in ms, advisable 20 seconds).
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Create FTP client failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Set file type failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_3 - Set file mode failure.
Examples:
cellular_2g_ftp_receive.c, and cellular_2g_ftp_send.c.
int8_t TSMART_CELLULAR_2G_CreateTcpClient ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_tcp_client_t TSMART_CELLULAR_2G_tcp_client,
uint32_t  TSMART_CELLULAR_2G_timeout 
)

Creates a TCP client.

This function creates a TCP client using the remote IP and port selected.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_tcp_clientTCP client structure.
TSMART_CELLULAR_2G_timeoutMaximum waiting timeout.
Returns
  • TSMART_PASS - OK.
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Imcomplete creation process, the TCP client has been close.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - TCP client request failure.
Examples:
cellular_2g_tcp_client.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_CreateTcpServer ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_tcp_server_t TSMART_CELLULAR_2G_tcp_server,
uint32_t  TSMART_CELLULAR_2G_timeout 
)

Creates a TCP server.

Creates a TCP server in the indicated port with a defined number of incoming connections. The cellular 2G device uses a reserve of sessions to define the maximum incoming connections(Range of the incoming conections: id min -id max).

The maximum TCP servers running in the module at the same time is four.

Parameters
TSMART_CELLULAR_2GCelullar 2g structure handler.
TSMART_CELLULAR_2G_tcp_serverTCP server parameters structure.
TSMART_CELLULAR_2G_timeoutMaximum timeout to create the TCP server.
Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - It's not possible to create the TCP server.
Examples:
cellular_2g_tcp_server.c.
int8_t TSMART_CELLULAR_2G_DeleteSms ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_index 
)

Deletes a SMS.

User's can use the TSMART_CELLULAR_2G_ListSms() function to list the SMS stored in the SIM memory to find out the available index of the SMSs to delete.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_indexSMS Index, it can be:
  • 0 - Removes all SMS
  • 1...20 - SMS index
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Fails to delete all SMS.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Fails to delete the selected SMS.
  • TSMART_CELLULAR_2G_FAULT_CODE_3 - Wrong index.
int64_t TSMART_CELLULAR_2G_GetIMSI ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Gets IMSI code.

The international mobile subscriber identity (IMSI)is a unique identification associated with all GSM, UMTS and LTE network SIM cards. It is stored as a 64 bit field. An IMSI is usually presented as a 15 digit long number, but can be shorter. The first 3 digits are the mobile country code (MCC), which are followed by the mobile network code (MNC), either 2 digits (European standard) or 3 digits (North American standard). The length of the MNC depends on the value of the MCC.The remaining digits are the mobile subscription identification number (MSIN) within the network's customer base.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • IMSI code.
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Wrong answer.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Request failure
int8_t TSMART_CELLULAR_2G_GetMainCellInfo ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_cell_info_t TSMART_CELLULAR_2G_cell_info 
)

Gets cell info.

This functions gets some interesting parameters about the main cell:

    - MNC
    - MCC
    - LAC
    - Cell ID
    - BSIC
    - BCCH Freq
    - RxLev
Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_cell_infoCell info structure (output parameter).
Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Request failure.
int8_t TSMART_CELLULAR_2G_GetMccMncCodes ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint16_t *  TSMART_CELLULAR_2G_mcc,
uint16_t *  TSMART_CELLULAR_2G_mnc 
)

Get MCC/MNC codes.

This functions gets the MCC and MNC codes.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_mccMCC code (output parameter).
TSMART_CELLULAR_2G_mncMNC code (output parameter).
Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Request failure.
int8_t TSMART_CELLULAR_2G_GetTime ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_time_t TSMART_CELLULAR_2G_time 
)

Gets the current date and time.

The date and the time will be automatically updated by the network.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_timetime structure (output parameter).
Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Failure.
int8_t TSMART_CELLULAR_2G_Init ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Initialization of the cellular 2g device.

Initializes the hardware configuration of the cellular 2g device and the associated OS mechanisms.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Not possible to get software resources (queues, mutext and so on).
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_sms.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int32_t TSMART_CELLULAR_2G_ListSms ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_sms_label_t  TSMART_CELLULAR_2G_label 
)

Lists SMS stored in the SIM memory.

It returns an int32 with a register map of the SMS indexes used.

The register shall be interpreted as follows:

  • Bitmap example |20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0| = 101111100001111001011

Bit field 0 indicates if there is any SMS in the memory (value 1) or if it is empty (0).

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_labelSelected memory to list. It shall be:
  • TSMART_CELLULAR_2G_REC_UNREAD
  • TSMART_CELLULAR_2G_REC_READ
  • TSMART_CELLULAR_2G_STO_UNSET
  • TSMART_CELLULAR_2G_STO_SENT
  • TSMART_CELLULAR_2G_ALL
Returns
  • Bit map of SMS in memory.
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Unknown memory selected.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Request failure.
int8_t TSMART_CELLULAR_2G_ReadIp ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_ip_t TSMART_CELLULAR_2G_ip 
)

Reads the IP address.

Reads the current IP address from the cellular 2g module. When no IP address is known or not valid, the IP address takes "0.0.0.0" value.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_ipIP address structure (output paramter).
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - IP request failure.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_ReadSms ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_index,
tsmart_cellular_2g_sms_inbox_t TSMART_CELLULAR_2G_sms_inbox 
)

Reads one SMS.

Reads one SMS from the SIM memory. List the SMS stored in the SIM memory using TSMART_CELLULAR_2G_ListSms() function to find out the index of the SMS to read.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_indexIndex of the SMS in the SIM memory.
TSMART_CELLULAR_2G_sms_inboxSMS parameters structure (output parameter).
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Request failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Wrong answer.
int32_t TSMART_CELLULAR_2G_ReceiveFtpFile ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_id_session,
uint8_t *  TSMART_CELLULAR_2G_path,
uint8_t *  TSMART_CELLULAR_2G_file_name,
tsmart_cellular_2g_file_location_t TSMART_CELLULAR_2G_file_location 
)

Receives a FTP file .

Receives a file through the FTP session and stores it in a selected location (RAM or FLASH memory). To achieve it it's necessary to initialize the internal flash in the hardware initialization stage: TSMART_INT_FLASH_Init().

The reception buffer or space to store in flash shall be oversized at least 3 bytes more that real size file.

Attention
If internal flash is not initialize, an exception will happen when this function is executed.
Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_id_sessionSession Id.
TSMART_CELLULAR_2G_pathPath where it is the file to download.
TSMART_CELLULAR_2G_file_nameName of the file to download(the extention file will be included, i.e.: "tst.txt").
TSMART_CELLULAR_2G_file_locationStorage location structure.
Returns
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Flash memory erase failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Connecting failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_3 - Writing in flash memory failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_5 - Buffer too short to receive file.
  • TSMART_CELLULAR_2G_FAULT_CODE_6 - Expired time to received FTP data.
Examples:
cellular_2g_ftp_receive.c.
int8_t TSMART_CELLULAR_2G_ReceiveNotifications ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_notif_t TSMART_CELLULAR_2G_notif,
portTickType  TSMART_CELLULAR_timeout 
)

Receives cellular 2G notifiactions.

Reports about the following notifications:

  • New connection
  • New data received
  • Connection closed
  • CME error
  • SMS received
  • Shoutdown connection
  • Alarm
Attention
To avoid losing data/information/and notifications it's advisable to use it in a high priority task. This is due to the notifications are stored in a queue. This is beacuse the queue can store until 9 notifications at the same time.

TST suggests to use this function in this way:

* switch(){
* break;
* break;
* break;
* break;
* break;
* break;
* break;
* default:
* break;
* }
*
Returns
  • TSMART_CELLULAR_2G Cellular 2g structure handler.
  • TSMART_CELLULAR_2G_notif Notifications structure (output parameter).
  • TSMART_CELLULAR_timeout Maximum waiting timeout.
Examples:
cellular_2g_ftp_receive.c, and cellular_2g_tcp_server.c.
int16_t TSMART_CELLULAR_2G_ReceiveTcpData ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t *  TSMART_CELLULAR_2G_data,
uint32_t  TSMART_CELLULAR_2G_timeout 
)

Receives TCP data.

This function can only used when the application starts a direct flow of data. Check the TSMART_CELLULAR_2G_StartTcpConnection function to know how to start the direct flow of data.

In addition this function should be executed permanently to avoid losing data when direct flow of data is started. When this function is in use and the connection is shoutdown, a notification will be sent and it will return 0 bytes.

In TCP reception there's some forbidden words, this is due to internal parsing of the device driver. If these word are used an exception will happen when this function is executed. These words are:

  • "\r\n+WIPREADY: "
  • "\r\n+WIPACCEPT: "
  • "\r\n+WIPDATA: "
  • "\r\n+CME ERROR: "
  • "\r\n+WIPPEERCLOSE: "
  • "\r\n+CMTI: "
  • "\r\nSHUTDOWN\r\n"
Note
: TSMART_CELLULAR_2G_ReceiveTcpData the function might come to receive a maximum of 1600 bytes, be sure to have a enough buffer size to receive your expected data.
Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_dataMemory buffer to store received data.
TSMART_CELLULAR_2G_timeoutMaximum waiting timeout(ms).
Returns
  • bytes read
Examples:
cellular_2g_ftp_receive.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int16_t TSMART_CELLULAR_2G_ReceiveTcpNData ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t *  TSMART_CELLULAR_2G_data,
uint16_t  TSMART_CELLULAR_2G_data_size,
uint32_t  TSMART_CELLULAR_2G_timeout 
)

Receives TCP N data bytes.

This function can only used when the application starts a direct flow of data. Check the TSMART_CELLULAR_2G_StartTcpConnection function to know how to start the direct flow of data.

In addition this function should be executed permanently to avoid losing data when direct flow of data is started. When this function is in use and the connection is shoutdown, a notification will be sent and it will return 0 bytes.

In TCP reception there's some forbidden words, this is due to internal parsing of the device driver. If these word are used an exception will happen when this function is executed. These words are:

  • "\r\n+WIPREADY: "
  • "\r\n+WIPACCEPT: "
  • "\r\n+WIPDATA: "
  • "\r\n+CME ERROR: "
  • "\r\n+WIPPEERCLOSE: "
  • "\r\n+CMTI: "
  • "\r\nSHUTDOWN\r\n"
Note
: TSMART_CELLULAR_2G_ReceiveTcpNData the function might come to receive a maximum of 1600 bytes, if data received is bigger than the data requested, the exceed data will be discarded
Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_dataMemory buffer to store received data.
TSMART_CELLULAR_2G_data_sizeMaximum size of data to receive.
TSMART_CELLULAR_2G_timeoutMaximum waiting timeout(ms).
Returns
  • bytes read
int8_t TSMART_CELLULAR_2G_Reset ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_flag_t  TSMART_CELLULAR_2G_flag 
)

Resets module.

This functions makes a complete reset. All parameters are reset to their previous values, then it's needs to configure again the device.

There's tow way to make a reset:

  • By software (A specifc "AT command" will be sent)
  • By hardware reset line
Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_flagSelected reset. It shall be:
  • TSMART_CELLULAR_2G_ENABLE - Hardware reset
  • TSMART_CELLULAR_2G_DISABLE - Software reset
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Reset request failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Disable echo failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_3 - Expired time to re-start module.

< Init value: disable

< Init value: disable

< Init value: disable

< Init value: enable

< Init value: enable

Examples:
mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_SendFtpFile ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_id_session,
uint8_t *  TSMART_CELLULAR_2G_path,
uint8_t *  TSMART_CELLULAR_2G_file_name,
uint8_t *  TSMART_CELLULAR_2G_data,
uint16_t  TSMART_CELLULAR_2G_data_size 
)

Sends a FTP file.

Maximum size available for this operation is 8000 bytes.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_id_sessionSession Identifier.
TSMART_CELLULAR_2G_pathRemote path to put the file on.
TSMART_CELLULAR_2G_file_nameNew file name to be created remotely (with extension: txt or bin).
TSMART_CELLULAR_2G_dataData to send.
TSMART_CELLULAR_2G_data_sizeData size.
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Clossing data flow failure. Hardware reset is requiered.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Remote FTP server connection filure.
Examples:
cellular_2g_ftp_send.c.
int8_t TSMART_CELLULAR_2G_SendSms ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t *  TSMART_CELLULAR_2G_phone,
uint8_t *  TSMART_CELLULAR_2G_text,
uint8_t  TSMART_CELLULAR_2G_text_size 
)

Sends SMS.

Sends a SMS to a valid phone number. The maximum string size of the SMS is 160 characters.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_phoneDestination phone number. This pointer shall contain a string with destination phone number and it shall end with a null character ('\0'). i.e "+34001001001\0".
TSMART_CELLULAR_2G_textText to send.
TSMART_CELLULAR_2G_text_sizeNumber of characters to sent.
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - It's not possible to send the SMS(check network or phone number).
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - SMS text not valid or not can send the text.
Examples:
cellular_2g_sms.c.
int16_t TSMART_CELLULAR_2G_SendTcpData ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t *  TSMART_CELLULAR_2G_data,
uint16_t  TSMART_CELLULAR_2G_data_size 
)

Sends TCP data.

This function can only used when the application starts a direct flow of data. Check the TSMART_CELLULAR_2G_StartTcpConnection function to know how to start the direct flow of data.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_dataData to send.
TSMART_CELLULAR_2G_data_sizedata size.
Returns
  • Number of bytes sent.
Examples:
cellular_2g_tcp_client.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_SetAlarm ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
tsmart_cellular_2g_time_t TSMART_CELLULAR_2G_time 
)

Sets date/time alarms in the cellular 2G device.

This function sets a date/time alarm. The maximum number of alarms is 16. Use TSMART_CELLULAR_2G_ReceiveNotifications() to find out when an alarm happens.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_timetime structure (output parameter).
Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Failure.
int8_t TSMART_CELLULAR_2G_SignalLevel ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Checks GSM signal level.

This function checks the level signal received from GSM network in dBm.

Quality Signal:

  • Marginal (Levels of -95dBm or lower): At these sort of levels, it is very likely that you may suffer low throughput and disconnects due to cell loading/breathing even with an outdoor antenna.
  • Workable under most conditions (Levels of -85dBm to -95dBm) : Probably worth considering an outdoor gain type antenna. Could suffer poor throughput and disconnects due to cell loading/breathing.
  • Good (Levels between -75dBm and -85dBm):Normally no problem holding a connection with this sort of level (even with cell breathing) without the use of an external antenna.
  • Excellent (levels above -75dBm): Should not be affected by cell breathing/loading and should not require an external antenna.
Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • Signal level in dBm - OK
  • -115 - Request failure.
int8_t TSMART_CELLULAR_2G_StartBearer ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Start bearer.

Bearer services are telecommunication services providing the capability of transmission of signals between access points [the user-network interfaces (UNIs) in ISDN]. Before start it, user shall configure the bearer.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - The bearer hasn't been started.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_StartTcpConnection ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t  TSMART_CELLULAR_2G_id_session 
)

Starts direct TCP data flow.

Starts a direct TCP data flow with the remote TCP peer after creates or receives an incoming connection. Before starts the direct data flow, it's possible that some data has been received in the buffer of the module. To avoid losing data, it's advisable not send more than the maximum size of the internal reception buffer (1400 bytes) before starting the direct TCP data flow.

After executing this function the module is only able to send and received TCP data, so the other functionalities aren't available until the dirct TCP data flow is stopped using TSMART_CELLULAR_2G_StopTcpConnection() function , by remote desconection or by network problems.

If user try to execute other functionality when the system is working in a direct TCP data flow, the system will be blocked due to it has a mutex protection.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_id_sessionSession identifier.
Returns
  • TSMART_PASS - OK.
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Request failure
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Wrong answer.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_StartTcpIpStack ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Starts TCP/IP Stack.

It starts the embedded TCP/IP stack. To operate with GPRS services (TCP and FTP) this function shall be executed before any execution of the TCP/TFP functions.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - The TCP/IP stack hasn't been started.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_StopBearer ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Stops bearer.

It stops the bearer services. All connections will be shoutdown after executing this function. It's very useful if the aplication needs to renew the current ip due to network changes.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - The bearer hasn't been stoped.
Examples:
mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_StopTcpConnection ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Stops data flow.

This function stops a direct data flow to exchange TCP data. It will take some time to do it due to the guard time required for this function.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Stop connection has not been stoped due to connections problems, check if an automatic disconnection has happend checking the notifications (CME error) or execute it again.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, and mqtt_cellular_2g_publisher.c.
int8_t TSMART_CELLULAR_2G_StopTcpIpStack ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Stops TCP/IP Stack.

It stops the TCP/IP stack. When this function is executed all connections will shoutdown, the currently IP address will be down.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - The TCP/IP stack hasn't been stoped.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_tcp_client.c, and cellular_2g_tcp_server.c.
int8_t TSMART_CELLULAR_2G_TurnOffSw ( tsmart_cellular_2g_t TSMART_CELLULAR_2G)

Turns off.

It sends a specific AT command to turn off the module, removes the possibles notifications queued and resets the internal variables.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Request failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - Wrong answer.

< Init value: disable

< Init value: disable

< Init value: disable

< Init value: enable

< Init value: enable

Examples:
mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.
int8_t TSMART_CELLULAR_2G_TurnOn ( tsmart_cellular_2g_t TSMART_CELLULAR_2G,
uint8_t *  TSMART_CELLULAR_2G_pin_code 
)

Turns on the cellular 2g module.

This function shall be executed before any communication with the cellular 2g device.

Parameters
TSMART_CELLULAR_2GCellular 2g structure handler.
TSMART_CELLULAR_2G_pin_codeSIM pin code, 4 digits are required. If the SIM card doesn't have a pin code, user shall set it empty: "".
Returns
  • TSMART_PASS - OK
  • TSMART_CELLULAR_2G_FAULT_CODE_1 - Enable SIM failure.
  • TSMART_CELLULAR_2G_FAULT_CODE_2 - It was impossible to enter the pin code.
  • TSMART_CELLULAR_2G_FAULT_CODE_3 - Initialization sequence status wrong. Hardware reset is requiered.
  • TSMART_CELLULAR_2G_FAULT_CODE_4 - Expired timeout to turn on the device.
Examples:
cellular_2g_ftp_receive.c, cellular_2g_ftp_send.c, cellular_2g_sms.c, cellular_2g_tcp_client.c, cellular_2g_tcp_server.c, mqtt_cellular_2g_publisher.c, and mqtt_cellular_2g_subscriber.c.