File tree Expand file tree Collapse file tree 1 file changed +17
-17
lines changed
connectivity/FEATURE_BLE/libraries/ble-api-implementation/source Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -991,6 +991,23 @@ uint8_t GattServer::atts_write_cb(
991991{
992992 uint8_t err;
993993
994+ GattCharacteristic* auth_char = getInstance ().get_auth_char (handle);
995+ if (auth_char && auth_char->isWriteAuthorizationEnabled ()) {
996+ GattWriteAuthCallbackParams write_auth_params = {
997+ connId,
998+ handle,
999+ offset,
1000+ len,
1001+ pValue,
1002+ AUTH_CALLBACK_REPLY_SUCCESS
1003+ };
1004+
1005+ GattAuthCallbackReply_t ret = auth_char->authorizeWrite (&write_auth_params);
1006+ if (ret!= AUTH_CALLBACK_REPLY_SUCCESS) {
1007+ return ret & 0xFF ;
1008+ }
1009+ }
1010+
9941011 /* we don't write anything during the prepare phase */
9951012 bool write_happened = (operation != ATT_PDU_PREP_WRITE_REQ);
9961013
@@ -1039,23 +1056,6 @@ uint8_t GattServer::atts_write_cb(
10391056 break ;
10401057 }
10411058
1042- GattCharacteristic* auth_char = getInstance ().get_auth_char (handle);
1043- if (auth_char && auth_char->isWriteAuthorizationEnabled ()) {
1044- GattWriteAuthCallbackParams write_auth_params = {
1045- connId,
1046- handle,
1047- offset,
1048- len,
1049- pValue,
1050- AUTH_CALLBACK_REPLY_SUCCESS
1051- };
1052-
1053- GattAuthCallbackReply_t ret = auth_char->authorizeWrite (&write_auth_params);
1054- if (ret!= AUTH_CALLBACK_REPLY_SUCCESS) {
1055- return ret & 0xFF ;
1056- }
1057- }
1058-
10591059 if (write_happened) {
10601060 GattWriteCallbackParams write_params = {
10611061 connId,
You can’t perform that action at this time.
0 commit comments