Moxa W406-T-CE [67/74] W315a 325a linux user s manual programmer s guide

Moxa W406-T-LX [67/74] W315a 325a linux user s manual programmer s guide
W315A/325A Linux User's Manual Programmer's Guide
6-8
void cellular_modem_close(unsigned int fd);
Description: Closes a cellular modem handle.
Input: <fd> the handle
Return Value: None
Remarks: You must release the cellular modem handle resource if you do not need to use cellular modem APIs
later.
int cellular_modem_send_cmd(unsigned int fd, char *at_cmd, char *recv, int recv_size, int
timeout);
Description: Sends an AT command to a cellular modem and waits for a reply.
Input: <timeout> timeout in milliseconds if no response.
<fd> the cellular modem
<at_cmd> the AT command
<recv_size> maximum size of the buffer that stores replied data
Output: <recv> pointer to the buffer that stores the reply
Return Value: The number of received data; -1 indicates failure.
Remarks: Generally, you can set the timeout to be 1000 to 2000 milliseconds, but if you call the function with
the “AT^SMGL=ALL” command we suggest setting the timeout greater than 10000, because listing all of the
SMS messages requires more time.
int cellular_modem_gprs_get_signal_strength(unsigned int fd);
Description: Gets the signal strength of the GPRS modem.
Input: <fd> the cellular modem
Output: <recv> Pointer to the buffer that stores the reply
Return Value: 1 to 99 on success; otherwise indicates that the function failed
Remarks: We suggest calling this function periodically.
int cellular_modem_gprs_establish_connection(unsigned int fd, char *user, char *password);
Description: Establishes a GPRS connection to the ISP service provider.
Input: <fd> the cellular modem
<user> pointer to the user id; null indicates an empty userid.
<password> pointer to the user password; null indicates an empty password.
Return Value: 0 on success; otherwise the function failed
int cellular_modem_gprs_abort_connection(unsigned int fd);
Description: Aborts a GPRS connection.
Input: <fd> the cellular modem
Return Value: 0 if successful; other numbers indicate that the function failed
int cellular_modem_gprs_check_connection_status(unsigned int fd);
Description: Checks the status of a GPRS connection.
Input: <fd> the cellular modem
Return Value: 0 indicates the connection is on; other numbers indicate that it is disconnected
unsigned int cellular_modem_gprs_diagnose_status(unsigned int fd);
Description: Diagnosis the status of a GPRS connection and the status of the SIM card.
Input: <fd> the cellular modem
Return Value: 0 indicates no error; a 32-bit number indicates a combination of errors (see below)
Remarks:
GPRS error definitions (each stands for a 32-bit number)
#define GPRS_ERROR_BAUDRATE_COM3 (1<<0)
#define GPRS_ERROR_BAUDRATE_COM4 (1<<1)
#define GPRS_ERROR_FLOWCONTROL (1<<2)

Содержание

Скачать