Mistake on this page?
Report an issue in GitHub or email us
NFCRemoteEndpoint.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2018 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MBED_NFC_REMOTE_ENDPOINT_H
18 #define MBED_NFC_REMOTE_ENDPOINT_H
19 
20 #include <stdint.h>
21 
22 #include "NFCDefinitions.h"
23 
24 namespace mbed {
25 namespace nfc {
26 
27 /**
28  * @addtogroup nfc
29  * @{
30  */
31 
32 class NFCController;
33 
34 /**
35  * This is the base class for all remote endpoints (initiators and targets)
36  * addressable over the air interface.
37  */
39 public:
40  /**
41  * Create a NFCRemoteEndpointinstance
42  * @param[in] controller the NFCController instance that detected this endpoint
43  */
44  NFCRemoteEndpoint(NFCController *controller);
45 
46  /**
47  * Destructor
48  */
49  virtual ~NFCRemoteEndpoint();
50 
51  /**
52  * The NFCRemoteEndpoint base delegate.
53  */
54  struct Delegate {
55  /**
56  * This method is called when the endpoint is connected
57  */
58  virtual void on_connected() {}
59 
60  /**
61  * This method is called when the endpoint is lost (air interface link disconnnected)
62  */
63  virtual void on_disconnected() {}
64 
65  protected:
66  ~Delegate() {}
67  };
68 
69  /**
70  * Connect the remote endpoint
71  *
72  * @return NFC_OK or an error code
73  */
74  virtual nfc_err_t connect() = 0;
75 
76  /**
77  * Disconnect the remote endpoint
78  *
79  * @return NFC_OK or an error code
80  */
81  virtual nfc_err_t disconnect() = 0;
82 
83  /**
84  * Check if the endpoint is connected.
85  * @return whether the endpoint is connected
86  */
87  virtual bool is_connected() const = 0;
88 
89  /**
90  * Check if the endpoint is disconnected/lost.
91  * @return whether the endpoint has been disconnected
92  */
93  virtual bool is_disconnected() const = 0;
94 
95  /**
96  * Get the list of RF protocols supported and activated over the air interface.
97  * @return a bitmask of activated protocols
98  */
100 
101 protected:
102  /**
103  * Mark endpoint as connected
104  */
105  virtual void connected() = 0;
106 
107  /**
108  * Mark endpoint as disconnected
109  */
110  virtual void disconnected() = 0;
111 
112  /**
113  * Retrieve NFCController instance
114  * @return a pointer to the NFController instance that created this endpoint.
115  */
117 
118  /**
119  * Retrieve NFCController instance
120  * @return a pointer to the NFController instance that created this endpoint.
121  */
122  const NFCController *nfc_controller() const;
123 
124 private:
125  NFCController *_controller;
126 };
127 
128 /**
129  * @}
130  */
131 
132 } // namespace nfc
133 } // namespace mbed
134 
135 #endif
virtual void on_disconnected()
This method is called when the endpoint is lost (air interface link disconnnected) ...
virtual nfc_err_t connect()=0
Connect the remote endpoint.
NFCRemoteEndpoint(NFCController *controller)
Create a NFCRemoteEndpointinstance.
virtual bool is_connected() const =0
Check if the endpoint is connected.
virtual void connected()=0
Mark endpoint as connected.
virtual bool is_disconnected() const =0
Check if the endpoint is disconnected/lost.
NFCController * nfc_controller()
Retrieve NFCController instance.
virtual nfc_err_t disconnect()=0
Disconnect the remote endpoint.
virtual void disconnected()=0
Mark endpoint as disconnected.
This class represents a NFC Controller.
Definition: NFCController.h:53
virtual void on_connected()
This method is called when the endpoint is connected.
This is the base class for all remote endpoints (initiators and targets) addressable over the air int...
virtual nfc_rf_protocols_bitmask_t rf_protocols()=0
Get the list of RF protocols supported and activated over the air interface.
The NFCRemoteEndpoint base delegate.
virtual ~NFCRemoteEndpoint()
Destructor.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.