compiler errors fixed after the merge

pull/6188/head
paul-szczepanek-arm 2018-02-19 16:28:01 +00:00
parent 8cf7b3b06f
commit ecacbda507
7 changed files with 29 additions and 26 deletions

View File

@ -370,11 +370,11 @@ struct address_t : public octet_type_t<6> {
} }
/** /**
* Initialize a mac address from an array of bytes. * Initialize a data from an array of bytes.
* *
* @param input_value value of the MAC address. * @param input_value value of the data.
*/ */
address_t(const uint8_t (&input_value)[6]) { address_t(const uint8_t *input_value) {
memcpy(_value, input_value, sizeof(_value)); memcpy(_value, input_value, sizeof(_value));
} }
@ -386,7 +386,7 @@ struct address_t : public octet_type_t<6> {
* *
* @param tag Tag used to select this constructor. The value does not matter. * @param tag Tag used to select this constructor. The value does not matter.
*/ */
address_t(const uint8_t* input_value, bool tag) { address_t(const uint8_t *input_value, bool tag) {
memcpy(_value, input_value, sizeof(_value)); memcpy(_value, input_value, sizeof(_value));
} }
}; };

View File

@ -32,6 +32,7 @@
namespace ble { namespace ble {
class ConnectionEventHandler { class ConnectionEventHandler {
public:
virtual void on_connected( virtual void on_connected(
connection_handle_t connection, connection_handle_t connection,
Gap::Role_t role, Gap::Role_t role,
@ -42,20 +43,21 @@ class ConnectionEventHandler {
const Gap::ConnectionParams_t *connection_params const Gap::ConnectionParams_t *connection_params
) = 0; ) = 0;
void on_disconnected( virtual void on_disconnected(
connection_handle_t connection, connection_handle_t connection,
Gap::DisconnectionReason_t reason Gap::DisconnectionReason_t reason
) = 0; ) = 0;
}; };
class ConnectionEventMonitor { class ConnectionEventMonitor {
public:
/** /**
* Register a handler for connection events to be used internally and serviced first. * Register a handler for connection events to be used internally and serviced first.
* *
* @param[in] connection_event_handler Event handler being registered. * @param[in] connection_event_handler Event handler being registered.
*/ */
void set_connection_event_handler(ConnectionEventHandler *connection_event_handler) = 0; virtual void set_connection_event_handler(ConnectionEventHandler *connection_event_handler) = 0;
} };
} }

View File

@ -272,6 +272,11 @@ public:
DisconnectionReason_t reason DisconnectionReason_t reason
); );
/** @note Implements ConnectionEventMonitor.
* @copydoc ConnectionEventMonitor::set_connection_event_handler
*/
virtual void set_connection_event_handler(ConnectionEventHandler *_connection_event_handler);
private: private:
void on_scan_timeout(); void on_scan_timeout();
@ -301,9 +306,6 @@ private:
bool initialize_whitelist() const; bool initialize_whitelist() const;
/** implements ConnectionEventMonitor */
void set_connection_event_handler(ConnectionEventHandler *_connection_event_handler);
pal::EventQueue& _event_queue; pal::EventQueue& _event_queue;
pal::Gap &_pal_gap; pal::Gap &_pal_gap;
pal::GenericAccessService &_gap_service; pal::GenericAccessService &_gap_service;

View File

