Modem Interface APIs¶
Header File¶
Functions¶
-
int
md_sms_send(const char *num, const char *sms_text, unsigned int *ref)¶ SMS Send API
- Return
0 on success, error otherwise (mderror_e)
- Parameters
num: [in] Sender’s numbersms_text: [in] message to sendref: [out] GSM 03.40 TP-Message-Reference
-
int
md_sms_read(unsigned index, struct md_smsinfo_t *smsinfo)¶ SMS Read
- Return
0 on success, error otherwise (mderror_e)
- Parameters
index: [in] Index in the storage to read fromsmsinfo: [out] SMS Information structure returned after successful read
-
int
md_sms_delete(int index, int mode)¶ Delete SMS
- Return
0 on success, error otherwise (mderror_e)
- Parameters
index: [in] Index in the storage to read frommode: [in] SMS delete mode (sms_delmode_e)
-
int
md_cfun_set(int cfun, int rst)¶ Set modem CFUN state
- Return
0 on success, error otherwise (mderror_e)
- Parameters
cfun: [in] CFUN value to setrst: [in] reset after setting cfun value
-
int
md_cfun_get(void)¶ Get modem CFUN state
- Return
CFUN status on success, negative value as error (mderror_e)
-
int
md_call_dial(const char *phonenum)¶ Initiate a call This is a non-blocking call, If operation is success Call status will be retured as URC response.
- Return
0 on success, error otherwise (mderror_e)
- Parameters
phonenum: [in] Number to call
-
const char *
md_get_imei(char *imei_buf, int len)¶ Get IMEI
- Return
Buffer containing IMEI
- Parameters
imei_buf: [out] Buffer to store IMEI (optional, can be NULL)len: [in] Size of imei_buf
-
const char *
md_get_imsi(char *imsi_buf, int len)¶ Get IMSI
- Return
Buffer containing IMSI
- Parameters
imsi_buf: [out] Buffer to store IMSI (min 16, optional, can be NULL)len: [in] Size of imsi_buf
-
const char *
md_get_ccid(char *ccid_buf, int len)¶ Get CCID
- Return
Buffer containing IMSI
- Parameters
ccid_buf: [out] Buffer to store CCID (min 20, optional, can be NULL)len: [in] Size of ccid_buf
-
const char *
md_get_operatorname(char *opbuf, int len)¶ Get Current operator name
- Return
Buffer containing operator name
- Parameters
opbuf: [out] Buffer to store name (optional, can be NULL)len: [in] Size of opbuf
-
const char *
md_get_simprovider(char *spn_buf, int len)¶ Get service provider name from SIM
- Return
Buffer containing SPN
- Parameters
spn_buf: [out] Buffer to store SPN (optional, can be NULL)len: [in] Size of spn_buf
-
const char *
md_get_sim_phonenum(char *num, int len)¶ Get MSISDN (Own number) from SIM This API may not work and is SIM dependent
- Return
Buffer containing MSISDN (own number)
- Parameters
num: [out] Buffer to store MSISDN (optional, can be NULL)len: [in] Length of num
-
int
md_get_cellinfo(struct md_cellinfo_t *info)¶ Get serving and neighboring cell information
- Return
0 on success, error otherwise (mderror_e)
- Parameters
info: [out] Information structure to be filled
-
int
md_getbatt_status(uint32_t *capacity, uint32_t *voltage)¶ Get battery status
- Return
0 on success, error otherwise (mderror_e)
- Parameters
capacity: [out] Battery capacity in percentage (0 - 100%)voltage: [out] Battery voltage in millivolts
-
int
md_nvm_store(int index, const void *data, int len)¶ Store in NVM memory
- Note
MT2503/MT6261 only support max 50 byte NVM storage per index
- Return
0 on success, error otherwise (mderror_e)
- Parameters
index: [in] NVM index (1 - 8)data: [in] data to storelen: [in] Length of data
-
int
md_nvm_read(int index, void *data, int len)¶ Read from NVM memory
- Note
MT2503/MT6261 only support max 50 byte NVM storage per index
- Return
success length of actual data is returned, error otherwise (mderror_e)
- Parameters
index: [in] NVM index (1 - 8)data: [out] Buffer to store read datalen: [in] Length of buffer data
Structures¶
-
struct
md_smsinfo_t¶ SMS Information structure
-
struct
__cellinfo_t¶ Cell information structure
Public Members
-
uint16_t
mcc¶ Mobile Country code
-
uint16_t
mnc¶ Mobile Network code
-
uint32_t
lac¶ Location Area code
-
uint32_t
cellid¶ Cell ID
-
uint16_t
bcch_pcid¶ For LTE this represents PCID (Physical Cell Identity); For GSM, Absolute Radio Frequency Channel Number of Broadcast Control Channel BCCH
-
uint16_t
bsic¶ For LTE this value is 0; For GSM, Base station identity code
-
int
signal¶ For LTE, RSRP value; For GSM, RSSI value
-
int16_t
c1_rsrq¶ For LTE, RSRQ Value; For GSM, C1 value
-
int16_t
c2_srxlev¶ For LTE, SRXLEV Value; For GSM, C2 value
-
uint16_t
-
struct
md_cellinfo_t¶ Serving and Neighboring cell information
Public Members
-
int
cell_type¶ Cell type mdcelltype_e
-
struct __cellinfo_t
cell¶ Serving Cell information
-
int
ncell_count¶ Number of valid neighboring cell available in ncell
-
struct __cellinfo_t
ncell[6]¶ Neighboring cell information
-
int
Macros¶
-
SMS_RECV_MAX_SZ¶ Maximum recvieve SMS size
-
PH_NUM_MAX_SZ¶
Enumerations¶
-
enum
mderror_e¶ Modem error code
Values:
-
enumerator
MD_SUCCESS= 0¶ success
-
enumerator
MD_ERR_FAILED= -1¶ faiure, unknown cause
-
enumerator
MD_ERR_TIMEOUT= -2¶ operation timeout
-
enumerator
MD_ERR_BUSY= -3¶ modem busy
-
enumerator
MD_ERR_INVALID_PARAM= -4¶ Invalid parameter
-
enumerator
MD_ERR_NOMEM= -5¶ No memory available
-
enumerator
MD_ERR_NOTALLOWED= -6¶ Operation not allowed
-
enumerator
-
enum
mdcelltype_e¶ Cell info type
Values:
-
enumerator
MD_CELLTYPE_GSM¶ GSM
-
enumerator
MD_CELLTYPE_LTE¶ LTE
-
enumerator
-
enum
sms_status_e¶ SMS Status
Values:
-
enumerator
SMS_STATUS_UNREAD¶
-
enumerator
SMS_STATUS_READ¶
-
enumerator
SMS_STATUS_UNSENT¶
-
enumerator
SMS_STATUS_SENT¶
-
enumerator
SMS_STATUS_ALL¶
-
enumerator
-
enum
sms_delmode_e¶ SMS delete mode
Values:
-
enumerator
SMS_DEL_INDEXED= 0¶ Single message by index
-
enumerator
SMS_DEL_READ= 1¶ Already read messages
-
enumerator
SMS_DEL_READ_SENT= 2¶ Read and sent messages
-
enumerator
SMS_DEL_READ_SENT_UNSENT= 3¶ Read ,sent and unsent messages
-
enumerator
SMS_DEL_ALL= 4¶ All messages in current storage
-
enumerator
