@@ -33,21 +33,21 @@ DfuService::DfuService(Pinetime::System::SystemTask& systemTask,
3333 bleController {bleController},
3434 dfuImage {spiNorFlash},
3535 characteristicDefinition {{
36- .uuid = ( ble_uuid_t *) &packetCharacteristicUuid,
36+ .uuid = &packetCharacteristicUuid. u ,
3737 .access_cb = DfuServiceCallback,
3838 .arg = this ,
3939 .flags = BLE_GATT_CHR_F_WRITE_NO_RSP,
4040 .val_handle = nullptr ,
4141 },
4242 {
43- .uuid = ( ble_uuid_t *) &controlPointCharacteristicUuid,
43+ .uuid = &controlPointCharacteristicUuid. u ,
4444 .access_cb = DfuServiceCallback,
4545 .arg = this ,
4646 .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_NOTIFY,
4747 .val_handle = nullptr ,
4848 },
4949 {
50- .uuid = ( ble_uuid_t *) &revisionCharacteristicUuid,
50+ .uuid = &revisionCharacteristicUuid. u ,
5151 .access_cb = DfuServiceCallback,
5252 .arg = this ,
5353 .flags = BLE_GATT_CHR_F_READ,
@@ -60,7 +60,7 @@ DfuService::DfuService(Pinetime::System::SystemTask& systemTask,
6060 serviceDefinition {
6161 {/* Device Information Service */
6262 .type = BLE_GATT_SVC_TYPE_PRIMARY,
63- .uuid = ( ble_uuid_t *) &serviceUuid,
63+ .uuid = &serviceUuid. u ,
6464 .characteristics = characteristicDefinition},
6565 {0 },
6666 } {
@@ -81,9 +81,9 @@ int DfuService::OnServiceData(uint16_t connectionHandle, uint16_t attributeHandl
8181 xTimerStart (timeoutTimer, 0 );
8282 }
8383
84- ble_gatts_find_chr (( ble_uuid_t *) &serviceUuid, ( ble_uuid_t *) &packetCharacteristicUuid, nullptr , &packetCharacteristicHandle);
85- ble_gatts_find_chr (( ble_uuid_t *) &serviceUuid, ( ble_uuid_t *) &controlPointCharacteristicUuid, nullptr , &controlPointCharacteristicHandle);
86- ble_gatts_find_chr (( ble_uuid_t *) &serviceUuid, ( ble_uuid_t *) &revisionCharacteristicUuid, nullptr , &revisionCharacteristicHandle);
84+ ble_gatts_find_chr (&serviceUuid. u , &packetCharacteristicUuid. u , nullptr , &packetCharacteristicHandle);
85+ ble_gatts_find_chr (&serviceUuid. u , &controlPointCharacteristicUuid. u , nullptr , &controlPointCharacteristicHandle);
86+ ble_gatts_find_chr (&serviceUuid. u , &revisionCharacteristicUuid. u , nullptr , &revisionCharacteristicHandle);
8787
8888 if (attributeHandle == packetCharacteristicHandle) {
8989 if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR)
@@ -164,10 +164,10 @@ int DfuService::WritePacketHandler(uint16_t connectionHandle, os_mbuf* om) {
164164
165165 if ((nbPacketReceived % nbPacketsToNotify) == 0 && bytesReceived != applicationSize) {
166166 uint8_t data[5 ] {static_cast <uint8_t >(Opcodes::PacketReceiptNotification),
167- (uint8_t ) (bytesReceived & 0x000000FFu ),
168- (uint8_t ) (bytesReceived >> 8u ),
169- (uint8_t ) (bytesReceived >> 16u ),
170- (uint8_t ) (bytesReceived >> 24u )};
167+ (uint8_t )(bytesReceived & 0x000000FFu ),
168+ (uint8_t )(bytesReceived >> 8u ),
169+ (uint8_t )(bytesReceived >> 16u ),
170+ (uint8_t )(bytesReceived >> 24u )};
171171 NRF_LOG_INFO (" [DFU] -> Send packet notification: %d bytes received" , bytesReceived);
172172 notificationManager.Send (connectionHandle, controlPointCharacteristicHandle, data, 5 );
173173 }
@@ -422,9 +422,9 @@ uint16_t DfuService::DfuImage::ComputeCrc(uint8_t const* p_data, uint32_t size,
422422 uint16_t crc = (p_crc == NULL ) ? 0xFFFF : *p_crc;
423423
424424 for (uint32_t i = 0 ; i < size; i++) {
425- crc = (uint8_t ) (crc >> 8 ) | (crc << 8 );
425+ crc = (uint8_t )(crc >> 8 ) | (crc << 8 );
426426 crc ^= p_data[i];
427- crc ^= (uint8_t ) (crc & 0xFF ) >> 4 ;
427+ crc ^= (uint8_t )(crc & 0xFF ) >> 4 ;
428428 crc ^= (crc << 8 ) << 4 ;
429429 crc ^= ((crc & 0xFF ) << 4 ) << 1 ;
430430 }
0 commit comments