Skip to content

Commit 0178fdf

Browse files
committedFeb 5, 2025·
Fix typos
The "codespell" spellchecker tool is used to automatically detect commonly misspelled words in the files of this project. The misspelled words dictionary was expanded in recent releases of codespell, which resulted in the detection of misspelled words in the project files: > Error: ./src/utility/HCI.cpp:761: Signalling ==> Signaling > Error: ./docs/readme.md:22: acknowledgement ==> acknowledgment The typos are hereby corrected, which will restore the spell check to a passing state. --- I supplemented the correction of the automatically detected typos with a general review of the project content, fixing the additional typos I identified during that review.
1 parent 5a53135 commit 0178fdf

File tree

12 files changed

+103
-145
lines changed

12 files changed

+103
-145
lines changed
 

Diff for: ‎CHANGELOG

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ArduinoBLE ?.?.? - ????.??.??
22

33
ArduinoBLE 1.1.2 - 2019.11.12
44

5-
* cordio: switch to lower power when polling with timeout
5+
* cordio: switch to lower power when polling with timeout
66
* Fixed issue with wrong types for disconnection event handling. Thanks @cparata
77

88
ArduinoBLE 1.1.1 - 2019.09.05

Diff for: ‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
[![Compile Examples Status](https://github.com/arduino-libraries/ArduinoBLE/workflows/Compile%20Examples/badge.svg)](https://github.com/arduino-libraries/ArduinoBLE/actions?workflow=Compile+Examples) [![Spell Check Status](https://github.com/arduino-libraries/ArduinoBLE/workflows/Spell%20Check/badge.svg)](https://github.com/arduino-libraries/ArduinoBLE/actions?workflow=Spell+Check)
44

5-
Enables Bluetooth® Low Energy connectivity on the Arduino MKR WiFi 1010, Arduino UNO WiFi Rev.2, Arduino Nano 33 IoT, Arduino Nano 33 BLE, Arduino Portenta H7, Arduino Giga R1 and Arduino UNO R4 WiFi.
5+
Enables Bluetooth® Low Energy connectivity on the Arduino MKR WiFi 1010, Arduino UNO WiFi Rev2, Arduino Nano 33 IoT, Arduino Nano 33 BLE, Arduino Portenta H7, Arduino Giga R1 and Arduino UNO R4 WiFi.
66

77
This library supports creating a Bluetooth® Low Energy peripheral & central mode.
88

9-
For the Arduino MKR WiFi 1010, Arduino UNO WiFi Rev.2, and Arduino Nano 33 IoT boards, it requires the NINA module to be running [Arduino NINA-W102 firmware](https://github.com/arduino/nina-fw) v1.2.0 or later.
9+
For the Arduino MKR WiFi 1010, Arduino UNO WiFi Rev2, and Arduino Nano 33 IoT boards, it requires the NINA module to be running [Arduino NINA-W102 firmware](https://github.com/arduino/nina-fw) v1.2.0 or later.
1010

1111
For the Arduino UNO R4 WiFi, it requires the ESP32-S3 module to be running [firmware](https://github.com/arduino/uno-r4-wifi-usb-bridge) v0.2.0 or later.
1212

Diff for: ‎docs/api.md

+51-92
Large diffs are not rendered by default.

Diff for: ‎docs/readme.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ArduinoBLE library
22

3-
This library supports all the Arduino boards that have the hardware enabled for Bluetooth® Low Energy and Bluetooth® 4.0 and above; these include Nano 33 BLE, Arduino NANO 33 IoT, Uno WiFi Rev 2, MKR WiFi 1010, Nicla Sense ME.
3+
This library supports all the Arduino boards that have the hardware enabled for Bluetooth® Low Energy and Bluetooth® 4.0 and above; these include Nano 33 BLE, Arduino NANO 33 IoT, Uno WiFi Rev2, MKR WiFi 1010, Nicla Sense ME.
44

55
To use this library
66
``#include <ArduinoBLE.h>``
@@ -9,7 +9,7 @@ To use this library
99

1010
Bluetooth® 4.0 includes both traditional Bluetooth®, now labeled "Bluetooth® Classic", and the Bluetooth® Low Energy. Bluetooth® Low Energy is optimized for low power use at low data rates, and was designed to operate from simple lithium coin cell batteries.
1111

12-
Unlike standard Bluetooth® communication basically based on an asynchronous serial connection (UART) a Bluetooth® LE radio acts like a community bulletin board. The computers that connect to it are like community members that read the bulletin board. Each radio acts as either the bulletin board or the reader. If your radio is a bulletin board (called a peripheral device in Bluetooth® LE parlance) it posts data for all radios in the community to read. If your radio is a reader (called a central device in Blueooth LE terms) it reads from any of the bulletin boards (peripheral devices) that have information about which it cares. You can also think of peripheral devices as the servers in a client-server transaction, because they contain the information that reader radios ask for. Similarly, central devices are the clients of the Bluetooth® LE world because they read information available from the peripherals.
12+
Unlike standard Bluetooth® communication basically based on an asynchronous serial connection (UART) a Bluetooth® LE radio acts like a community bulletin board. The computers that connect to it are like community members that read the bulletin board. Each radio acts as either the bulletin board or the reader. If your radio is a bulletin board (called a peripheral device in Bluetooth® LE parlance) it posts data for all radios in the community to read. If your radio is a reader (called a central device in Bluetooth LE terms) it reads from any of the bulletin boards (peripheral devices) that have information about which it cares. You can also think of peripheral devices as the servers in a client-server transaction, because they contain the information that reader radios ask for. Similarly, central devices are the clients of the Bluetooth® LE world because they read information available from the peripherals.
1313

1414
![Communication between central and peripheral devices](https://raw.githubusercontent.com/arduino-libraries/ArduinoBLE/master/docs/assets/ble-bulletin-board-model.png)
1515

@@ -19,7 +19,7 @@ The information presented by a peripheral is structured as **services**, each of
1919

2020
## Notify
2121

22-
The Bluetooth® LE specification includes a mechanism known as **notify** that lets you know when data's changed. When notify on a characteristic is enabled and the sender writes to it, the new value is automatically sent to the receiver, without the receiver explicitly issuing a read command. This is commonly used for streaming data such as accelerometer or other sensor readings. There's a variation on this specification called **indicate** which works similarly, but in the indicate specification, the reader sends an acknowledgement of the pushed data.
22+
The Bluetooth® LE specification includes a mechanism known as **notify** that lets you know when data's changed. When notify on a characteristic is enabled and the sender writes to it, the new value is automatically sent to the receiver, without the receiver explicitly issuing a read command. This is commonly used for streaming data such as accelerometer or other sensor readings. There's a variation on this specification called **indicate** which works similarly, but in the indicate specification, the reader sends an acknowledgment of the pushed data.
2323

2424
The client-server structure of Bluetooth® LE, combined with the notify characteristic, is generally called a **publish-and-subscribe model**.
2525

@@ -58,7 +58,7 @@ You could also combine readings into a single characteristic, when a given senso
5858
|Motor Speed, Direction|150,1|
5959
|Accelerometer X, Y, Z|200,133,150|
6060

61-
This is more efficient, but you need to be careful not to exceed the 512-byte limit. The accelerometer characteristic above, for example, takes 11 bytes as a ASCII-encoded string.
61+
This is more efficient, but you need to be careful not to exceed the 512-byte limit. The accelerometer characteristic above, for example, takes 11 bytes as an ASCII-encoded string.
6262

6363
## Read/write/notify/indicate
6464

Diff for: ‎examples/Central/SensorTagButton/SensorTagButton.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void monitorSensorTagButtons(BLEDevice peripheral) {
114114
if (simpleKeyCharacteristic.valueUpdated()) {
115115
// yes, get the value, characteristic is 1 byte so use byte value
116116
byte value = 0;
117-
117+
118118
simpleKeyCharacteristic.readValue(value);
119119

120120
if (value & 0x01) {

Diff for: ‎examples/Peripheral/Advertising/RawDataAdvertising/RawDataAdvertising.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ BLEService myService("fff0");
44
BLEIntCharacteristic myCharacteristic("fff1", BLERead | BLEBroadcast);
55

66
// Advertising parameters should have a global scope. Do NOT define them in 'setup' or in 'loop'
7-
const uint8_t completeRawAdvertisingData[] = {0x02,0x01,0x06,0x09,0xff,0x01,0x01,0x00,0x01,0x02,0x03,0x04,0x05};
7+
const uint8_t completeRawAdvertisingData[] = {0x02,0x01,0x06,0x09,0xff,0x01,0x01,0x00,0x01,0x02,0x03,0x04,0x05};
88

99
void setup() {
1010
Serial.begin(9600);
@@ -21,7 +21,7 @@ void setup() {
2121
// Build advertising data packet
2222
BLEAdvertisingData advData;
2323
// If a packet has a raw data parameter, then all the other parameters of the packet will be ignored
24-
advData.setRawData(completeRawAdvertisingData, sizeof(completeRawAdvertisingData));
24+
advData.setRawData(completeRawAdvertisingData, sizeof(completeRawAdvertisingData));
2525
// Copy set parameters in the actual advertising packet
2626
BLE.setAdvertisingData(advData);
2727

@@ -30,7 +30,7 @@ void setup() {
3030
scanData.setLocalName("Test advertising raw data");
3131
// Copy set parameters in the actual scan response packet
3232
BLE.setScanResponseData(scanData);
33-
33+
3434
BLE.advertise();
3535

3636
Serial.println("advertising ...");

Diff for: ‎examples/Peripheral/BatteryMonitor/BatteryMonitor.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ void loop() {
7373
// turn on the LED to indicate the connection:
7474
digitalWrite(LED_BUILTIN, HIGH);
7575

76-
// check the battery level every 200ms
76+
// check the battery level every 200 ms
7777
// while the central is connected:
7878
while (central.connected()) {
7979
long currentMillis = millis();
80-
// if 200ms have passed, check the battery level:
80+
// if 200 ms have passed, check the battery level:
8181
if (currentMillis - previousMillis >= 200) {
8282
previousMillis = currentMillis;
8383
updateBatteryLevel();

Diff for: ‎examples/Peripheral/CallbackLED/CallbackLED.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const int ledPin = LED_BUILTIN; // pin to use for the LED
2828
void setup() {
2929
Serial.begin(9600);
3030
while (!Serial);
31-
31+
3232
pinMode(ledPin, OUTPUT); // use the LED pin as an output
3333

3434
// begin initialization

Diff for: ‎examples/Peripheral/EncryptedBatteryMonitor/EncryptedBatteryMonitor.ino

+11-11
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void setup() {
5454

5555

5656
Serial.println("Serial connected");
57-
57+
5858
// Callback function with confirmation code when new device is pairing.
5959
BLE.setDisplayCode([](uint32_t confirmCode){
6060
Serial.println("New device pairing request.");
@@ -63,7 +63,7 @@ void setup() {
6363
sprintf(code, "%06d", confirmCode);
6464
Serial.println(code);
6565
});
66-
66+
6767
// Callback to allow accepting or rejecting pairing
6868
BLE.setBinaryConfirmPairing([&acceptOrReject](){
6969
Serial.print("Should we confirm pairing? ");
@@ -98,7 +98,7 @@ void setup() {
9898

9999

100100
(*BDaddrTypes)[0] = 0; // Type 0 is for pubc address, type 1 is for static random
101-
(*BDAddrs)[0] = new uint8_t[6];
101+
(*BDAddrs)[0] = new uint8_t[6];
102102
(*IRKs)[0] = new uint8_t[16];
103103
memcpy((*IRKs)[0] , device1IRK,16);
104104
memcpy((*BDAddrs)[0], device1Mac, 6);
@@ -124,7 +124,7 @@ void setup() {
124124
uint8_t device1LTK[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
125125
uint8_t device2Mac[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
126126
uint8_t device2LTK[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
127-
127+
128128

129129
if(memcmp(device1Mac, address, 6) == 0) {
130130
memcpy(LTK, device1LTK, 16);
@@ -159,7 +159,7 @@ void setup() {
159159
}
160160
Serial.println("BT init");
161161
delay(200);
162-
162+
163163
/* Set a local name for the BLE device
164164
This name will appear in advertising packets
165165
and can be used by remote devices to identify this BLE device
@@ -180,16 +180,16 @@ void setup() {
180180
stringCharValue = "string";
181181
stringcharacteristic.writeValue(stringCharValue);
182182
secretValue.writeValue(0);
183-
183+
184184
delay(1000);
185185

186186
// prevent pairing until button is pressed (will show a pairing rejected message)
187187
BLE.setPairable(false);
188-
188+
189189
/* Start advertising BLE. It will start continuously transmitting BLE
190190
advertising packets and will be visible to remote BLE central devices
191191
until it receives a new connection */
192-
192+
193193
// start advertising
194194
if(!BLE.advertise()){
195195
Serial.println("failed to advertise bluetooth.");
@@ -214,13 +214,13 @@ void loop() {
214214
if (!BLE.pairable() && digitalRead(PAIR_BUTTON) == LOW){
215215
pairingStarted = millis();
216216
BLE.setPairable(Pairable::ONCE);
217-
Serial.println("Accepting pairing for 30s");
217+
Serial.println("Accepting pairing for 30 s");
218218
} else if (BLE.pairable() && millis() > pairingStarted + PAIR_INTERVAL){
219219
BLE.setPairable(false);
220220
Serial.println("No longer accepting pairing");
221221
}
222222
// Make LED blink while pairing is allowed
223-
digitalWrite(PAIR_LED, (BLE.pairable() ? (millis()%400)<200 : BLE.paired()) ? PAIR_LED_ON : !PAIR_LED_ON);
223+
digitalWrite(PAIR_LED, (BLE.pairable() ? (millis()%400)<200 : BLE.paired()) ? PAIR_LED_ON : !PAIR_LED_ON);
224224

225225

226226
// if a central is connected to the peripheral:
@@ -246,7 +246,7 @@ void loop() {
246246
Serial.print("Disconnected from central: ");
247247
Serial.println(central.address());
248248
}
249-
249+
250250
}
251251

252252
void updateBatteryLevel() {

Diff for: ‎examples/Peripheral/LED/LED.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void setup() {
4848
// add service
4949
BLE.addService(ledService);
5050

51-
// set the initial value for the characeristic:
51+
// set the initial value for the characteristic:
5252
switchCharacteristic.writeValue(0);
5353

5454
// start advertising

Diff for: ‎library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name=ArduinoBLE
22
version=1.3.7
33
author=Arduino
44
maintainer=Arduino <info@arduino.cc>
5-
sentence=Enables Bluetooth® Low Energy connectivity on the Arduino MKR WiFi 1010, Arduino UNO WiFi Rev.2, Arduino Nano 33 IoT, Arduino Nano 33 BLE, Nicla Sense ME and UNO R4 WiFi.
5+
sentence=Enables Bluetooth® Low Energy connectivity on the Arduino MKR WiFi 1010, Arduino UNO WiFi Rev2, Arduino Nano 33 IoT, Arduino Nano 33 BLE, Nicla Sense ME and UNO R4 WiFi.
66
paragraph=This library supports creating a Bluetooth® Low Energy peripheral & central mode.
77
category=Communication
88
url=https://www.arduino.cc/en/Reference/ArduinoBLE

Diff for: ‎src/utility/HCI.cpp

+25-26
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void HCIClass::poll(unsigned long timeout)
137137

138138
while (HCITransport.available()) {
139139
byte b = HCITransport.read();
140-
140+
141141
if (_recvIndex >= sizeof(_recvBuffer)) {
142142
_recvIndex = 0;
143143
if (_debug) {
@@ -161,7 +161,7 @@ void HCIClass::poll(unsigned long timeout)
161161
handleAclDataPkt(pktLen, &_recvBuffer[1]);
162162

163163
#ifdef ARDUINO_AVR_UNO_WIFI_REV2
164-
digitalWrite(NINA_RTS, LOW);
164+
digitalWrite(NINA_RTS, LOW);
165165
#endif
166166
}
167167
} else if (_recvBuffer[0] == HCI_EVENT_PKT) {
@@ -363,7 +363,7 @@ int HCIClass::leSetAdvertiseEnable(uint8_t enable)
363363
return sendCommand(OGF_LE_CTL << 10 | OCF_LE_SET_ADVERTISE_ENABLE, sizeof(enable), &enable);
364364
}
365365

366-
int HCIClass::leSetScanParameters(uint8_t type, uint16_t interval, uint16_t window,
366+
int HCIClass::leSetScanParameters(uint8_t type, uint16_t interval, uint16_t window,
367367
uint8_t ownBdaddrType, uint8_t filter)
368368
{
369369
struct __attribute__ ((packed)) HCILeSetScanParameters {
@@ -437,7 +437,7 @@ int HCIClass::leCancelConn()
437437
return sendCommand(OGF_LE_CTL << 10 | OCF_LE_CANCEL_CONN, 0, NULL);
438438
}
439439

440-
int HCIClass::leConnUpdate(uint16_t handle, uint16_t minInterval, uint16_t maxInterval,
440+
int HCIClass::leConnUpdate(uint16_t handle, uint16_t minInterval, uint16_t maxInterval,
441441
uint16_t latency, uint16_t supervisionTimeout)
442442
{
443443
struct __attribute__ ((packed)) HCILeConnUpdateData {
@@ -464,7 +464,7 @@ void HCIClass::saveNewAddress(uint8_t addressType, uint8_t* address, uint8_t* pe
464464
if(_storeIRK!=0){
465465
_storeIRK(address, peerIrk);
466466
}
467-
// Again... this should work
467+
// Again... this should work
468468
// leAddResolvingAddress(addressType, address, peerIrk, localIrk);
469469
}
470470
void HCIClass::leAddResolvingAddress(uint8_t addressType, uint8_t* peerAddress, uint8_t* peerIrk, uint8_t* localIrk){
@@ -490,7 +490,7 @@ void HCIClass::leAddResolvingAddress(uint8_t addressType, uint8_t* peerAddress,
490490
btct.printBytes(addDevice.peerIRK,16);
491491
Serial.print("localIRK :");
492492
btct.printBytes(addDevice.localIRK,16);
493-
sendCommand(OGF_LE_CTL << 10 | 0x27, sizeof(addDevice), &addDevice);
493+
sendCommand(OGF_LE_CTL << 10 | 0x27, sizeof(addDevice), &addDevice);
494494

495495
leStartResolvingAddresses();
496496
}
@@ -509,7 +509,7 @@ int HCIClass::leReadPeerResolvableAddress(uint8_t peerAddressType, uint8_t* peer
509509
} request;
510510
request.addressType = peerAddressType;
511511
for(int i=0; i<6; i++) request.identityAddress[5-i] = peerIdentityAddress[i];
512-
512+
513513

514514
int res = sendCommand(OGF_LE_CTL << 10 | 0x2B, sizeof(request), &request);
515515
Serial.print("res: 0x");
@@ -604,7 +604,7 @@ int HCIClass::tryResolveAddress(uint8_t* BDAddr, uint8_t* address){
604604
delete BADDRs;
605605
delete[] (*IRKs);
606606
delete IRKs;
607-
607+
608608
if(foundMatch){
609609
return 1;
610610
}
@@ -688,7 +688,6 @@ int HCIClass::sendCommand(uint16_t opcode, uint8_t plen, void* parameters)
688688
for(int i=0; i< sizeof(pktHdr) + plen;i++){
689689
Serial.print(" 0x");
690690
Serial.print(txBuffer[i],HEX);
691-
692691
}
693692
Serial.println("");
694693
#endif
@@ -758,7 +757,7 @@ void HCIClass::handleAclDataPkt(uint8_t /*plen*/, uint8_t pdata[])
758757
}
759758
} else if (aclHdr->cid == SIGNALING_CID) {
760759
#ifdef _BLE_TRACE_
761-
Serial.println("Signalling");
760+
Serial.println("Signaling");
762761
#endif
763762
L2CAPSignaling.handleData(aclHdr->handle & 0x0fff, aclHdr->len, &_recvBuffer[1 + sizeof(HCIACLHdr)]);
764763
} else if (aclHdr->cid == SECURITY_CID){
@@ -853,7 +852,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
853852
}
854853
// From page 1681 bluetooth standard - order matters
855854
if(ATT.localKeyDistribution.IdKey()){
856-
/// We shall distribute IRK and address using identity information
855+
/// We shall distribute IRK and address using identity information
857856
{
858857
uint8_t response[17];
859858
response[0] = CONNECTION_IDENTITY_INFORMATION; // Identity information.
@@ -1002,7 +1001,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
10021001
uint16_t supervisionTimeout;
10031002
uint8_t masterClockAccuracy;
10041003
} *leConnectionComplete = (EvtLeConnectionComplete*)&pdata[sizeof(HCIEventHdr) + sizeof(LeMetaEventHeader)];
1005-
1004+
10061005
if (leConnectionComplete->status == 0x00) {
10071006
ATT.addConnection(leConnectionComplete->handle,
10081007
leConnectionComplete->role,
@@ -1051,7 +1050,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
10511050
uint16_t supervisionTimeout;
10521051
uint8_t masterClockAccuracy;
10531052
} *leConnectionComplete = (EvtLeConnectionComplete*)&pdata[sizeof(HCIEventHdr) + sizeof(LeMetaEventHeader)];
1054-
1053+
10551054
if (leConnectionComplete->status == 0x00) {
10561055
ATT.addConnection(leConnectionComplete->handle,
10571056
leConnectionComplete->role,
@@ -1127,7 +1126,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
11271126
uint8_t resolvableAddr[6];
11281127
uint8_t foundLTK;
11291128
ATT.getPeerAddrWithType(ltkRequest->connectionHandle, peerAddr);
1130-
1129+
11311130
if((ATT.getPeerEncryption(ltkRequest->connectionHandle) & PEER_ENCRYPTION::PAIRING_REQUEST)>0){
11321131
// Pairing request - LTK is one in buffer already
11331132
foundLTK = 1;
@@ -1207,7 +1206,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
12071206
Serial.print("Timeout : ");
12081207
btct.printBytes((uint8_t*)&remoteConnParamReq->timeOut,2);
12091208
#endif
1210-
1209+
12111210
struct __attribute__ ((packed)) RemoteConnParamReqReply {
12121211
uint16_t connectionHandle;
12131212
uint16_t intervalMin;
@@ -1253,13 +1252,13 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
12531252
HCI.sendAclPkt(connectionHandle,SECURITY_CID,sizeof(PairingPublicKey),&pairingPublicKey);
12541253
uint8_t encryption = ATT.getPeerEncryption(connectionHandle) | PEER_ENCRYPTION::SENT_PUBKEY;
12551254
ATT.setPeerEncryption(connectionHandle, encryption);
1256-
1255+
12571256

12581257
uint8_t Z = 0;
1259-
1258+
12601259
HCI.leRand(Nb);
12611260
HCI.leRand(&Nb[8]);
1262-
1261+
12631262
#ifdef _BLE_TRACE_
12641263
Serial.print("nb: ");
12651264
btct.printBytes(Nb, 16);
@@ -1271,16 +1270,16 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
12711270
uint8_t Z;
12721271
} f4Params = {0,0,Z};
12731272
for(int i=0; i<32; i++){
1274-
f4Params.U[31-i] = pairingPublicKey.publicKey[i];
1273+
f4Params.U[31-i] = pairingPublicKey.publicKey[i];
12751274
f4Params.V[31-i] = HCI.remotePublicKeyBuffer[i];
12761275
}
1277-
1276+
12781277
struct __attribute__ ((packed)) PairingConfirm
12791278
{
12801279
uint8_t code;
12811280
uint8_t cb[16];
12821281
} pairingConfirm = {CONNECTION_PAIRING_CONFIRM,0};
1283-
1282+
12841283
btct.AES_CMAC(Nb,(unsigned char *)&f4Params,sizeof(f4Params),pairingConfirm.cb);
12851284

12861285
#ifdef _BLE_TRACE_
@@ -1297,7 +1296,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
12971296

12981297
// Send Pairing confirm response
12991298
HCI.sendAclPkt(connectionHandle, SECURITY_CID, sizeof(pairingConfirm), &pairingConfirm);
1300-
1299+
13011300
HCI.sendCommand( (OGF_LE_CTL << 10) | LE_COMMAND::GENERATE_DH_KEY_V1, sizeof(HCI.remotePublicKeyBuffer), HCI.remotePublicKeyBuffer);
13021301
}else{
13031302
#ifdef _BLE_TRACE_
@@ -1329,8 +1328,8 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
13291328
#endif
13301329
break;
13311330
}
1332-
1333-
1331+
1332+
13341333
for(int i=0; i<32; i++) DHKey[31-i] = evtLeDHKeyComplete->DHKey[i];
13351334

13361335
#ifdef _BLE_TRACE_
@@ -1345,7 +1344,7 @@ void HCIClass::handleEventPkt(uint8_t /*plen*/, uint8_t pdata[])
13451344
Serial.println("Received DHKey check already so calculate f5, f6 now.");
13461345
#endif
13471346
L2CAPSignaling.smCalculateLTKandConfirm(connectionHandle, HCI.remoteDHKeyCheckBuffer);
1348-
1347+
13491348
}else{
13501349
#ifdef _BLE_TRACE_
13511350
Serial.println("Waiting on other DHKey check before calculating.");
@@ -1382,7 +1381,7 @@ int HCIClass::leEncrypt(uint8_t* key, uint8_t* plaintext, uint8_t* status, uint8
13821381
leEncryptCommand.key[15-i] = key[i];
13831382
leEncryptCommand.plaintext[15-i] = plaintext[i];
13841383
}
1385-
1384+
13861385
int res = sendCommand(OGF_LE_CTL << 10 | LE_COMMAND::ENCRYPT, 32, &leEncryptCommand);
13871386
if(res == 0){
13881387
#ifdef _BLE_TRACE_

0 commit comments

Comments
 (0)
Please sign in to comment.