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

Side by Side Diff: device/nfc/nfc_tag.h

Issue 2292703002: chromeos: Remove unused NFC D-Bus client library (Closed)
Patch Set: rebase Created 4 years, 3 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
« no previous file with comments | « device/nfc/nfc_peer_chromeos.cc ('k') | device/nfc/nfc_tag.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_NFC_NFC_TAG_H_
6 #define DEVICE_NFC_NFC_TAG_H_
7
8 #include "base/macros.h"
9 #include "device/nfc/nfc_tag_technology.h"
10
11 namespace device {
12
13 // NfcTag represents a remote NFC tag. An NFC tag is a passive NFC device,
14 // powered by the NFC field of the local adapter while it is in range. Tags
15 // can come in many forms, such as stickers, key fobs, or even embedded in a
16 // more sofisticated device.
17 //
18 // Tags can have a wide range of capabilities. Simple tags just offer
19 // read/write semantics, and contain some one time programmable areas to make
20 // read-only. More complex tags offer math operations and per-sector access
21 // control and authentication. The most sophisticated tags contain operating
22 // environments allowing complex interactions with the code executing on the
23 // tag.
24 //
25 // The NfcTag class facilitates possible interactions with a tag. The most
26 // common usage of a tag is to exchange NDEF messages, but different kinds of
27 // I/O can be performed using the NfcTagTechnology classes.
28 class NfcTag {
29 public:
30 // NFC tag types.
31 enum TagType {
32 kTagType1,
33 kTagType2,
34 kTagType3,
35 kTagType4,
36 kTagTypeUnknown,
37 };
38
39 // NFC protocols that a tag can support. A tag will usually support only one
40 // of these.
41 enum Protocol {
42 kProtocolFelica,
43 kProtocolIsoDep,
44 kProtocolJewel,
45 kProtocolMifare,
46 kProtocolNfcDep,
47 kProtocolUnknown
48 };
49
50 // Interface for observing changes from NFC tags.
51 class Observer {
52 public:
53 virtual ~Observer() {}
54
55 // Called when the tag type has been determined.
56 virtual void TagTypeChanged(NfcTag* tag, TagType type) {}
57
58 // Called when the write access to the tag has been determined or changed.
59 virtual void TagWritePermissionChanged(NfcTag* tag, bool read_only) {}
60
61 // Called when the underlying NFC protocol has been determined.
62 virtual void TagSupportedProtocolChanged(NfcTag* tag, Protocol protocol) {}
63
64 // Called when all initial values of the tag properties have been received
65 // from the remote tag and |tag| is ready to use.
66 virtual void TagReady(NfcTag* tag) {}
67 };
68
69 virtual ~NfcTag();
70
71 // Adds and removes observers for events on this NFC tag. If monitoring
72 // multiple tags, check the |tag| parameter of observer methods to determine
73 // which tag is issuing the event.
74 virtual void AddObserver(Observer* observer) = 0;
75 virtual void RemoveObserver(Observer* observer) = 0;
76
77 // Returns the unique identifier assigned to this tag.
78 virtual std::string GetIdentifier() const = 0;
79
80 // Returns the current tag's NFC forum specified "type".
81 virtual TagType GetType() const = 0;
82
83 // Returns true, if this tag is read-only and cannot be written to.
84 virtual bool IsReadOnly() const = 0;
85
86 // Returns the current tag's supported NFC protocol.
87 virtual Protocol GetSupportedProtocol() const = 0;
88
89 // Returns a bitmask of the tag I/O technologies supported by this tag.
90 virtual NfcTagTechnology::TechnologyTypeMask
91 GetSupportedTechnologies() const = 0;
92
93 // Returns true, if all tag properties have been received from the remote tag
94 // and this object is ready to use.
95 virtual bool IsReady() const = 0;
96
97 // Returns a pointer to the NDEF technology object that allows I/O on NDEF
98 // records. If NDEF is not supported by this tag, operations that are
99 // performed on the returned instance may not succeed. Users can determine
100 // support by calling NfcTagTechnology::IsSupportedByTag. The returned
101 // instance is owned by this tag.
102 virtual NfcNdefTagTechnology* GetNdefTagTechnology() = 0;
103
104 protected:
105 NfcTag();
106
107 private:
108 DISALLOW_COPY_AND_ASSIGN(NfcTag);
109 };
110
111 } // namespace device
112
113 #endif // DEVICE_NFC_NFC_TAG_H_
OLDNEW
« no previous file with comments | « device/nfc/nfc_peer_chromeos.cc ('k') | device/nfc/nfc_tag.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698