User`s manual
Table Of Contents
- 1. Introduction
- 2. Getting Started
- Powering on the W406-LX
- Connecting the W406-LX to a PC
- Configuring the Ethernet Interface
- USB Port for Expansion
- SD Socket for Storage Expansion
- Setting Up the Wireless Module
- Configuring the SIM Card
- Entering the PIN Code
- Verifying the SIM Card Status
- Enabling or Disabling the PIN Code Authentication
- Changing the PIN Code
- Unlocking the SIM Card
- Connecting to the Internet
- Reconnecting to the Internet
- Disconnecting from the Internet
- Detecting an Internet Connection Error
- Sending and Reading an SMS Message
- Deleting an SMS Message
- Test Program—Developing Hello.c
- 3. Managing Embedded Linux
- 4. Managing Communications
- 5. Development Tool Chains
- 6. Programmer’s Guide
- 7. Software Lock
- A. System Commands

W406-LX Linux User’s Manual Programmer’s Guide
6-11
Closes a cellular modem handle.
void cellular_modem_close(unsigned int fd);
Inputs:
<fd> the handle
Return Values:
None
Remark:
You must release the cellular modem handle resource if you don’t need to use cellular modem
APIs later.
Sends an AT command to a cellular modem and waits for a reply.
int cellular_modem_send_cmd(unsigned int fd, char *at_cmd, char *recv, int recv_size, int
timeout);
Inputs:
<fd> the cellular modem
<at_cmd> the AT command
<recv_size> maximum size of the buffer that stores replied data
<timeout> timeout in milliseconds if no response.
Outpus:
<recv> point to buffer that stores the reply
Return Values:
the number of received data, -1 indicates failure.
Remark:
Generally, you can set the timeout to be 1000~2000 milliseconds, but if you call the function with
“AT^SMGL=ALL” command. We suggest you set the timeout greater than 10000, because listing
all of the SMS messages requires more time.
Gets the signal strength of the GPRS modem.
int cellular_modem_gprs_get_signal_strength(unsigned int fd);
Inputs:
<fd> the cellular modem
Outpus:
<recv> point to buffer that stores the reply
Return Values:
1 to 99 on success, otherwise the function fails
Remark:
It is suggested to call this function periodically.
Establishes a GPRS connection to the ISP service provider.
int cellular_modem_gprs_establish_connection(unsigned int fd, char *user, char *password);
Inputs:
<fd> the cellular modem
<user> point to the user id, null indicates empty userid.
<password> point to the user password, null indicates empty password.
Return Values:
0 on success, otherwise, the function fails
Remark: