This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
wiki:sms [2019/09/25 15:36] ghi removed |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== SMS ====== | ||
- | ===== Use of integrated SMS commands ===== | ||
- | |||
- | Wirnet™ Productline gateways can be configured using SMS commands. Most features available from the web interface and the REST API can be activated/configured over SMS. | ||
- | |||
- | SMS syntax and list of available SMS are described in //Keros SMS commands specification//. Specification aligned with your firmware can be found in [[wiki:resources#keros_sms_documentation|the resources page]]. | ||
- | |||
- | ===== Use of customs SMS ===== | ||
- | |||
- | Wirnet™ Productline gateways are able to send and receive SMS if the mobile network is properly configured. Modems are identified by ''manufacturer_X'' where: | ||
- | * ''manufacturer'' is the modem manufacturer (''sierra'', ''quectelqmi'', ...) | ||
- | * ''X'' is a number starting from 0. It can vary if there are more than one modem on gateway or if modem has been reset (dongle unplug and replug for example) | ||
- | |||
- | |||
- | To retrieve the identifier, use the ''gsmdiag.py'' command. | ||
- | |||
- | Here is an output of ''/tmp/gsmdiag.txt''. Two modems are displayed, and only one has a SIM card present. Its identifier is ''/sierra_0''. | ||
- | |||
- | ++++ | ||
- | Content - gsmdiag.py output | | ||
- | <code bash> | ||
- | root@klk-lpbs-060434:~ # gsmdiag.py | ||
- | Diagnostic written in /tmp/gsmdiag.txt | ||
- | root@klk-lpbs-060434:~ # cat /tmp/gsmdiag.txt | ||
- | Number of modems: 2 | ||
- | [Modem:/sierra_1] | ||
- | Syspath:/sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3 | ||
- | HardwarePosition:1,1 | ||
- | Powered:1 | ||
- | Online:0 | ||
- | Manufacturer:Sierra Wireless, Incorporated | ||
- | Model:MC7304 | ||
- | Revision:SWI9X15C_05.05.58.00 r27038 carmd-fwbuild1 2015/03/04 21:30:23 | ||
- | [SimProps] | ||
- | Present:0 | ||
- | Error: no SIM in modem | ||
- | [Modem:/sierra_0] | ||
- | Powered:1 | ||
- | Online:1 | ||
- | Manufacturer:Sierra Wireless, Incorporated | ||
- | Model:MC7354 | ||
- | Revision:SWI9X15C_05.05.58.00 r27038 carmd-fwbuild1 2015/03/04 21:30:23 | ||
- | [SimProps] | ||
- | Present:1 | ||
- | CardIdentifier:895XXXXXXXXXXXX1015 | ||
- | SubscriberIdentity:3XXXXXXXXXXXXX3 | ||
- | LockedPins:dbus.Array([], signature=dbus.Signature('s'), variant_level=1) | ||
- | PinRequired:none | ||
- | [NetworkRegistrationProps] | ||
- | Status:registered | ||
- | MobileCountryCode:XXX | ||
- | MobileNetworkCode:YY | ||
- | Name:ABCD | ||
- | Strength:80 | ||
- | [ConnectionContexts] | ||
- | [/sierra_0/context1] | ||
- | Name:Internet | ||
- | Active:1 | ||
- | Type:internet | ||
- | Protocol:ip | ||
- | AccessPointName:apname | ||
- | Username:uname | ||
- | Password:pass | ||
- | AuthenticationMethod:chap | ||
- | </code> | ||
- | ++++ | ||
- | |||
- | ==== Send ==== | ||
- | |||
- | It is possible to send an SMS using a DBUS command. Examples: | ||
- | * To send an SMS using the modem ''/sierra_0'' (Wirnet iBTS): | ||
- | <code bash> | ||
- | dbus-send --system --print-reply --dest=org.ofono /sierra_0 org.ofono.MessageManager.SendMessage string:"+33XXXXXXXXXX" string:"test sms" | ||
- | </code> | ||
- | * To send an SMS using the modem ''/huawei_0'' (Wirnet iFemtoCell): | ||
- | <code bash> | ||
- | dbus-send --system --print-reply --dest=org.ofono /huawei_0 org.ofono.MessageManager.SendMessage string:"+33XXXXXXXXXX" string:"test sms" | ||
- | </code> | ||
- | |||
- | ==== Receive ==== | ||
- | |||
- | Receive an SMS using a python test script : | ||
- | |||
- | ++++ | ||
- | File - receive SMS python script | | ||
- | <code bash receive-sms> | ||
- | #!/usr/bin/python2 | ||
- | |||
- | from gi.repository import GLib | ||
- | |||
- | import dbus | ||
- | import dbus.mainloop.glib | ||
- | |||
- | def chunkstring(string, length): | ||
- | return (string[0+i:length+i] for i in range(0, len(string), length)) | ||
- | |||
- | def incoming_message(message, details, path, interface): | ||
- | message_txt = str(message.encode('utf-8')) | ||
- | print("Size of message: %d" % len(message_txt)) | ||
- | print("%s" % (message_txt)) | ||
- | for line in chunkstring(message_txt, 40): | ||
- | print("%s" % line) | ||
- | |||
- | for key in details: | ||
- | val = details[key] | ||
- | print(" %s = %s" % (key, val)) | ||
- | print(" %s = %s" % ('path',path)) | ||
- | print(" %s = %s" % ('interface', interface)) | ||
- | |||
- | if __name__ == '__main__': | ||
- | dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | ||
- | |||
- | bus = dbus.SystemBus() | ||
- | |||
- | bus.add_signal_receiver(incoming_message, | ||
- | bus_name="org.ofono", | ||
- | signal_name = "ImmediateMessage", | ||
- | path_keyword="path", | ||
- | interface_keyword="interface") | ||
- | |||
- | bus.add_signal_receiver(incoming_message, | ||
- | bus_name="org.ofono", | ||
- | signal_name = "IncomingMessage", | ||
- | path_keyword="path", | ||
- | interface_keyword="interface") | ||
- | |||
- | mainloop = GLib.MainLoop() | ||
- | mainloop.run() | ||
- | </code> | ||
- | ++++ |