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