Mbed OS Reference
Loading...
Searching...
No Matches
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
25namespace mbed {
26namespace nfc {
27
28/**
29 * @addtogroup nfc
30 * @{
31 */
32
33class NFCController;
34
35/**
36 * This is the base class for all remote endpoints (initiators and targets)
37 * addressable over the air interface.
38 */
40public:
41 /**
42 * Create a NFCRemoteEndpointinstance
43 * @param[in] controller the NFCController instance that detected this endpoint
44 */
46
47 /**
48 * Destructor
49 */
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
102protected:
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 */
124
125private:
126 NFCController *_controller;
127};
128
129/**
130 * @}
131 */
132
133} // namespace nfc
134} // namespace mbed
135
136#endif
This class represents a NFC Controller.
Definition: NFCController.h:55
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.
virtual bool is_disconnected() const =0
Check if the endpoint is disconnected/lost.
virtual nfc_err_t connect()=0
Connect the remote endpoint.
virtual void disconnected()=0
Mark endpoint as disconnected.
NFCRemoteEndpoint(NFCController *controller)
Create a NFCRemoteEndpointinstance.
virtual ~NFCRemoteEndpoint()
Destructor.
virtual nfc_err_t disconnect()=0
Disconnect the remote endpoint.
virtual void connected()=0
Mark endpoint as connected.
NFCController * nfc_controller()
Retrieve NFCController instance.
const NFCController * nfc_controller() const
Retrieve NFCController instance.
virtual bool is_connected() const =0
Check if the endpoint is connected.
int nfc_err_t
Type for NFC errors.
Definition: nfc_errors.h:60
The NFCRemoteEndpoint base delegate.
virtual void on_disconnected()
This method is called when the endpoint is lost (air interface link disconnnected)
virtual void on_connected()
This method is called when the endpoint is connected.