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