- add sources.
[platform/framework/web/crosswalk.git] / src / chromeos / dbus / modem_messaging_client.h
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 #include "chromeos/dbus/dbus_client_implementation_type.h"
16
17 namespace dbus {
18 class ObjectPath;
19 }
20
21 namespace chromeos {
22
23 // ModemMessagingClient is used to communicate with the
24 // org.freedesktop.ModemManager1.Modem.Messaging service.  All methods
25 // should be called from the origin thread (UI thread) which
26 // initializes the DBusThreadManager instance.
27 class CHROMEOS_EXPORT ModemMessagingClient : public DBusClient {
28  public:
29   typedef base::Callback<void()> DeleteCallback;
30   typedef base::Callback<void(const dbus::ObjectPath& message_path,
31                               bool complete)> SmsReceivedHandler;
32   typedef base::Callback<void(const std::vector<dbus::ObjectPath>& paths)>
33       ListCallback;
34
35   virtual ~ModemMessagingClient();
36
37   // Factory function, creates a new instance and returns ownership.
38   // For normal usage, access the singleton via DBusThreadManager::Get().
39   static ModemMessagingClient* Create(DBusClientImplementationType type);
40
41   // Sets SmsReceived signal handler.
42   virtual void SetSmsReceivedHandler(const std::string& service_name,
43                                      const dbus::ObjectPath& object_path,
44                                      const SmsReceivedHandler& handler) = 0;
45
46   // Resets SmsReceived signal handler.
47   virtual void ResetSmsReceivedHandler(const std::string& service_name,
48                                        const dbus::ObjectPath& object_path) = 0;
49
50   // Calls Delete method.  |callback| is called after the method call succeeds.
51   virtual void Delete(const std::string& service_name,
52                       const dbus::ObjectPath& object_path,
53                       const dbus::ObjectPath& sms_path,
54                       const DeleteCallback& callback) = 0;
55
56   // Calls List method.  |callback| is called after the method call succeeds.
57   virtual void List(const std::string& service_name,
58                     const dbus::ObjectPath& object_path,
59                     const ListCallback& callback) = 0;
60
61  protected:
62   friend class ModemMessagingClientTest;
63
64   // Create() should be used instead.
65   ModemMessagingClient();
66
67  private:
68   DISALLOW_COPY_AND_ASSIGN(ModemMessagingClient);
69 };
70
71 }  // namespace chromeos
72
73 #endif  // CHROMEOS_DBUS_MODEM_MESSAGING_CLIENT_H_