|
enum | MODEM_ERR_CODE {
MODEM_ERR_OK = 0,
MODEM_ERR_INIT,
MODEM_ERR_PARAM,
MODEM_ERR_OPEN,
MODEM_ERR_SIM,
MODEM_ERR_PIN,
MODEM_ERR_BAND,
MODEM_ERR_ECHO_OFF,
MODEM_ERR_CELLULAR_DENIED,
MODEM_ERR_RESET,
MODEM_ERR_THREAD,
MODEM_ERR_APN,
MODEM_ERR_CREDENTIAL,
MODEM_ERR_ATTACH,
MODEM_ERR_IF,
MODEM_ERR_CMD,
MODEM_ERR_TIMEOUT,
MODEM_ERR_STATE,
MODEM_ERR_BREAK,
MODEM_ERR_SEM,
MODEM_ERR_ttyUSB,
MODEM_ERR_SYSTEM_INFO,
MODEM_ERR_NOT_SUPPORT_PRODUCT,
MODEM_ERR_GPS_SWITCH,
MODEM_ERR_QUERY_REG,
MODEM_ERR_AMOUNT
} |
|
Sample Code:
cellular_connection.c
#define MODEM_BRAND_PH8 1 |
#define SIZE_USERNAME 128 |
#define SIZE_PASSWORD 128 |
#define SIZE_HOSTNAME 128 |
#define MODEM_BAND_PH8_GSM900 1 |
#define MODEM_BAND_PH8_GSM1800 2 |
#define MODEM_BAND_PH8_GSM850 4 |
#define MODEM_BAND_PH8_GSM1900 8 |
#define MODEM_BAND_PH8_WCDMA2100 16 |
#define MODEM_BAND_PH8_WCDMA1900 32 |
#define MODEM_BAND_PH8_WCDMA850 64 |
#define MODEM_BAND_PH8_WCDMA800 256 |
#define MODEM_BAND_PH8_WCDMA1700 512 |
#define MODEM_BAND_PH8_AUTO 895 |
#define MODEM_STATE_INIT 0 |
#define MODEM_STATE_READY 1 |
#define MODEM_STATE_CONNECTING 2 |
#define MODEM_STATE_CONNECTED 3 |
#define MODEM_STATE_DISCONNECT 4 |
Enumerator |
---|
MODEM_ERR_OK |
0
|
MODEM_ERR_INIT |
1
|
MODEM_ERR_PARAM |
2
|
MODEM_ERR_OPEN |
3
|
MODEM_ERR_SIM |
4
|
MODEM_ERR_PIN |
5
|
MODEM_ERR_BAND |
6
|
MODEM_ERR_ECHO_OFF |
7
|
MODEM_ERR_CELLULAR_DENIED |
8
|
MODEM_ERR_RESET |
9
|
MODEM_ERR_THREAD |
10
|
MODEM_ERR_APN |
11
|
MODEM_ERR_CREDENTIAL |
12
|
MODEM_ERR_ATTACH |
13
|
MODEM_ERR_IF |
14
|
MODEM_ERR_CMD |
15
|
MODEM_ERR_TIMEOUT |
16
|
MODEM_ERR_STATE |
17
|
MODEM_ERR_BREAK |
18
|
MODEM_ERR_SEM |
19
|
MODEM_ERR_ttyUSB |
20
|
MODEM_ERR_SYSTEM_INFO |
21
|
MODEM_ERR_NOT_SUPPORT_PRODUCT |
22
|
MODEM_ERR_GPS_SWITCH |
23
|
MODEM_ERR_QUERY_REG |
24
|
MODEM_ERR_AMOUNT |
25
|
- Parameters
-
- Returns
- Please refer to MODEM_ERR_CODE . On success, MODEM_ERR_OK is returned.
- Note
- If you are not sure the band value, use MODEM_BAND_PH8_AUTO, modem will determine it automatically.
- You should call this function to init cellular modem before calling any other MX_RTU_Cellular_XXX functions.
- On success, cellular state machine will be in state MODEM_STATE_READY.
Now, you can use Start and Stop function to control 3G network.
This function starts the cellular state machine to establish 3G network.
- Parameters
-
[in] | apn | The Access Point Name. |
[in] | userName | Specify the account name for the authentication, if none, use NULL instead. |
[in] | password | Specify the password for the authentication, if none, use NULL instead. . |
[in] | autoCheck | If you want the cellular state machine periodically check 3G connection and re-establish it while it failed automatically, use this argument. |
- Returns
- Please refer to MODEM_ERR_CODE . On success, MODEM_ERR_OK is returned.
- Note
- Pleaes refer to the sample code for the details of arguement autoCheck.
- After calling this function, cellular state machine will be in state MODEM_STATE_CONNECTING.
Once the 3G network is established, the state of cellular state machine becomes to MODEM_STATE_CONNECTED.
This function stops the established 3G network.
- Returns
- Please refer to MODEM_ERR_CODE . On success, MODEM_ERR_OK is returned.
- Note
- After stopping the 3G network, the cellular state machine will back to state MODEM_STATE_READY
This function resets the cellular modem, if the autoCheck function is enabled, you should never use this function to reset modem, the state machine will do it for you automatically.
- Returns
- Please refer to MODEM_ERR_CODE . On success, MODEM_ERR_OK is returned.
- Note
- You can call this function to reset modem only when autoCheck is disabled and the state of cellular state machine is in MODEM_STATE_READY or MODEM_STATE_DISCONNECT
INT32 MX_RTU_Cellular_Net_State |
( |
void |
| ) |
|
Using this function to retrieve the RSSI of the cellular modem
- Parameters
-
- Returns
- Please refer to MODEM_ERR_CODE . On success, MODEM_ERR_OK is returned.
void MX_RTU_Cellular_Modem_IMEI |
( |
INT8 * |
imei | ) |
|
Using this function to retrieve the IMEI of cellular modem
- Parameters
-
void MX_RTU_Cellular_Set_Debug |
( |
UINT8 |
debug | ) |
|
Using this function to retrieve the IMEI of cellular modem
- Parameters
-
[in] | debug | 0:disable 1:enable verbose debug message. |