OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 DEVICE_NFC_NFC_TAG_CHROMEOS_H_ | |
6 #define DEVICE_NFC_NFC_TAG_CHROMEOS_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "base/macros.h" | |
12 #include "base/observer_list.h" | |
13 #include "chromeos/dbus/nfc_tag_client.h" | |
14 #include "dbus/object_path.h" | |
15 #include "device/nfc/nfc_tag.h" | |
16 | |
17 namespace chromeos { | |
18 | |
19 class NfcNdefTagTechnologyChromeOS; | |
20 | |
21 // The NfcTagChromeOS class implements device::NfcTag for the Chrome OS | |
22 // platform. | |
23 class NfcTagChromeOS : public device::NfcTag, | |
24 public NfcTagClient::Observer { | |
25 public: | |
26 // device::NfcTag overrides. | |
27 void AddObserver(device::NfcTag::Observer* observer) override; | |
28 void RemoveObserver(device::NfcTag::Observer* observer) override; | |
29 std::string GetIdentifier() const override; | |
30 TagType GetType() const override; | |
31 bool IsReadOnly() const override; | |
32 device::NfcTag::Protocol GetSupportedProtocol() const override; | |
33 device::NfcTagTechnology::TechnologyTypeMask GetSupportedTechnologies() | |
34 const override; | |
35 bool IsReady() const override; | |
36 device::NfcNdefTagTechnology* GetNdefTagTechnology() override; | |
37 | |
38 // NfcTagClient::Observer overrides. | |
39 void TagPropertyChanged(const dbus::ObjectPath& object_path, | |
40 const std::string& property_name) override; | |
41 void TagPropertiesReceived(const dbus::ObjectPath& object_path) override; | |
42 | |
43 // Object path representing the remote tag object. | |
44 const dbus::ObjectPath& object_path() const { return object_path_; } | |
45 | |
46 private: | |
47 friend class NfcAdapterChromeOS; | |
48 | |
49 explicit NfcTagChromeOS(const dbus::ObjectPath& object_path); | |
50 ~NfcTagChromeOS() override; | |
51 | |
52 // Object path of the tag that we are currently tracking. | |
53 dbus::ObjectPath object_path_; | |
54 | |
55 // Stores whether or not the initial set of properties have been received. | |
56 bool is_ready_; | |
57 | |
58 // The NfcNdefTagTechnology instance that allows users to perform NDEF | |
59 // read and write on this tag. | |
60 std::unique_ptr<NfcNdefTagTechnologyChromeOS> ndef_technology_; | |
61 | |
62 // List of observers interested in event notifications from us. | |
63 base::ObserverList<device::NfcTag::Observer> observers_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(NfcTagChromeOS); | |
66 }; | |
67 | |
68 } // namespace chromeos | |
69 | |
70 #endif // DEVICE_NFC_NFC_TAG_CHROMEOS_H_ | |
OLD | NEW |