Skip to content

Commit 08aee0e

Browse files
committed
Fix missing documentation, code formatting.
1 parent 23e9455 commit 08aee0e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/NimBLEDevice.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,18 +1139,18 @@ uint32_t NimBLEDevice::getSecurityPasskey() {
11391139
/**
11401140
* @brief Start the connection securing and authorization for this connection.
11411141
* @param connHandle The connection handle of the peer device.
1142-
* @returns NimBLE stack return code, 0 = success.
1143-
*/
1144-
bool NimBLEDevice::startSecurity(uint16_t connHandle, int *rc) {
1145-
int _rc = 0;
1146-
if (rc == nullptr)
1147-
rc = &_rc;
1148-
*rc = ble_gap_security_initiate(connHandle);
1149-
if (*rc != 0) {
1150-
NIMBLE_LOGE(LOG_TAG, "ble_gap_security_initiate: rc=%d %s", *rc, NimBLEUtils::returnCodeToString(*rc));
1142+
* @param rcPtr Optional pointer to pass return code to caller.
1143+
* @returns True if started security, success = 0 or BLE_HS_EALREADY.
1144+
*/
1145+
bool NimBLEDevice::startSecurity(uint16_t connHandle, int* rcPtr) {
1146+
int rc = ble_gap_security_initiate(connHandle);
1147+
if (rc != 0) {
1148+
NIMBLE_LOGE(LOG_TAG, "ble_gap_security_initiate: rc=%d %s", rc, NimBLEUtils::returnCodeToString(rc));
11511149
}
1152-
1153-
return *rc == 0 || *rc == BLE_HS_EALREADY;
1150+
if (rcPtr) {
1151+
*rcPtr = rc;
1152+
}
1153+
return rc == 0 || rc == BLE_HS_EALREADY;
11541154
} // startSecurity
11551155

11561156
/**

src/NimBLEDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class NimBLEDevice {
129129
static void setSecurityRespKey(uint8_t respKey);
130130
static void setSecurityPasskey(uint32_t passKey);
131131
static uint32_t getSecurityPasskey();
132-
static bool startSecurity(uint16_t connHandle, int *rc = nullptr);
132+
static bool startSecurity(uint16_t connHandle, int* rcPtr = nullptr);
133133
static bool setMTU(uint16_t mtu);
134134
static uint16_t getMTU();
135135
static bool isIgnored(const NimBLEAddress& address);

0 commit comments

Comments
 (0)