mirror of https://github.com/ARMmbed/mbed-os.git
Fix API signatures
parent
9fcca783b9
commit
6a0cbffaf6
|
|
@ -86,7 +86,8 @@ namespace nfc {
|
|||
*
|
||||
* @param[in] driver a pointer to a NFCControllerDriver instance
|
||||
* @param[in] queue a pointer to the events queue to use
|
||||
* @param[in] ndef_buffer_sz NDEF buffer size
|
||||
* @param[in] ndef_buffer a bytes array used to store NDEF messages
|
||||
* @param[in] ndef_buffer_sz the array size in bytes
|
||||
*/
|
||||
NFCController(NFCControllerDriver* driver, events::EventQueue* queue, uint8_t* ndef_buffer, size_t ndef_buffer_sz);
|
||||
|
||||
|
|
@ -167,6 +168,7 @@ namespace nfc {
|
|||
Timeout _timeout;
|
||||
Delegate* _delegate;
|
||||
bool _discovery_running;
|
||||
uint8_t* _ndef_buffer;
|
||||
size_t _ndef_buffer_sz;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -119,8 +119,6 @@ namespace nfc {
|
|||
NFCEEPROMDriver* _driver;
|
||||
events::EventQueue* _queue;
|
||||
bool _initialized;
|
||||
uint8_t* _ndef_buffer;
|
||||
size_t _ndef_buffer_sz;
|
||||
|
||||
nfc_eeprom_operation_t _current_op;
|
||||
buffer_t _ndef_buffer_reader;
|
||||
|
|
|
|||
|
|
@ -42,9 +42,10 @@ namespace nfc {
|
|||
public:
|
||||
/**
|
||||
* Create a NFCRemoteInitiator.
|
||||
*
|
||||
* @param[in] buffer a bytes array used to store NDEF messages
|
||||
* @param[in] buffer_size the array size in bytes
|
||||
*/
|
||||
NFCRemoteInitiator();
|
||||
NFCRemoteInitiator(uint8_t* buffer, size_t buffer_size);
|
||||
virtual ~NFCRemoteInitiator();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,14 +37,16 @@ namespace nfc {
|
|||
/**
|
||||
* This class is an implementation of the Type 4 tag application.
|
||||
*/
|
||||
class Type4RemoteInitiator : public NFCRemoteInitiator, public NFCNDEFCapable {
|
||||
class Type4RemoteInitiator : public NFCRemoteInitiator {
|
||||
private:
|
||||
/**
|
||||
* Create a Type4RemoteInitiator.
|
||||
*
|
||||
* @param[in] controller pointer to the NFCController instance that created this object
|
||||
* @param[in] buffer a bytes array used to store NDEF messages
|
||||
* @param[in] buffer_size the array size in bytes
|
||||
*/
|
||||
Type4RemoteInitiator(NFCController* controller);
|
||||
Type4RemoteInitiator(NFCController* controller, uint8_t* buffer, size_t buffer_size);
|
||||
|
||||
// NFCRemoteEndpoint implementation
|
||||
virtual nfc_err_t connect();
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
using namespace mbed;
|
||||
using namespace mbed::nfc;
|
||||
|
||||
NFCController::NFCController(NFCControllerDriver* driver, events::EventQueue* queue, size_t ndef_buffer_sz) :
|
||||
NFCController::NFCController(NFCControllerDriver* driver, events::EventQueue* queue, uint8_t* ndef_buffer, size_t ndef_buffer_sz) :
|
||||
_driver(driver), _queue(queue), _transceiver(NULL), _scheduler(NULL), _delegate(NULL), _discovery_running(false), _ndef_buffer_sz(ndef_buffer_sz)
|
||||
{
|
||||
_driver->set_delegate(this);
|
||||
|
|
@ -135,9 +135,13 @@ void NFCController::polling_callback(nfc_err_t ret)
|
|||
if( !transceiver_is_initiator_mode(_transceiver) ) {
|
||||
nfc_tech_t active_tech = transceiver_get_active_techs(_transceiver);
|
||||
if( active_tech.nfc_iso_dep_a || active_tech.nfc_iso_dep_b ) {
|
||||
SharedPtr<Type4RemoteInitiator> type4_remote_initiator( new Type4RemoteInitiator(_transceiver, _ndef_buffer_sz) );
|
||||
if( _delegate != NULL ) {
|
||||
_delegate->on_nfc_initiator_discovered(type4_remote_initiator);
|
||||
Type4RemoteInitiator type4_remote_initiator_ptr = new (std::nothrow) Type4RemoteInitiator(_transceiver, _ndef_buffer, _ndef_buffer_sz);
|
||||
if( type4_remote_initiator_ptr == NULL ) {
|
||||
// No memory :(
|
||||
SharedPtr<Type4RemoteInitiator> type4_remote_initiator( type4_remote_initiator_ptr );
|
||||
if( _delegate != NULL ) {
|
||||
_delegate->on_nfc_initiator_discovered(type4_remote_initiator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,18 +16,11 @@
|
|||
|
||||
#include "NFCRemoteInitiator.h"
|
||||
|
||||
#include "acore/buffer.h"
|
||||
#include "acore/buffer_reader.h"
|
||||
#include "acore/buffer_builder.h"
|
||||
|
||||
#include "stack/transceiver/transceiver.h"
|
||||
#include "stack/tech/iso7816/iso7816.h"
|
||||
#include "stack/tech/iso7816/iso7816_app.h"
|
||||
|
||||
using namespace mbed;
|
||||
using namespace mbed::nfc;
|
||||
|
||||
NFCRemoteInitiator::NFCRemoteInitiator(NFCController* controller) : NFCRemoteEndpoint(controller) {
|
||||
NFCRemoteInitiator::NFCRemoteInitiator(NFCController* controller, uint8_t* buffer, size_t buffer_size) :
|
||||
NFCRemoteEndpoint(controller), NFCNDEFCapable(buffer, buffer_size) {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -38,20 +31,6 @@ NFCRemoteInitiator::~NFCRemoteInitiator() {
|
|||
|
||||
void NFCRemoteInitiator::set_remote_initiator_delegate(Delegate* delegate)
|
||||
{
|
||||
|
||||
_delegate = delegate;
|
||||
}
|
||||
|
||||
nfc_tag_type_t NFCRemoteInitiator::nfc_tag_type() const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool NFCRemoteInitiator::is_iso7816_supported() const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void NFCRemoteInitiator::add_iso7816_application(ISO7816App* application)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2018 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "NFCTarget.h"
|
||||
|
||||
using namespace mbed;
|
||||
using namespace mbed::nfc;
|
||||
|
||||
NFCTarget::NFCTarget(uint8_t* buffer, size_t buffer_size) :
|
||||
NFCNDEFCapable(buffer, buffer_size) {
|
||||
|
||||
}
|
||||
|
||||
NFCTarget::~NFCTarget() {
|
||||
|
||||
}
|
||||
|
|
@ -28,7 +28,8 @@
|
|||
using namespace mbed;
|
||||
using namespace mbed::nfc;
|
||||
|
||||
Type4RemoteInitiator::Type4RemoteInitiator(NFCController* controller) :
|
||||
Type4RemoteInitiator::Type4RemoteInitiator(NFCController* controller, uint8_t* buffer, size_t buffer_size) :
|
||||
NFCRemoteInitiator(ndef_buffer, ndef_buffer_sz),
|
||||
_controller(controller), _is_connected(false) , _is_disconnected(false), _apps(NULL) {
|
||||
// Init ISO7816
|
||||
nfc_tech_iso7816_init(&_iso7816, _controller->transceiver(), &Type4RemoteInitiator::s_disconnected_callback, this);
|
||||
|
|
|
|||
Loading…
Reference in New Issue