@@ -55,14 +55,14 @@ enum procedure_type_t {
55
55
/*
56
56
* Base class for a procedure control block
57
57
*/
58
- struct GenericGattClient ::procedure_control_block_t {
58
+ struct GenericGattClient ::ProcedureControlBlock {
59
59
/*
60
60
* Base constructor for procedure control block.
61
61
*/
62
- procedure_control_block_t (procedure_type_t type, Gap::Handle_t handle) :
62
+ ProcedureControlBlock (procedure_type_t type, Gap::Handle_t handle) :
63
63
type (type), connection_handle(handle), next(NULL ) { }
64
64
65
- virtual ~procedure_control_block_t () { }
65
+ virtual ~ProcedureControlBlock () { }
66
66
67
67
/*
68
68
* Entry point of the control block stack machine.
@@ -76,21 +76,21 @@ struct GenericGattClient::procedure_control_block_t {
76
76
77
77
procedure_type_t type;
78
78
Gap::Handle_t connection_handle;
79
- procedure_control_block_t * next;
79
+ ProcedureControlBlock * next;
80
80
};
81
81
82
82
83
83
/*
84
84
* Procedure control block for the discovery process.
85
85
*/
86
- struct GenericGattClient ::discovery_control_block_t : public procedure_control_block_t {
87
- discovery_control_block_t (
86
+ struct GenericGattClient ::DiscoveryControlBlock : public ProcedureControlBlock {
87
+ DiscoveryControlBlock (
88
88
Gap::Handle_t handle,
89
89
ServiceDiscovery::ServiceCallback_t service_callback,
90
90
ServiceDiscovery::CharacteristicCallback_t characteristic_callback,
91
91
UUID matching_service_uuid,
92
92
UUID matching_characteristic_uuid
93
- ) : procedure_control_block_t (COMPLETE_DISCOVERY_PROCEDURE, handle),
93
+ ) : ProcedureControlBlock (COMPLETE_DISCOVERY_PROCEDURE, handle),
94
94
service_callback (service_callback),
95
95
characteristic_callback(characteristic_callback),
96
96
matching_service_uuid(matching_service_uuid),
@@ -99,7 +99,7 @@ struct GenericGattClient::discovery_control_block_t : public procedure_control_b
99
99
done(false ) {
100
100
}
101
101
102
- virtual ~discovery_control_block_t () {
102
+ virtual ~DiscoveryControlBlock () {
103
103
while (services_discovered) {
104
104
service_t * tmp = services_discovered->next ;
105
105
delete services_discovered;
@@ -409,15 +409,15 @@ struct GenericGattClient::discovery_control_block_t : public procedure_control_b
409
409
};
410
410
411
411
412
- struct GenericGattClient ::read_control_block_t : public procedure_control_block_t {
413
- read_control_block_t (
412
+ struct GenericGattClient ::ReadControlBlock : public ProcedureControlBlock {
413
+ ReadControlBlock (
414
414
Gap::Handle_t connection_handle, uint16_t attribute_handle, uint16_t offset
415
- ) : procedure_control_block_t (READ_PROCEDURE, connection_handle),
415
+ ) : ProcedureControlBlock (READ_PROCEDURE, connection_handle),
416
416
attribute_handle (attribute_handle),
417
417
offset(offset), current_offset(offset), data(NULL ) {
418
418
}
419
419
420
- virtual ~read_control_block_t () {
420
+ virtual ~ReadControlBlock () {
421
421
if (data != NULL ) {
422
422
free (data);
423
423
}
@@ -593,16 +593,16 @@ struct GenericGattClient::read_control_block_t : public procedure_control_block_
593
593
/*
594
594
* Control block for the write process
595
595
*/
596
- struct GenericGattClient ::write_control_block_t : public procedure_control_block_t {
597
- write_control_block_t (
596
+ struct GenericGattClient ::WriteControlBlock : public ProcedureControlBlock {
597
+ WriteControlBlock (
598
598
Gap::Handle_t connection_handle, uint16_t attribute_handle,
599
599
uint8_t * data, uint16_t len
600
- ) : procedure_control_block_t (WRITE_PROCEDURE, connection_handle),
600
+ ) : ProcedureControlBlock (WRITE_PROCEDURE, connection_handle),
601
601
attribute_handle (attribute_handle), len(len), offset(0 ), data(data),
602
602
prepare_success(false ), status(BLE_ERROR_UNSPECIFIED), error_code(0xFF ) {
603
603
}
604
604
605
- virtual ~write_control_block_t () {
605
+ virtual ~WriteControlBlock () {
606
606
free (data);
607
607
}
608
608
@@ -785,20 +785,20 @@ struct GenericGattClient::write_control_block_t : public procedure_control_block
785
785
/*
786
786
* Control block for the descriptor discovery process
787
787
*/
788
- struct GenericGattClient ::descriptor_discovery_control_block_t : public procedure_control_block_t {
789
- descriptor_discovery_control_block_t (
788
+ struct GenericGattClient ::DescriptorDiscoveryControlBlock : public ProcedureControlBlock {
789
+ DescriptorDiscoveryControlBlock (
790
790
const DiscoveredCharacteristic& characteristic,
791
791
const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback,
792
792
const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback
793
- ) : procedure_control_block_t (DESCRIPTOR_DISCOVERY_PROCEDURE, characteristic.getConnectionHandle()),
793
+ ) : ProcedureControlBlock (DESCRIPTOR_DISCOVERY_PROCEDURE, characteristic.getConnectionHandle()),
794
794
characteristic (characteristic),
795
795
discovery_cb(discoveryCallback),
796
796
termination_cb(terminationCallback),
797
797
next_handle(characteristic.getValueHandle() + 1),
798
798
done(false ) {
799
799
}
800
800
801
- virtual ~descriptor_discovery_control_block_t () { }
801
+ virtual ~DescriptorDiscoveryControlBlock () { }
802
802
803
803
ble_error_t start (GenericGattClient* client) {
804
804
return client->_pal_client ->discover_characteristics_descriptors (
@@ -919,7 +919,7 @@ ble_error_t GenericGattClient::launchServiceDiscovery(
919
919
return BLE_ERROR_NONE;
920
920
}
921
921
922
- discovery_control_block_t * discovery_pcb = new (std::nothrow) discovery_control_block_t (
922
+ DiscoveryControlBlock * discovery_pcb = new (std::nothrow) DiscoveryControlBlock (
923
923
connection_handle,
924
924
service_callback,
925
925
characteristic_callback,
@@ -959,7 +959,7 @@ ble_error_t GenericGattClient::launchServiceDiscovery(
959
959
}
960
960
961
961
bool GenericGattClient::isServiceDiscoveryActive () const {
962
- procedure_control_block_t * pcb = control_blocks;
962
+ ProcedureControlBlock * pcb = control_blocks;
963
963
964
964
while (pcb) {
965
965
if (pcb->type == COMPLETE_DISCOVERY_PROCEDURE) {
@@ -973,10 +973,10 @@ bool GenericGattClient::isServiceDiscoveryActive() const {
973
973
974
974
void GenericGattClient::terminateServiceDiscovery ()
975
975
{
976
- procedure_control_block_t * pcb = control_blocks;
976
+ ProcedureControlBlock * pcb = control_blocks;
977
977
while (pcb) {
978
978
if (pcb->type == COMPLETE_DISCOVERY_PROCEDURE) {
979
- static_cast <discovery_control_block_t *>(pcb)->done = true ;
979
+ static_cast <DiscoveryControlBlock *>(pcb)->done = true ;
980
980
}
981
981
pcb = pcb->next ;
982
982
}
@@ -992,7 +992,7 @@ ble_error_t GenericGattClient::read(
992
992
return BLE_ERROR_INVALID_STATE;
993
993
}
994
994
995
- read_control_block_t * read_pcb = new (std::nothrow) read_control_block_t (
995
+ ReadControlBlock * read_pcb = new (std::nothrow) ReadControlBlock (
996
996
connection_handle,
997
997
attribute_handle,
998
998
offset
@@ -1058,7 +1058,7 @@ ble_error_t GenericGattClient::write(
1058
1058
memcpy (data, value, length);
1059
1059
}
1060
1060
1061
- write_control_block_t * write_pcb = new (std::nothrow) write_control_block_t (
1061
+ WriteControlBlock * write_pcb = new (std::nothrow) WriteControlBlock (
1062
1062
connection_handle,
1063
1063
attribute_handle,
1064
1064
data,
@@ -1126,8 +1126,8 @@ ble_error_t GenericGattClient::discoverCharacteristicDescriptors(
1126
1126
return BLE_ERROR_NONE;
1127
1127
}
1128
1128
1129
- descriptor_discovery_control_block_t * discovery_pcb =
1130
- new (std::nothrow) descriptor_discovery_control_block_t (
1129
+ DescriptorDiscoveryControlBlock * discovery_pcb =
1130
+ new (std::nothrow) DescriptorDiscoveryControlBlock (
1131
1131
characteristic,
1132
1132
discoveryCallback,
1133
1133
terminationCallback
@@ -1152,11 +1152,11 @@ ble_error_t GenericGattClient::discoverCharacteristicDescriptors(
1152
1152
bool GenericGattClient::isCharacteristicDescriptorDiscoveryActive (
1153
1153
const DiscoveredCharacteristic& characteristic
1154
1154
) const {
1155
- procedure_control_block_t * pcb = control_blocks;
1155
+ ProcedureControlBlock * pcb = control_blocks;
1156
1156
1157
1157
while (pcb) {
1158
1158
if (pcb->type == DESCRIPTOR_DISCOVERY_PROCEDURE &&
1159
- static_cast <descriptor_discovery_control_block_t *>(pcb)->characteristic == characteristic) {
1159
+ static_cast <DescriptorDiscoveryControlBlock *>(pcb)->characteristic == characteristic) {
1160
1160
return true ;
1161
1161
}
1162
1162
pcb = pcb->next ;
@@ -1168,12 +1168,12 @@ bool GenericGattClient::isCharacteristicDescriptorDiscoveryActive(
1168
1168
void GenericGattClient::terminateCharacteristicDescriptorDiscovery (
1169
1169
const DiscoveredCharacteristic& characteristic
1170
1170
) {
1171
- procedure_control_block_t * pcb = control_blocks;
1171
+ ProcedureControlBlock * pcb = control_blocks;
1172
1172
1173
1173
while (pcb) {
1174
1174
if (pcb->type == DESCRIPTOR_DISCOVERY_PROCEDURE) {
1175
- descriptor_discovery_control_block_t * dpcb =
1176
- static_cast <descriptor_discovery_control_block_t *>(pcb);
1175
+ DescriptorDiscoveryControlBlock * dpcb =
1176
+ static_cast <DescriptorDiscoveryControlBlock *>(pcb);
1177
1177
if (dpcb->characteristic == characteristic) {
1178
1178
dpcb->done = true ;
1179
1179
return ;
@@ -1230,7 +1230,7 @@ void GenericGattClient::on_server_response(
1230
1230
connection_handle_t connection,
1231
1231
const AttServerMessage& message
1232
1232
) {
1233
- procedure_control_block_t * pcb = get_control_block (connection);
1233
+ ProcedureControlBlock * pcb = get_control_block (connection);
1234
1234
if (pcb == NULL ) {
1235
1235
return ;
1236
1236
}
@@ -1270,44 +1270,44 @@ void GenericGattClient::on_server_event(connection_handle_t connection, const At
1270
1270
}
1271
1271
1272
1272
void GenericGattClient::on_transaction_timeout (connection_handle_t connection) {
1273
- procedure_control_block_t * pcb = get_control_block (connection);
1273
+ ProcedureControlBlock * pcb = get_control_block (connection);
1274
1274
if (pcb == NULL ) {
1275
1275
return ;
1276
1276
}
1277
1277
1278
1278
pcb->handle_timeout_error (this );
1279
1279
}
1280
1280
1281
- GenericGattClient::procedure_control_block_t * GenericGattClient::get_control_block (Gap::Handle_t connection) {
1282
- procedure_control_block_t * it = control_blocks;
1281
+ GenericGattClient::ProcedureControlBlock * GenericGattClient::get_control_block (Gap::Handle_t connection) {
1282
+ ProcedureControlBlock * it = control_blocks;
1283
1283
while (it && it->connection_handle != connection) {
1284
1284
it = it->next ;
1285
1285
}
1286
1286
return it;
1287
1287
}
1288
1288
1289
- const GenericGattClient::procedure_control_block_t * GenericGattClient::get_control_block (Gap::Handle_t connection) const {
1290
- procedure_control_block_t * it = control_blocks;
1289
+ const GenericGattClient::ProcedureControlBlock * GenericGattClient::get_control_block (Gap::Handle_t connection) const {
1290
+ ProcedureControlBlock * it = control_blocks;
1291
1291
while (it && it->connection_handle != connection) {
1292
1292
it = it->next ;
1293
1293
}
1294
1294
return it;
1295
1295
}
1296
1296
1297
- void GenericGattClient::insert_control_block (procedure_control_block_t * cb) const {
1297
+ void GenericGattClient::insert_control_block (ProcedureControlBlock * cb) const {
1298
1298
if (control_blocks == NULL ) {
1299
1299
control_blocks = cb;
1300
1300
return ;
1301
1301
}
1302
1302
1303
- procedure_control_block_t * current = control_blocks;
1303
+ ProcedureControlBlock * current = control_blocks;
1304
1304
while (current->next ) {
1305
1305
current = current->next ;
1306
1306
}
1307
1307
current->next = cb;
1308
1308
}
1309
1309
1310
- void GenericGattClient::remove_control_block (procedure_control_block_t * cb) const {
1310
+ void GenericGattClient::remove_control_block (ProcedureControlBlock * cb) const {
1311
1311
if (control_blocks == NULL ) {
1312
1312
return ;
1313
1313
}
@@ -1317,7 +1317,7 @@ void GenericGattClient::remove_control_block(procedure_control_block_t* cb) cons
1317
1317
return ;
1318
1318
}
1319
1319
1320
- procedure_control_block_t * current = control_blocks;
1320
+ ProcedureControlBlock * current = control_blocks;
1321
1321
while (current->next && current->next != cb) {
1322
1322
current = current->next ;
1323
1323
}
0 commit comments