callbacks allow updates

pull/6188/head
paul-szczepanek-arm 2018-01-15 11:45:52 +00:00
parent 145fcc5791
commit 2f49b66c52
2 changed files with 23 additions and 12 deletions
features/FEATURE_BLE

View File

@ -103,7 +103,7 @@ class SecurityManagerEventHandler {
virtual void security_setup_initiated(connection_handle_t handle, bool allow_bonding,
bool require_mitm, SecurityIOCapabilities_t iocaps) {
if (_app_event_handler) {
_app_event_handler->securitySetupInitiated(handle, allowBonding, requireMITM, iocaps);
_app_event_handler->securitySetupInitiated(handle, allow_bonding, require_mitm, iocaps);
}
}
virtual void security_setup_completed(connection_handle_t handle,
@ -114,7 +114,7 @@ class SecurityManagerEventHandler {
}
virtual void link_secured(connection_handle_t handle, SecurityManager::SecurityMode_t security_mode) {
if (_app_event_handler) {
_app_event_handler->linkSecured(handle, securityMode);
_app_event_handler->linkSecured(handle, security_mode);
}
}

View File

@ -49,23 +49,34 @@ struct SecurityEntry_t {
bool connected;
};
class SecurityDB {
enum DbCbAction_t {
DB_CB_ACTION_UPDATE,
DB_CB_ACTION_NO_UPDATE_REQUIRED, /* does not guarantee discarding changes if you made any */
DB_CB_ACTION_REMOVE
};
typedef mbed::Callback<DbCbAction_t(SecurityEntry_t&)> SecurityEntryDbCb_t;
typedef mbed::Callback<DbCbAction_t(Gap::Whitelist_t&)> WhitelistDbCb_t;
class SecurityDb {
public:
SecurityDB() {};
~SecurityDB() {};
SecurityDb() {};
~SecurityDb() {};
void update_entry(SecurityEntry_t*);
void get_entry(SecurityEntryDbCb_t cb, ediv_t ediv, rand_t rand);
void get_entry(SecurityEntryDbCb_t cb, address_t identity_address);
void get_entry(SecurityEntryDbCb_t cb, connection_handle_t handle);
void get_entry(Callback<void(SecurityEntry_t*)> cb, ediv_t ediv, rand_t rand);
void update_entry(SecurityEntry_t&);
void remove_entry(SecurityEntry_t&);
void clear_entries(SecurityEntry_t&);
void get_entry(Callback<void(SecurityEntry_t*)> cb, address_t identity_address);
void get_whitelist(WhitelistDbCb_t cb);
void get_entry(Callback<void(SecurityEntry_t*)> cb, connection_handle_t handle);
void get_whitelist(Callback<void(Gap::Whitelist_t*)> cb);
void update_whitelist(Gap::Whitelist_t*);
void update_whitelist(Gap::Whitelist_t&);
void add_whitelist_entry(address_t);
void remove_whitelist_entry(address_t);
void clear_whitelist();
private:
};