1// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROMEOS_DBUS_MODEM_MESSAGING_CLIENT_H_ 6#define CHROMEOS_DBUS_MODEM_MESSAGING_CLIENT_H_ 7 8#include <string> 9#include <vector> 10 11#include "base/basictypes.h" 12#include "base/callback.h" 13#include "chromeos/chromeos_export.h" 14#include "chromeos/dbus/dbus_client.h" 15 16namespace dbus { 17class ObjectPath; 18} 19 20namespace chromeos { 21 22// ModemMessagingClient is used to communicate with the 23// org.freedesktop.ModemManager1.Modem.Messaging service. All methods 24// should be called from the origin thread (UI thread) which 25// initializes the DBusThreadManager instance. 26class CHROMEOS_EXPORT ModemMessagingClient : public DBusClient { 27 public: 28 typedef base::Callback<void()> DeleteCallback; 29 typedef base::Callback<void(const dbus::ObjectPath& message_path, 30 bool complete)> SmsReceivedHandler; 31 typedef base::Callback<void(const std::vector<dbus::ObjectPath>& paths)> 32 ListCallback; 33 34 virtual ~ModemMessagingClient(); 35 36 // Factory function, creates a new instance and returns ownership. 37 // For normal usage, access the singleton via DBusThreadManager::Get(). 38 static ModemMessagingClient* Create(); 39 40 // Sets SmsReceived signal handler. 41 virtual void SetSmsReceivedHandler(const std::string& service_name, 42 const dbus::ObjectPath& object_path, 43 const SmsReceivedHandler& handler) = 0; 44 45 // Resets SmsReceived signal handler. 46 virtual void ResetSmsReceivedHandler(const std::string& service_name, 47 const dbus::ObjectPath& object_path) = 0; 48 49 // Calls Delete method. |callback| is called after the method call succeeds. 50 virtual void Delete(const std::string& service_name, 51 const dbus::ObjectPath& object_path, 52 const dbus::ObjectPath& sms_path, 53 const DeleteCallback& callback) = 0; 54 55 // Calls List method. |callback| is called after the method call succeeds. 56 virtual void List(const std::string& service_name, 57 const dbus::ObjectPath& object_path, 58 const ListCallback& callback) = 0; 59 60 protected: 61 friend class ModemMessagingClientTest; 62 63 // Create() should be used instead. 64 ModemMessagingClient(); 65 66 private: 67 DISALLOW_COPY_AND_ASSIGN(ModemMessagingClient); 68}; 69 70} // namespace chromeos 71 72#endif // CHROMEOS_DBUS_MODEM_MESSAGING_CLIENT_H_ 73