Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
NFCRemoteInitiator.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2018 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef MBED_NFC_REMOTE_INITIATOR_H 00018 #define MBED_NFC_REMOTE_INITIATOR_H 00019 00020 #include <stdint.h> 00021 00022 #include "NFCDefinitions.h" 00023 #include "NFCRemoteEndpoint.h" 00024 #include "NFCNDEFCapable.h" 00025 #include "stack/tech/iso7816/iso7816_app.h" 00026 00027 #include "platform/Span.h" 00028 00029 namespace mbed { 00030 namespace nfc { 00031 00032 /** 00033 * @addtogroup nfc 00034 * @{ 00035 */ 00036 00037 class NFCController; 00038 00039 /** 00040 * This class represents a remote NFC initiator (the local controller being in target mode). 00041 * 00042 * An initiator can be a NFC reader, a NFC-enabled phone or other NFC device capable of generating a RF field. 00043 */ 00044 class NFCRemoteInitiator : public NFCRemoteEndpoint, public NFCNDEFCapable { 00045 public: 00046 /** 00047 * Create a NFCRemoteInitiator. 00048 * @param[in] controller the NFCController instance that detected this endpoint 00049 * @param[in] buffer a bytes array used to store NDEF messages 00050 */ 00051 NFCRemoteInitiator(NFCController *controller, const Span<uint8_t> &buffer); 00052 virtual ~NFCRemoteInitiator(); 00053 00054 /** 00055 * The NFCRemoteInitiator delegate. Users of the NFCRemoteInitiator class need to implement this delegate's methods to receive events. 00056 */ 00057 struct Delegate : NFCRemoteEndpoint::Delegate, NFCNDEFCapable::Delegate { 00058 protected: 00059 ~Delegate() {} 00060 }; 00061 00062 /** 00063 * Set the delegate that will receive events generated by the initiator. 00064 * 00065 * @param[in] delegate the delegate instance to use 00066 */ 00067 void set_delegate(Delegate *delegate); 00068 00069 /** 00070 * Retrieve the NFC tag type exposed by the controller to communicate with the initiator. 00071 * 00072 * @return the relevant NFC tag type 00073 */ 00074 virtual nfc_tag_type_t nfc_tag_type() const = 0; 00075 00076 /** 00077 * Retrieve whether ISO7816 applications are supported by the underlying technology. 00078 * 00079 * @return whether ISO7816 applications are supported 00080 */ 00081 virtual bool is_iso7816_supported() const = 0; 00082 00083 /** 00084 * Register an ISO7816 application to be used by the initiator. 00085 * 00086 * @param[in] application a pointer to an nfc_tech_iso7816_app_t instance as defined by the MuNFC stack 00087 */ 00088 virtual void add_iso7816_application(nfc_tech_iso7816_app_t *application) = 0; 00089 00090 protected: 00091 virtual void connected(); 00092 virtual void disconnected(); 00093 00094 private: 00095 // NFCNDEFCapable implementation 00096 virtual NFCNDEFCapable::Delegate *ndef_capable_delegate(); 00097 00098 Delegate *_delegate; 00099 }; 00100 00101 /** 00102 * @} 00103 */ 00104 00105 } // namespace nfc 00106 } // namespace mbed 00107 00108 #endif
Generated on Tue Aug 9 2022 00:37:16 by
1.7.2