OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_NFC_RECORD_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_NFC_RECORD_CLIENT_H_ |
6 #define CHROMEOS_DBUS_NFC_RECORD_CLIENT_H_ | 6 #define CHROMEOS_DBUS_NFC_RECORD_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chromeos/chromeos_export.h" | 10 #include "chromeos/chromeos_export.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 virtual void RecordAdded(const dbus::ObjectPath& object_path) {} | 85 virtual void RecordAdded(const dbus::ObjectPath& object_path) {} |
86 | 86 |
87 // Called when a remote NFC record with the object path |object_path| is | 87 // Called when a remote NFC record with the object path |object_path| is |
88 // removed from the set of known records. | 88 // removed from the set of known records. |
89 virtual void RecordRemoved(const dbus::ObjectPath& object_path) {} | 89 virtual void RecordRemoved(const dbus::ObjectPath& object_path) {} |
90 | 90 |
91 // Called when the record property with the name |property_name| on record | 91 // Called when the record property with the name |property_name| on record |
92 // with object path |object_path| has acquired a new value. | 92 // with object path |object_path| has acquired a new value. |
93 virtual void RecordPropertyChanged(const dbus::ObjectPath& object_path, | 93 virtual void RecordPropertyChanged(const dbus::ObjectPath& object_path, |
94 const std::string& property_name) {} | 94 const std::string& property_name) {} |
| 95 |
| 96 // Called when all properties for the record with object path |object_path| |
| 97 // have been received. This method will be called after |
| 98 // Observer::RecordPropertyChanged has been called for all properties that |
| 99 // were received through the initial property fetch that is done when the |
| 100 // object proxy is first created. Observers can use this method to be |
| 101 // notified when all existing properties of a record are available for use. |
| 102 virtual void RecordPropertiesReceived( |
| 103 const dbus::ObjectPath& object_path) {} |
95 }; | 104 }; |
96 | 105 |
97 // NDEF records can be created via the Tag and Device interfaces by passing a | |
98 // dictionary of strings containing the record properties and their values to | |
99 // their respective API methods. | |
100 typedef std::map<std::string, std::string> Attributes; | |
101 | |
102 virtual ~NfcRecordClient(); | 106 virtual ~NfcRecordClient(); |
103 | 107 |
104 // Adds and removes observers for events on all remote NFC records. Check the | 108 // Adds and removes observers for events on all remote NFC records. Check the |
105 // |object_path| parameter of observer methods to determine which record is | 109 // |object_path| parameter of observer methods to determine which record is |
106 // issuing the event. | 110 // issuing the event. |
107 virtual void AddObserver(Observer* observer) = 0; | 111 virtual void AddObserver(Observer* observer) = 0; |
108 virtual void RemoveObserver(Observer* observer) = 0; | 112 virtual void RemoveObserver(Observer* observer) = 0; |
109 | 113 |
110 // Obtain the properties for the NFC record with object path |object_path|; | 114 // Obtain the properties for the NFC record with object path |object_path|; |
111 // any values should be copied if needed. | 115 // any values should be copied if needed. |
112 virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0; | 116 virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0; |
113 | 117 |
114 // Creates the instance. | 118 // Creates the instance. |
115 static NfcRecordClient* Create(DBusClientImplementationType type, | 119 static NfcRecordClient* Create(DBusClientImplementationType type, |
116 NfcDeviceClient* device_client, | 120 NfcDeviceClient* device_client, |
117 NfcTagClient* tag_client); | 121 NfcTagClient* tag_client); |
118 | 122 |
119 protected: | 123 protected: |
120 friend class NfcClientTest; | 124 friend class NfcClientTest; |
121 | 125 |
122 NfcRecordClient(); | 126 NfcRecordClient(); |
123 | 127 |
124 private: | 128 private: |
125 DISALLOW_COPY_AND_ASSIGN(NfcRecordClient); | 129 DISALLOW_COPY_AND_ASSIGN(NfcRecordClient); |
126 }; | 130 }; |
127 | 131 |
128 } // namespace chromeos | 132 } // namespace chromeos |
129 | 133 |
130 #endif // CHROMEOS_DBUS_NFC_RECORD_CLIENT_H_ | 134 #endif // CHROMEOS_DBUS_NFC_RECORD_CLIENT_H_ |
OLD | NEW |