Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: chromeos/dbus/modem_messaging_client.h

Issue 10533006: Support the ModemManager1 interfaces for SMS messages (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: Get rid of RequestUpdate function, address nits Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_MODEM_MESSAGING_CLIENT_H_
6 #define CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ 6 #define CHROMEOS_DBUS_MODEM_MESSAGING_CLIENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "chromeos/chromeos_export.h" 14 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_client_implementation_type.h" 15 #include "chromeos/dbus/dbus_client_implementation_type.h"
15 16
16 namespace base {
17 class DictionaryValue;
18 class ListValue;
19 }
20
21 namespace dbus { 17 namespace dbus {
22 class Bus; 18 class Bus;
23 class ObjectPath; 19 class ObjectPath;
24 } 20 }
25 21
26 namespace chromeos { 22 namespace chromeos {
27 23
28 // GsmSMSClient is used to communicate with 24 // ModemMessagingClient is used to communicate with the
29 // org.freedesktop.ModemManager.Modem.Gsm.SMS service. 25 // org.freedesktop.ModemManager1.Modem.Messaging service. All methods
30 // All methods should be called from the origin thread (UI thread) which 26 // should be called from the origin thread (UI thread) which
31 // initializes the DBusThreadManager instance. 27 // initializes the DBusThreadManager instance.
32 class CHROMEOS_EXPORT GsmSMSClient { 28 class CHROMEOS_EXPORT ModemMessagingClient {
33 public: 29 public:
34 typedef base::Callback<void(uint32 index, bool complete)> SmsReceivedHandler;
35 typedef base::Callback<void()> DeleteCallback; 30 typedef base::Callback<void()> DeleteCallback;
36 typedef base::Callback<void(const base::DictionaryValue& sms)> GetCallback; 31 typedef base::Callback<void(const dbus::ObjectPath& message_path,
37 typedef base::Callback<void(const base::ListValue& result)> ListCallback; 32 bool complete)> SmsReceivedHandler;
33 typedef base::Callback<void(const std::vector<dbus::ObjectPath>& paths)>
34 ListCallback;
38 35
39 virtual ~GsmSMSClient(); 36 virtual ~ModemMessagingClient();
40 37
41 // Factory function, creates a new instance and returns ownership. 38 // Factory function, creates a new instance and returns ownership.
42 // For normal usage, access the singleton via DBusThreadManager::Get(). 39 // For normal usage, access the singleton via DBusThreadManager::Get().
43 static GsmSMSClient* Create(DBusClientImplementationType type, 40 static ModemMessagingClient* Create(DBusClientImplementationType type,
44 dbus::Bus* bus); 41 dbus::Bus* bus);
45 42
46 // Sets DataPlansUpdate signal handler. 43 // Sets SmsReceived signal handler.
47 virtual void SetSmsReceivedHandler(const std::string& service_name, 44 virtual void SetSmsReceivedHandler(const std::string& service_name,
48 const dbus::ObjectPath& object_path, 45 const dbus::ObjectPath& object_path,
49 const SmsReceivedHandler& handler) = 0; 46 const SmsReceivedHandler& handler) = 0;
50 47
51 // Resets DataPlansUpdate signal handler. 48 // Resets SmsReceived signal handler.
52 virtual void ResetSmsReceivedHandler(const std::string& service_name, 49 virtual void ResetSmsReceivedHandler(const std::string& service_name,
53 const dbus::ObjectPath& object_path) = 0; 50 const dbus::ObjectPath& object_path) = 0;
54 51
55 // Calls Delete method. |callback| is called after the method call succeeds. 52 // Calls Delete method. |callback| is called after the method call succeeds.
56 virtual void Delete(const std::string& service_name, 53 virtual void Delete(const std::string& service_name,
57 const dbus::ObjectPath& object_path, 54 const dbus::ObjectPath& object_path,
58 uint32 index, 55 const dbus::ObjectPath& sms_path,
59 const DeleteCallback& callback) = 0; 56 const DeleteCallback& callback) = 0;
60 57
61 // Calls Get method. |callback| is called after the method call succeeds.
62 virtual void Get(const std::string& service_name,
63 const dbus::ObjectPath& object_path,
64 uint32 index,
65 const GetCallback& callback) = 0;
66
67 // Calls List method. |callback| is called after the method call succeeds. 58 // Calls List method. |callback| is called after the method call succeeds.
68 virtual void List(const std::string& service_name, 59 virtual void List(const std::string& service_name,
69 const dbus::ObjectPath& object_path, 60 const dbus::ObjectPath& object_path,
70 const ListCallback& callback) = 0; 61 const ListCallback& callback) = 0;
71 62
72 // Requests a check for new messages. In flimflam this does nothing. The
73 // stub implementation uses it to generate a sequence of test messages.
74 virtual void RequestUpdate(const std::string& service_name,
75 const dbus::ObjectPath& object_path) = 0;
76
77 protected: 63 protected:
78 // Create() should be used instead. 64 // Create() should be used instead.
79 GsmSMSClient(); 65 ModemMessagingClient();
80 66
81 private: 67 private:
82 DISALLOW_COPY_AND_ASSIGN(GsmSMSClient); 68 DISALLOW_COPY_AND_ASSIGN(ModemMessagingClient);
83 }; 69 };
84 70
85 } // namespace chromeos 71 } // namespace chromeos
86 72
87 #endif // CHROMEOS_DBUS_GSM_SMS_CLIENT_H_ 73 #endif // CHROMEOS_DBUS_MODEM_MESSAGING_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698