sms - SMS#
Adapted Air780EP Air780EPS
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Tip
This library has its own demo,click this link to view sms demo examples
Example
-- Note that Air780E/Air600E/Air780EG/Air780EG do not support SMS of telecom card!!
-- This means that when the above module is matched with a telecom SIM card, it cannot send short messages from the module or receive short messages from the module.
-- If it is a Unicom card or a mobile card, you can receive short messages, but real-name cards can only send short messages.
sms.send(phone, msg, auto_phone_fix)#
Send SMS
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
Phone number, required |
string |
SMS content, required |
bool |
Whether to automatically process the format of the phone number. The default is to automatically determine the format according to the content of the short message and the number format. Set it to false to disable it. |
Return Value
return value type |
explanation |
---|---|
bool |
Returns true on success, otherwise false or nil |
Examples
None
sms.setNewSmsCb(func)#
Set callback function for new SMS
Parameters
Incoming Value Type |
Explanation |
---|---|
function |
Callback function, 3 parameters, num, txt, metas |
Return Value
return value type |
explanation |
---|---|
nil |
Passed in is a function can succeed, no return value |
Examples
sms.setNewSmsCb(function(num, txt, metas)
-- num Mobile phone number
-- txt Text content
-- metas Metadata of the SMS, such as time sent, long SMS number
-- Note that long text messages will be automatically merged into one txt
log.info("sms", num, txt, metas and json.encode(metas) or "")
end)
sms.autoLong(mode)#
Set up the automatic merging function of long short messages
Parameters
Incoming Value Type |
Explanation |
---|---|
bool |
Whether to automatically merge. If true, it is automatically merged. It is the default value. |
Return Value
return value type |
explanation |
---|---|
bool |
Value after setting |
Examples
-- Disable the automatic merging of long short messages, generally do not need to disable
sms.autoLong(false)
sms.clearLong()#
Clear long SMS cache
Parameters
None
Return Value
return value type |
explanation |
---|---|
int |
Number of fragments cleaned out |
Examples
sms.clearLong()