~pwlars/ubuntu-test-cases/touch-mir

« back to all changes in this revision

Viewing changes to tests/phone-app-connected-autopilot/sms_self.py

  • Committer: Paul Larson
  • Date: 2013-09-17 13:59:01 UTC
  • mfrom: (21.1.1 touch)
  • Revision ID: paul.larson@canonical.com-20130917135901-hihmvv5mxm373a3t
Remove phone-app-connected-autopilot.

It should eventually be replaced by the new dialer and messaging
connected testsuites

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
 
3
 
import argparse
4
 
import dbus
5
 
 
6
 
 
7
 
def _get_parser():
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.')
16
 
    return parser
17
 
 
18
 
 
19
 
def _main(args):
20
 
    bus = dbus.SystemBus()
21
 
    obj = bus.get_object('org.ofono', args.modem)
22
 
 
23
 
    mgr = dbus.Interface(obj, 'org.ofono.SimManager')
24
 
    local_sms = str(mgr.GetProperties()['SubscriberNumbers'][0])
25
 
 
26
 
    if args.list:
27
 
        print local_sms
28
 
    else:
29
 
        mgr = dbus.Interface(obj, 'org.ofono.MessageManager')
30
 
        mgr.SendMessage(local_sms, args.message)
31
 
 
32
 
 
33
 
if __name__ == '__main__':
34
 
    _main(_get_parser().parse_args())