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.
Dependents: Peripheral_1_serial_copy Peripheral_1_serial 151006_1st_Scenario_normal
Fork of BLE_API by
Diff: public/GattCharacteristic.h
- Revision:
- 567:e4b38e43de7c
- Parent:
- 546:9fdf3d960d12
- Child:
- 655:4dce7c6d2eb3
diff -r 6681c6e0d7c0 -r e4b38e43de7c public/GattCharacteristic.h
--- a/public/GattCharacteristic.h Fri Jun 19 15:52:11 2015 +0100
+++ b/public/GattCharacteristic.h Fri Jun 19 15:52:28 2015 +0100
@@ -18,9 +18,8 @@
#define __GATT_CHARACTERISTIC_H__
#include "Gap.h"
-#include "SecurityManager.h"
#include "GattAttribute.h"
-#include "GattCallbackParamTypes.h"
+#include "GattCharacteristicCallbackParams.h"
#include "FunctionPointerWithContext.h"
class GattCharacteristic {
@@ -332,7 +331,7 @@
unsigned numDescriptors = 0) :
_valueAttribute(uuid, valuePtr, initialLen, maxLen),
_properties(props),
- _requiredSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK),
+ _requiredSecurity(Gap::SECURITY_MODE_ENCRYPTION_OPEN_LINK),
_descriptors(descriptors),
_descriptorCount(numDescriptors),
enabledReadAuthorization(false),
@@ -348,7 +347,7 @@
*
* @param securityMode Can be one of encryption or signing, with or without protection for MITM (man in the middle attacks).
*/
- void requireSecurity(SecurityManager::SecurityMode_t securityMode) {
+ void requireSecurity(Gap::SecurityMode_t securityMode) {
_requiredSecurity = securityMode;
}
@@ -356,21 +355,21 @@
/**
* Authorization.
*/
- void setWriteAuthorizationCallback(void (*callback)(GattWriteAuthCallbackParams *)) {
+ void setWriteAuthorizationCallback(void (*callback)(GattCharacteristicWriteAuthCBParams *)) {
writeAuthorizationCallback.attach(callback);
enabledWriteAuthorization = true;
}
template <typename T>
- void setWriteAuthorizationCallback(T *object, void (T::*member)(GattWriteAuthCallbackParams *)) {
+ void setWriteAuthorizationCallback(T *object, void (T::*member)(GattCharacteristicWriteAuthCBParams *)) {
writeAuthorizationCallback.attach(object, member);
enabledWriteAuthorization = true;
}
- void setReadAuthorizationCallback(void (*callback)(GattReadAuthCallbackParams *)) {
+ void setReadAuthorizationCallback(void (*callback)(GattCharacteristicReadAuthCBParams *)) {
readAuthorizationCallback.attach(callback);
enabledReadAuthorization = true;
}
template <typename T>
- void setReadAuthorizationCallback(T *object, void (T::*member)(GattReadAuthCallbackParams *)) {
+ void setReadAuthorizationCallback(T *object, void (T::*member)(GattCharacteristicReadAuthCBParams *)) {
readAuthorizationCallback.attach(object, member);
enabledReadAuthorization = true;
}
@@ -381,7 +380,7 @@
* @param params to capture the context of the write-auth request; and also contains an out-parameter for reply.
* @return true if the write is authorized to proceed.
*/
- GattAuthCallbackReply_t authorizeWrite(GattWriteAuthCallbackParams *params) {
+ GattCharacteristicAuthCBReply_t authorizeWrite(GattCharacteristicWriteAuthCBParams *params) {
if (!isWriteAuthorizationEnabled()) {
return AUTH_CALLBACK_REPLY_SUCCESS;
}
@@ -407,7 +406,7 @@
*
* @return true if the read is authorized to proceed.
*/
- GattAuthCallbackReply_t authorizeRead(GattReadAuthCallbackParams *params) {
+ GattCharacteristicAuthCBReply_t authorizeRead(GattCharacteristicReadAuthCBParams *params) {
if (!isReadAuthorizationEnabled()) {
return AUTH_CALLBACK_REPLY_SUCCESS;
}
@@ -423,7 +422,7 @@
const GattAttribute& getValueAttribute() const {return _valueAttribute; }
GattAttribute::Handle_t getValueHandle(void) const {return getValueAttribute().getHandle();}
uint8_t getProperties(void) const {return _properties; }
- SecurityManager::SecurityMode_t getRequiredSecurity() const {return _requiredSecurity; }
+ Gap::SecurityMode_t getRequiredSecurity() const {return _requiredSecurity; }
uint8_t getDescriptorCount(void) const {return _descriptorCount; }
bool isReadAuthorizationEnabled() const {return enabledReadAuthorization; }
bool isWriteAuthorizationEnabled() const {return enabledWriteAuthorization; }
@@ -437,16 +436,16 @@
}
private:
- GattAttribute _valueAttribute;
- uint8_t _properties;
- SecurityManager::SecurityMode_t _requiredSecurity;
- GattAttribute **_descriptors;
- uint8_t _descriptorCount;
+ GattAttribute _valueAttribute;
+ uint8_t _properties;
+ Gap::SecurityMode_t _requiredSecurity;
+ GattAttribute **_descriptors;
+ uint8_t _descriptorCount;
bool enabledReadAuthorization;
bool enabledWriteAuthorization;
- FunctionPointerWithContext<GattReadAuthCallbackParams *> readAuthorizationCallback;
- FunctionPointerWithContext<GattWriteAuthCallbackParams *> writeAuthorizationCallback;
+ FunctionPointerWithContext<GattCharacteristicReadAuthCBParams *> readAuthorizationCallback;
+ FunctionPointerWithContext<GattCharacteristicWriteAuthCBParams *> writeAuthorizationCallback;
private:
/* disallow copy and assignment */
