Mistake on this page?
Report an issue in GitHub or email us
NFCProcessCtrl.h
1 /*
2  * Copyright (c) 2018 ARM Limited. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  * Licensed under the Apache License, Version 2.0 (the License); you may
5  * 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, WITHOUT
12  * 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 _NFCPROCESS_H_INCLUDED
18 #define _NFCPROCESS_H_INCLUDED
19 
20 #include <string>
21 #include <vector>
22 #include <stdio.h>
23 #include <stdarg.h>
24 #include "mbed_events.h"
25 #include "nfc/ndef/MessageBuilder.h"
26 #include "nfc/ndef/common/URI.h"
27 #include "nfc/ndef/common/util.h"
28 #include "NFCTestShim.h"
29 
30 #if !MBED_CONF_NFCEEPROM
31 
32 #include "nfc/nfcdefinitions.h"
33 #ifdef TARGET_PN512
34 #include "nfc/controllers/PN512Driver.h"
35 #include "nfc/controllers/PN512SPITransportDriver.h"
36 #endif
37 #include "nfc/NFCRemoteInitiator.h"
38 #include "nfc/NFCController.h"
39 #include "nfc/ndef/common/util.h"
40 
41 /**
42  * Wrapper class handles calls and callbacks for NFC controller drivers. Note, that users must call "start"
43  * in order to start the discovery loop for controllers. An internal buffer stores the NFC message and records.
44  */
48 public:
50 
51  void cmd_get_max_ndef();
52  nfc_err_t init();
53  nfc_err_t start_discovery();
54  nfc_err_t stop_discovery();
55  mbed::nfc::nfc_rf_protocols_bitmask_t get_rf_protocols();
56  nfc_err_t set_rf_protocols(mbed::nfc::nfc_rf_protocols_bitmask_t protocols);
57 
58  virtual void parse_ndef_message(const mbed::Span<const uint8_t> &buffer);
59  virtual size_t build_ndef_message(const mbed::Span<uint8_t> &buffer);
60  const char *str_discovery_terminated_reason(
62 
63 private:
64  // these events are handled, to restart discovery
65  /**
66  * Implementation of NFCRemoteEndpoint::Delegate */
67  virtual void on_connected();
68  /**
69  * Implementation of NFCRemoteEndpoint::Delegate */
70  virtual void on_disconnected();
71  /**
72  * Implementation of NFCController::Delegate */
73  virtual void on_discovery_terminated(
75  /**
76  * Implementation of NFCController::Delegate */
77  virtual void on_nfc_initiator_discovered(
78  const SharedPtr<mbed::nfc::NFCRemoteInitiator> &nfc_initiator);
79 
80 private:
81  mbed::nfc::PN512SPITransportDriver _pn512_transport;
82  mbed::nfc::PN512Driver _pn512_driver;
83  mbed::nfc::NFCController _nfc_controller;
84  SharedPtr<mbed::nfc::NFCRemoteInitiator> _nfc_remote_initiator;
85 };
86 #endif // Controller
87 
88 #endif // _NFCPROCESS_H_INCLUDED
virtual void parse_ndef_message(const mbed::Span< const uint8_t > &buffer)
Parse a NDEF message.
The NFCRemoteInitiator delegate.
EventQueue.
Definition: EventQueue.h:52
Shared pointer class.
Definition: SharedPtr.h:68
Test app driver wrapper.
Definition: NFCTestShim.h:35
Wrapper class handles calls and callbacks for NFC controller drivers.
This class represents a NFC Controller.
Definition: NFCController.h:53
The NFCController delegate.
Definition: NFCController.h:59
virtual size_t build_ndef_message(const mbed::Span< uint8_t > &buffer)
Build a NDEF message.
nfc_discovery_terminated_reason_t
A enumeration of causes for the discovery process terminating.
Definition: NFCController.h:63
void cmd_get_max_ndef()
For an EEPROM, this queries and responds with the flash size, For a Controller, responds with the con...
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.