8
parser = argparse.ArgumentParser(
9
description='Send an SMS message to yourself via the ofono API')
10
parser.add_argument('-m', '--modem', default='/ril_0',
11
help='The modem to use. Default: %(default)s')
12
parser.add_argument('message', nargs='?', default='hello world',
13
help='Message to send. Default "%(default)s"')
14
parser.add_argument('--list', action='store_true',
15
help='Just print the number of this cell phone.')
20
bus = dbus.SystemBus()
21
obj = bus.get_object('org.ofono', args.modem)
23
mgr = dbus.Interface(obj, 'org.ofono.SimManager')
24
local_sms = str(mgr.GetProperties()['SubscriberNumbers'][0])
29
mgr = dbus.Interface(obj, 'org.ofono.MessageManager')
30
mgr.SendMessage(local_sms, args.message)
33
if __name__ == '__main__':
34
_main(_get_parser().parse_args())