@ -390,7 +390,7 @@ private:
* @param[in] peer_address Address of the connected device. * @param[in] peer_address Address of the connected device.
* @return BLE_ERROR_NONE or appropriate error code indicating the failure reason. * @return BLE_ERROR_NONE or appropriate error code indicating the failure reason.
*/ */
void on_connected( virtual void on_connected(
connection_handle_t connection, connection_handle_t connection,
Gap::Role_t role, Gap::Role_t role,
BLEProtocol::AddressType_t peer_address_type, BLEProtocol::AddressType_t peer_address_type,
@ -407,7 +407,7 @@ private:
* @param[in] connectionHandle Handle to identify the connection. * @param[in] connectionHandle Handle to identify the connection.
* @return BLE_ERROR_NONE or appropriate error code indicating the failure reason. * @return BLE_ERROR_NONE or appropriate error code indicating the failure reason.
*/ */
void on_disconnected( virtual void on_disconnected(
connection_handle_t connection, connection_handle_t connection,
Gap::DisconnectionReason_t reason Gap::DisconnectionReason_t reason
); );

View File

@ -18,6 +18,7 @@
#define PAL_MEMORY_SECURITY_MANAGER_DB_H__ #define PAL_MEMORY_SECURITY_MANAGER_DB_H__
#include "SecurityDB.h" #include "SecurityDB.h"
#include "Gap.h"
namespace ble { namespace ble {
namespace pal { namespace pal {
@ -341,12 +342,12 @@ public:
_local_csrk = csrk_t(); _local_csrk = csrk_t();
} }
virtual void get_whitelist(WhitelistDbCb_t cb, Gap::Whitelist_t *whitelist) { virtual void get_whitelist(WhitelistDbCb_t cb, ::Gap::Whitelist_t *whitelist) {
/*TODO: fill whitelist*/ /*TODO: fill whitelist*/
cb(whitelist); cb(whitelist);
} }
virtual void generate_whitelist_from_bond_table(WhitelistDbCb_t cb, Gap::Whitelist_t *whitelist) { virtual void generate_whitelist_from_bond_table(WhitelistDbCb_t cb, ::Gap::Whitelist_t *whitelist) {
for (size_t i = 0; i < MAX_ENTRIES && i < whitelist->capacity; i++) { for (size_t i = 0; i < MAX_ENTRIES && i < whitelist->capacity; i++) {
if (_db[i].entry.peer_address_is_public) { if (_db[i].entry.peer_address_is_public) {
whitelist->addresses[i].type = BLEProtocol::AddressType::PUBLIC; whitelist->addresses[i].type = BLEProtocol::AddressType::PUBLIC;
@ -364,9 +365,9 @@ public:
cb(whitelist); cb(whitelist);
} }
virtual void update_whitelist(Gap::Whitelist_t &whitelist) { } virtual void update_whitelist(::Gap::Whitelist_t &whitelist) { }
virtual void set_whitelist(const Gap::Whitelist_t &whitelist) { }; virtual void set_whitelist(const ::Gap::Whitelist_t &whitelist) { };
virtual void add_whitelist_entry(const address_t &address) { } virtual void add_whitelist_entry(const address_t &address) { }

View File

@ -25,8 +25,6 @@
namespace ble { namespace ble {
namespace pal { namespace pal {
using pal::connection_peer_address_type_t;
/* separate structs for keys to allow db implementation /* separate structs for keys to allow db implementation
* to minimise memory usage, only holding live connection * to minimise memory usage, only holding live connection
* state in memory */ * state in memory */
@ -127,7 +125,7 @@ struct SecurityEntryIdentity_t {
typedef mbed::Callback<void(const SecurityEntry_t*, const SecurityEntryKeys_t*)> SecurityEntryKeysDbCb_t; typedef mbed::Callback<void(const SecurityEntry_t*, const SecurityEntryKeys_t*)> SecurityEntryKeysDbCb_t;
typedef mbed::Callback<void(connection_handle_t, const csrk_t*)> SecurityEntryCsrkDbCb_t; typedef mbed::Callback<void(connection_handle_t, const csrk_t*)> SecurityEntryCsrkDbCb_t;
typedef mbed::Callback<void(Gap::Whitelist_t*)> WhitelistDbCb_t; typedef mbed::Callback<void(::Gap::Whitelist_t*)> WhitelistDbCb_t;
/** /**
* SecurityDB holds the state for active connections and bonded devices. * SecurityDB holds the state for active connections and bonded devices.
@ -475,7 +473,7 @@ public:
*/ */
virtual void get_whitelist( virtual void get_whitelist(
WhitelistDbCb_t cb, WhitelistDbCb_t cb,
Gap::Whitelist_t *whitelist ::Gap::Whitelist_t *whitelist
) = 0; ) = 0;
/** /**
@ -488,7 +486,7 @@ public:
*/ */
virtual void generate_whitelist_from_bond_table( virtual void generate_whitelist_from_bond_table(
WhitelistDbCb_t cb, WhitelistDbCb_t cb,
Gap::Whitelist_t *whitelist ::Gap::Whitelist_t *whitelist
) = 0; ) = 0;
/** /**
@ -497,7 +495,7 @@ public:
* @param[in] whitelist * @param[in] whitelist
*/ */
virtual void set_whitelist( virtual void set_whitelist(
const Gap::Whitelist_t &whitelist const ::Gap::Whitelist_t &whitelist
) = 0; ) = 0;
/** /**

View File

@ -20,7 +20,7 @@
#include <stddef.h> #include <stddef.h>
#include "ble/generic/GenericSecurityManager.h" #include "ble/generic/GenericSecurityManager.h"
#include "ble/generic/GenericSecurityDb.h" #include "ble/pal/MemorySecurityDb.h"
#include "ble/generic/GenericGap.h" #include "ble/generic/GenericGap.h"
#include "ble/pal/PalSecurityManager.h" #include "ble/pal/PalSecurityManager.h"
#include "CordioPalSecurityManager.h" #include "CordioPalSecurityManager.h"
@ -36,16 +36,16 @@ class SecurityManager : public generic::GenericSecurityManager
public: public:
static SecurityManager &getInstance() static SecurityManager &getInstance()
{ {
static generic::MemoryGenericSecurityDb m_db; static pal::MemorySecurityDb m_db;
static pal::vendor::cordio::CordioSecurityManager m_pal; static pal::vendor::cordio::CordioSecurityManager m_pal;
static SecurityManager m_instance(m_pal, m_db, cordio::Gap::getInstance()); static SecurityManager m_instance(m_pal, m_db, *(reinterpret_cast<generic::GenericGap*>(&(cordio::Gap::getInstance()))));
return m_instance; return m_instance;
} }
public: public:
SecurityManager( SecurityManager(
pal::SecurityManager &palImpl, pal::SecurityManager &palImpl,
generic::GenericSecurityDb &dbImpl, pal::SecurityDb &dbImpl,
generic::GenericGap &gapImpl generic::GenericGap &gapImpl
) : generic::GenericSecurityManager(palImpl, dbImpl, gapImpl) { ) : generic::GenericSecurityManager(palImpl, dbImpl, gapImpl) {
/* empty */ /* empty */