Cellular Modem (LibCmm) APIs
The cellular modem APIs, based on a CMM (CalAmp Modem Manager) shared library, provide the ability for applications running on LMU-5530 to read a variety of cellular status information as well as send and receive SMS messages.
This page defines the functionality of the CalAmp Modem Manager application’s shared library in the LMU-55XX series of devices. The CMM application is responsible for managing the operation of cellular services provided by the platform.
CalAmp CMM Status Functions
There are a series of library functions used to get status information on the modem’s connection to a cellular network. Unless otherwise specified, these status functions are passed a pointer to either one of the data types defined in the library or a character array that will be filled by the function, which will return an integer value.
Get SIM Info
The getsiminfo function retrieves information related to the device’s SIM card.
int cmm_getsiminfo(struct cmm_sim_info *data);
Get SIM Info Input
The function takes a pointer to an instance of the cmm_sim_info structure (see 2.1.1.1) and fills it in with the appropriate data.
Var Name | Var Type | Description |
---|---|---|
data | struct cmm_sim_info* | A pointer to the cmm_sim_info structure; the function fills it with the relevant information. |
Input Pointer Data Structure
The input pointer refers to the following data structure:
struct cmm_sim_info
{
bool dual_sim; /* 0 = disabled, 1 = enabled, default = 0 */
bool sim_error; /* SIM Error state */
char active_sim; /* 0 = primary, 1 = alternate, default = 0 */
char sim_slot; /* 1 = top, 0 = bottom , default = top */
};
Get SIM Info Output
The sim_info function will output an integer value described in the table below:
Int Value | Error Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Online Info
The getonlineinfo function is used to get information about the radio’s online status.
int cmm_getonlineinfo(struct cmm_radio_online_info *data);
Get Online Info Input
The function takes a pointer to an instance of the cmm_radio_online_info structure (see 2.2.1.1) and fills it in with the appropriate data.
Var Name | Var Type | Description |
---|---|---|
data | struct cmm_radio_online_info* | A pointer to the cmm_radio_online_info structure; the function fills it with the relevant information. |
* Input Pointer Data Structure
The input pointer refers to the following data structure:
struct cmm_radio_online_info
{
bool enabled; /* Comm enabled/disabled */
bool has_service; /* Device has service */
bool online; /* Online or not */
bool b3GNetwork; /* true if it is 3G*/
};
Get Online Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get CDMA Info
The getcdmainfo function is used to get CDMA information.
int cmm_getcdmainfo(struct cmm_cdma_info *data);
Get CDMA Info Input
The function takes a pointer to an instance of the cmm_cdma_info structure (see 2.3.1.1) and fills it in with the appropriate data.
Var Name | Var Type | Description |
---|---|---|
data | struct cmm_cdma_info* | A pointer to the cmm_cdma_info structure; the function fills it with the relevant information. |
Input Pointer Data Structure
The input pointer refers to the following data structure:
struct cmm_cdma_info
{
u_int16_t sid; /* Current System ID */
u_int16_t nid; /* Current Network ID */
u_int16_t prl; /* Active PRL */
int16_t rssi_1x; /* 1xRTT signal in dBm */
int16_t rssi_evdo; /* EVDO signal in dBm */
int16_t ecio; /* Ec/Io signal in dBm */
};
Get CDMA Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Radio Silence Mode
The getsilence function returns the radio silence mode state.
int cmm_getsilence(void);
Get Radio Silence Mode Input
The function has no input.
Get Radio Silence Mode Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
1 | True | Radio Silence mode was enabled. |
0 | False | Radio Silence mode was disabled. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Roaming State
The getroaming function returns the radio silence mode state.
int cmm_getroaming(void);
Get Roaming State Input
It has no input.
Get Roaming State Output
It will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
1 | True | Roaming was enabled. |
0 | False | Roaming was disabled. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Testconfig State
The gettestconfig function returns the testconfig state:
int cmm_gettestconfig(void);
Get Testconfig State Input
It has no input.
Get Testconfig State Output
It will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
1 | True | In the test mode. |
0 | False | Not in the test mode. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get LTE Activation Status
The getgsmactive function returns the state of the LTE activation process.
int cmm_getgsmactive(void);
Get LTE Activation Status Input
The function has no input.
Get LTE Activation Status Output
It will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
3 | Activation status | The activation attempt is currently in progress. |
2 | Activation status | Currently activated. |
1 | Activation status | Not activated. |
0 | Activation status | The activation status is not applicable to this type of cellular modem. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get CDMA Activation Status
The getcdmaactive function returns the CDMA activation status.
int cmm_getcdmaactive(void);
Get CDMA Activation Status Input
The function has no input.
Get CDMA Activation Status Output
It will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
1 | Activation status | Activated. |
0 | Activation status | Not activated. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Model Info
The getmodel function provides information about the modem model (if available).
int cmm_getmodel(char *data);
Get Model Input
The function takes a pointer to a 32-byte character array and fills it with modem model information (if available).
Var Name | Var Type | Description |
---|---|---|
model | char* | A pointer to character array; the function fills the array with the relevant information. |
Get Model Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Manufacture Info
The getmanufacture function provides information about the modem manufacture (if available).
int cmm_getmanufacture(char *data);
Get Manufacture Info Input
It takes a pointer to a 32-byte character array and fills it with modem manufacture information (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Manufacture Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Firmware Info
The getfirmware function provides information about the modem firmware (if available).
int cmm_getfirmware(char *data);
Get Firmware Info Input
The function takes a pointer to a 32-byte character array and fills it with modem firmware information (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Firmware Info Output
It will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Subfirmware Info
The getsubfirmware function provides information about the modem subfirmware (if available).
int cmm_getsubfirmware(char *data);
Get Subfirmware Info Input
The function takes a pointer to a 32-byte character array and fills it with modem subfirmware information (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Subfirmware Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get ESN
The getesn function provides information about the ESN.
int cmm_getesn(char *data);
Get ESN Input
The function takes a pointer to a 16-byte character array and fills it with ESN information.
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get ESN Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Carrier Info
The getcarrier function provides information about the carrier.
int cmm_getcarrier(char *data);
Get Carrier Info Input
The function takes a pointer to a 16-byte character array and fills it with carrier information.
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Carrier Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Country Info
The getcountry function provides information about the country.
int cmm_getcountry(char *data);
Get Country Info Input
The function takes a pointer to a 32-byte character array and fills it with country information.
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Country Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Service Info
The getservice function provides information about the service (if available).
int cmm_getservice(char *data);
Get Service Info Input
The function takes a pointer to a 32-byte character array and fills it with service information (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Service Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Frequency Band Info
The getband function provides information about the frequency band (if available).
int cmm_getband(char *data);
Get Frequency Band Info Input
The function takes a pointer to a 32-byte character array and fills it with frequency band information (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Frequency Band Info Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Modem State
The getstate function provides information about the state of the modem.
int cmm_getstate(char *data);
Get Modem State Input
The function takes a pointer to a 16-byte character array and fills it with information about the modem state (connected/disconnected).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Modem State Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Modem Type
The gettype function provides information about the modem type.
int cmm_gettype(char *data);
Get Modem Type Input
The function takes a pointer to an 8-byte character array and fills it with information about the modem type (CDMA/GSM).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Modem Type Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Radio Info
The getsiminfo function retrieves information related to the device’s SIM card.
int cmm_getsiminfo(struct cmm_sim_info *data);
Get Radio Info Input
The function takes a pointer to an instance of the cmm_radio_info structure (see 2.20.1.1) and fills it in with the appropriate data.
Var Name | Var Type | Description |
---|---|---|
data | struct cmm_radio_info* | A pointer to the cmm_radio_info structure; the function fills it with the relevant information. |
Input Pointer Data Structure
The input pointer refers to the following data structure:
struct cmm_radio_info
{
u_int16_t mcc; /* Mobile Country Code */
u_int16_t mnc; /* Mobile Network Code */
u_int16_t lac; /* Location Area Code */
u_int32_t cid; /* Current cellular ID */
u_int16_t channel; /* Current cellular channel */
int16_t rssi; /* Signal strength in dBm */
u_int16_t ber; /* Bit error rate */
};
Get Radio Info Output
The function will output an integer value described in the table below:
Int Value | Error Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Registration Status
The getregstatus function provides information about the registration status:
int cmm_getregstatus(char *data);
Get Registration Status Input
The function takes a pointer to a 16-byte character array and fills it with information about the modem type (registered/not registered).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Registration Status Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get MSIN
The getmsin function provides the mobile subscription identification number (MSIN).
int cmm_getmsin(char *data);
Get MSIN Input
The function takes a pointer to a 16-byte character array and fills it with information about the MSIN (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get MSIN Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get IMSI
The getimsi function provides the IMSI (international mobile subscriber identity).
int cmm_getimsi(char *data);
Get IMSI Input
The function takes a pointer to a 16-byte character array and fills it with information about the IMSI (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get IMSI Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get ICCID
The geticcid function provides the integrated circuit card identifier (ICCID).
int cmm_geticcid(char *data);
Get ICCID Input
The function takes a pointer to a 21-byte character array and fills it with information about the ICCID (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get ICCID Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Primary ICCID
The getpiccid function provides the primary integrated circuit card identifier.
int cmm_getpiccid(char *data);
Get Primary ICCID Input
The function takes a pointer to a 21-byte character array and fills it with information about the primary ICCID (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Primary ICCID Output
This function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Alternate ICCID
The getalticcid function provides the alternate integrated circuit card identifier.
int cmm_getalticcid(char *data);
Get Alternate ICCID Input
The function takes a pointer to a 21-byte character array and fills it with information about the alternate ICCID (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Alternate ICCID Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get MSISDN
The getmsisdn function provides the mobile station integrated services digital network (MSISDN).
int cmm_getmsisdn(char *data);
Get MSISDN Input
The function takes a pointer to a 21-byte character array and fills it with information about the MSISDN (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get MSISDN Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get MDN
The getmdn function provides the mobile directory number (MDN).
int cmm_getmdn(char *data);
Get MDN Input
The function takes a pointer to a 16-byte character array and fills it with information about the MDN (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get MDN Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get NAI
The getnai function provides the network access identifier (NAI).
int cmm_getnai(char *data);
Get NAI Input
The function takes a pointer to a 32-byte character array and fills it with information about the NAI (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get NAI Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Interface Name
The getifname function provides the modem’s network interface name.
int cmm_getifname(char *data);
Get Interface Name Input
The function takes a pointer to a 16-byte character array and fills it with information about the network interface name (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get Interface Name Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get IMEI
The getimei function provides the modem’s international mobile equipment identity (IMEI).
int cmm_getimei(char *data);
Get IMEI Input
The function takes a pointer to a 32-byte character array and fills it with the IMEI (if available).
Var Name | Var Type | Description |
---|---|---|
data | char* | A pointer to the character array; the function fills the array with the relevant information. |
Get IMEI Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
Get Antenna Status
The antstatus function provides the information about the antenna’s status.
int cmm_antstatus(int *data);
Get Antenna Status Input
The function takes a pointer to an integer value and fills it with the status code.
Var Name | Var Type | Description |
---|---|---|
data | int* | A pointer to an integer value; the function will fill it with -1 (open), 0 (short), or any other int representing antenna resistance in kiloohms. |
Get Antenna Status Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | shmget error | There was an error getting the shared memory segment identifier. |
-3 | shmat error | There was an error attaching to the shared memory segment. |
CalAmp CMM SMS Functions
The Calamp Modem Manager shared library provides the ability to send and receive SMS messages over a cellular network. Communication between the shared library functions and the CMM application is done through a messaging queue, referred to as libqueue. If the libqueue is enabled, the CMM application will direct SMS messages that aren’t CalAmp specific to the libqueue, which can be read with library functions. The library can also send messages to the CMM application, which directs it to send SMS messages to a specified number.
Send SMS Message
The sendsms function is used to send an SMS message to a specified number.
int cmm_sendsms(char *sms_number, char *sms_body);
Send SMS Input
The function takes two character array pointers that should be defined before being passed to the function. The first variable is the phone number the SMS message is being sent to, and the second variable is the body of the SMS message being sent. The function appends a message to the CalAmp Modem Manager message queue containing the variables’ information.
Var Name | Var Type | Description |
---|---|---|
sms_number | char* | A pointer to the char array containing the phone number. |
sms_body | char* | A pointer to the char array containing the SMS message body. |
Send SMS Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | msgget error | There was an error getting the message queue identifier. |
-3 | msgsnd error | There was an error appending the msg pointer to the queue. |
-4 | NULL pointer error | One or both of the input pointers point to a NULL value. |
Register with libqueue
The registersms function sends a message to the CalAmp Modem Manager to register with the library SMS message queue called libqueue.
int cmm_registersms(void);
Register with libqueue Input
The function does not take any input.
Register with libqueue Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | msgget error | There was an error getting the message queue identifier. |
-3 | msgsnd error | There was an error appending the msg pointer to the queue. |
De-register from libqueue
The deregistersms function sends a message to the CalAmp Modem Manager to de-register from the library SMS message queue called libqueue.
int cmm_deregistersms(void);
De-register with libqueue Input
The function does not take any input.
De-register with libqueue Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
0 | Success | The function exited successfully. |
-1 | ftok error | There was an error getting the IPC key. |
-2 | msgget error | There was an error getting the message queue identifier. |
-3 | msgsnd error | There was an error appending the msg pointer to the queue. |
Receive SMS Messages
The rcvsms function will check libqueue to see if any messages containing SMS information are waiting to be consumed. If libqueue has not yet been registered, there will never be any messages in the queue.
int cmm_rcvsms(char *sms_number, char *sms_body);
Receive SMS Input
The function takes two character array pointers that will be filled out by the function:
Var Name | Var Type | Description |
---|---|---|
sms_number | char* | A pointer to a character array of maximum size 32; the function fills it with the phone number of the device sending the SMS message. |
sms_body | char* | A pointer to a character array of maximum size 256; the function fills it with the SMS message. |
Receive SMS Output
The function will output an integer value described in the table below:
Int Value | Return Type | Description |
---|---|---|
1 | SMS message received | The message from libqueue was successfully received with SMS information. |
0 | No error | The function exited successfully, but with no return code (should not be reached). |
-1 | ftok error | There was an error getting the IPC key. |
-2 | msgget error | There was an error getting the message queue identifier. |
-3 | NULL pointer error | One or both of the input pointers point to a NULL value. |
-4 | msgrcv error | No message was found in libqueue. |
-5 | smsparam error | The message found in libqueue is not an SMS message. |
CalAmp libcmm.so Examples
To view an example of the functions described in this document in use, refer to the calamp_cmm_cli.c file provided with the calamp-edgeapp-examples package.
Updated almost 3 years ago