1*9c5db199SXin Li# Lint as: python2, python3 2*9c5db199SXin Li# Copyright (c) 2012 The Chromium OS Authors. All rights reserved. 3*9c5db199SXin Li# Use of this source code is governed by a BSD-style license that can be 4*9c5db199SXin Li# found in the LICENSE file. 5*9c5db199SXin Li 6*9c5db199SXin Liimport dbus 7*9c5db199SXin Liimport dbus.service 8*9c5db199SXin Li 9*9c5db199SXin Lifrom autotest_lib.client.cros.cellular.pseudomodem import utils 10*9c5db199SXin Li 11*9c5db199SXin Lifrom autotest_lib.client.cros.cellular import mm1_constants 12*9c5db199SXin Li 13*9c5db199SXin Li# TODO(armansito): Have this class implement all Messaging methods 14*9c5db199SXin Li# and make Modems have a reference to an instance of Messaging 15*9c5db199SXin Li# OR have Modem implement this 16*9c5db199SXin Li 17*9c5db199SXin Liclass Messaging(dbus.service.Interface): 18*9c5db199SXin Li """ 19*9c5db199SXin Li Python binding for the org.freedesktop.ModemManager1.Modem.Messaging 20*9c5db199SXin Li interface. The Messaging interfaces handles sending SMS messages and 21*9c5db199SXin Li notification of new incoming messages. 22*9c5db199SXin Li 23*9c5db199SXin Li """ 24*9c5db199SXin Li 25*9c5db199SXin Li @utils.log_dbus_method() 26*9c5db199SXin Li @dbus.service.method(mm1_constants.I_MODEM_MESSAGING, out_signature='ao') 27*9c5db199SXin Li def List(self): 28*9c5db199SXin Li """ 29*9c5db199SXin Li Retrieves all SMS messages. 30*9c5db199SXin Li This method should only be used once and subsequent information 31*9c5db199SXin Li retrieved either by listening for the "Added" and "Completed" signals, 32*9c5db199SXin Li or by querying the specific SMS object of interest. 33*9c5db199SXin Li 34*9c5db199SXin Li @returns: The list of SMS object paths. 35*9c5db199SXin Li 36*9c5db199SXin Li """ 37*9c5db199SXin Li raise NotImplementedError() 38*9c5db199SXin Li 39*9c5db199SXin Li 40*9c5db199SXin Li @utils.log_dbus_method() 41*9c5db199SXin Li @dbus.service.method(mm1_constants.I_MODEM_MESSAGING, in_signature='o') 42*9c5db199SXin Li def Delete(self, path): 43*9c5db199SXin Li """ 44*9c5db199SXin Li Deletes an SMS message. 45*9c5db199SXin Li 46*9c5db199SXin Li @param path: The object path of the SMS to delete. 47*9c5db199SXin Li Emits: 48*9c5db199SXin Li Deleted 49*9c5db199SXin Li 50*9c5db199SXin Li """ 51*9c5db199SXin Li raise NotImplementedError() 52*9c5db199SXin Li 53*9c5db199SXin Li 54*9c5db199SXin Li @utils.log_dbus_method() 55*9c5db199SXin Li @dbus.service.method(mm1_constants.I_MODEM_MESSAGING, 56*9c5db199SXin Li in_signature='a{sv}', out_signature='o') 57*9c5db199SXin Li def Create(self, properties): 58*9c5db199SXin Li """ 59*9c5db199SXin Li Creates a new message object. The 'Number' and 'Text' properties are 60*9c5db199SXin Li mandatory, others are optional. If the SMSC is not specified and one is 61*9c5db199SXin Li required, the default SMSC is used. 62*9c5db199SXin Li 63*9c5db199SXin Li @param properties: Message properties from the SMS D-Bus interface. 64*9c5db199SXin Li @returns: The object path of the new message object. 65*9c5db199SXin Li 66*9c5db199SXin Li """ 67*9c5db199SXin Li raise NotImplementedError() 68*9c5db199SXin Li 69*9c5db199SXin Li 70*9c5db199SXin Li @dbus.service.signal(mm1_constants.I_MODEM_MESSAGING, signature='ob') 71*9c5db199SXin Li def Added(self, path, received): 72*9c5db199SXin Li """ 73*9c5db199SXin Li Emitted when any part of a new SMS has been received or added (but not 74*9c5db199SXin Li for subsequent parts, if any). For messages received from the network, 75*9c5db199SXin Li not all parts may have been received and the message may not be 76*9c5db199SXin Li complete. 77*9c5db199SXin Li 78*9c5db199SXin Li Check the 'State' property to determine if the message is complete. The 79*9c5db199SXin Li "Completed" signal will also be emitted when the message is complete. 80*9c5db199SXin Li 81*9c5db199SXin Li @param path: Object path of the new SMS. 82*9c5db199SXin Li @param received: True if the message was received from the network, as 83*9c5db199SXin Li opposed to being added locally. 84*9c5db199SXin Li 85*9c5db199SXin Li """ 86*9c5db199SXin Li raise NotImplementedError() 87*9c5db199SXin Li 88*9c5db199SXin Li 89*9c5db199SXin Li @dbus.service.signal(mm1_constants.I_MODEM_MESSAGING, signature='o') 90*9c5db199SXin Li def Completed(self, path): 91*9c5db199SXin Li """ 92*9c5db199SXin Li Emitted when the complete-ness status of an SMS message changes. 93*9c5db199SXin Li 94*9c5db199SXin Li An SMS may not necessarily be complete when the first part is received; 95*9c5db199SXin Li this signal will be emitted when all parts have been received, even for 96*9c5db199SXin Li single-part messages. 97*9c5db199SXin Li 98*9c5db199SXin Li @param path: Object path of the new SMS. 99*9c5db199SXin Li 100*9c5db199SXin Li """ 101*9c5db199SXin Li raise NotImplementedError() 102*9c5db199SXin Li 103*9c5db199SXin Li 104*9c5db199SXin Li @dbus.service.signal(mm1_constants.I_MODEM_MESSAGING, signature='o') 105*9c5db199SXin Li def Deleted(self, path): 106*9c5db199SXin Li """ 107*9c5db199SXin Li Emitted when a message has been deleted. 108*9c5db199SXin Li 109*9c5db199SXin Li @param path: Object path of the now deleted SMS. 110*9c5db199SXin Li 111*9c5db199SXin Li """ 112*9c5db199SXin Li raise NotImplementedError() 113