~martijnbraam/ofonoctl

e7fef73be8dc90726b1ff2c032e794ee3b247e43 — Martijn Braam 3 years ago 6925415 0.4.0
Added SMS docs
2 files changed, 32 insertions(+), 1 deletions(-)

M README.md
M ofonoctl/__init__.py
M README.md => README.md +13 -1
@@ 67,4 67,16 @@ add the `--append-dns` option.
$ ofonoctl wan --connect --append-dns
```

After this you should have an internet connection.
\ No newline at end of file
After this you should have an internet connection.

## Sending SMS

The `sms` command can be used to send sms messages.

```shell-session
$ ofonoctl sms +31[number] -m "Hello World!"
Send
$ ofonoctl sms +31[number]
[your $EDITOR launches]
Send
```
\ No newline at end of file

M ofonoctl/__init__.py => ofonoctl/__init__.py +19 -0
@@ 253,6 253,20 @@ def action_sms(destination, message=None):
    print("Sent")


def action_sms_get():
    init()
    global manager, bus
    modems = manager.GetModems()
    if len(modems) == 0:
        print("No modems found")
        exit(1)
    modem = modems[0][0]

    mm = dbus.Interface(bus.get_object('org.ofono', modem), 'org.ofono.MessageManager')
    messages = mm.GetMessages()
    print(messages)


def update_resolvconf(nameservers):
    with open('/etc/resolv.conf') as handle:
        current = handle.read()


@@ 290,6 304,7 @@ def main():
    parser_sms = sub.add_parser('sms', help="Send sms message")
    parser_sms.add_argument('--message', '-m', help="The message, if left out your editor will be opened")
    parser_sms.add_argument('destination', help="Destination number for the message")
    sub.add_parser('sms-list', help="List stored SMS messages")

    args = parser.parse_args()



@@ 325,6 340,10 @@ def main():
        action_sms(args.destination, args.message)
        return

    if args.action == "sms-list":
        action_sms_get()
        return


if __name__ == '__main__':
    main()