W406-CE User’s Manual
Application Development
Visual C++ Library
After the SDK is installed on your development PC, the library will be available in your Visual
Studio 2005/2008 environment.
GPRS/SIM/SMS
The definition header file includes the entire library API; you can find it in the SDK installation
path “
C:\Program Files\Windows CE Tools\wce600\W406-CE\Include\Armv4i\moxa
”.
Opens a cellular modem handle for later use.
unsigned int cellular_modem_open(void);
Inputs:
None
Return Values:
pointer to a cellular modem handle. Return 0 on failure.
Remark:
Every cellular modem API needs the cellular modem handle parameter, so you must use the
function first before you program them.
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.
B-2