Skip to content

Commit 9b0bf8b

Browse files
committed
move conn_hdl to 1st parameter in indicate API
1 parent 3b9805f commit 9b0bf8b

File tree

2 files changed

+61
-19
lines changed

2 files changed

+61
-19
lines changed

libraries/Bluefruit52Lib/src/BLECharacteristic.cpp

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ bool BLECharacteristic::notify32(int num)
750750

751751

752752
/*------------------------------------------------------------------*/
753-
/* INDICATE
753+
/* INDICATE multiple connections
754754
*------------------------------------------------------------------*/
755755
bool BLECharacteristic::indicateEnabled(void)
756756
{
@@ -763,7 +763,7 @@ bool BLECharacteristic::indicateEnabled(uint16_t conn_hdl)
763763
return (getCccd(conn_hdl) & BLE_GATT_HVX_INDICATION);
764764
}
765765

766-
bool BLECharacteristic::indicate(const void* data, uint16_t len, uint16_t conn_hdl)
766+
bool BLECharacteristic::indicate(uint16_t conn_hdl, const void* data, uint16_t len)
767767
{
768768
VERIFY( _properties.indicate );
769769

@@ -813,27 +813,60 @@ bool BLECharacteristic::indicate(const void* data, uint16_t len, uint16_t conn_h
813813
return true;
814814
}
815815

816-
bool BLECharacteristic::indicate(const char * str, uint16_t conn_hdl)
816+
bool BLECharacteristic::indicate(uint16_t conn_hdl, const char * str)
817817
{
818-
return indicate((const uint8_t*) str, strlen(str), conn_hdl);
818+
return indicate(conn_hdl, (const uint8_t*) str, strlen(str));
819819
}
820820

821-
bool BLECharacteristic::indicate8(uint8_t num, uint16_t conn_hdl)
821+
bool BLECharacteristic::indicate8(uint16_t conn_hdl, uint8_t num)
822822
{
823-
return indicate((uint8_t*) &num, sizeof(num), conn_hdl);
823+
return indicate(conn_hdl, (uint8_t*) &num, sizeof(num));
824824
}
825825

826-
bool BLECharacteristic::indicate16(uint16_t num, uint16_t conn_hdl)
826+
bool BLECharacteristic::indicate16(uint16_t conn_hdl, uint16_t num)
827827
{
828-
return indicate((uint8_t*) &num, sizeof(num), conn_hdl);
828+
return indicate(conn_hdl, (uint8_t*) &num, sizeof(num));
829829
}
830830

831-
bool BLECharacteristic::indicate32(uint32_t num, uint16_t conn_hdl)
831+
bool BLECharacteristic::indicate32(uint16_t conn_hdl, uint32_t num)
832832
{
833-
return indicate((uint8_t*) &num, sizeof(num), conn_hdl);
833+
return indicate(conn_hdl, (uint8_t*) &num, sizeof(num));
834834
}
835835

836-
bool BLECharacteristic::indicate32(int num, uint16_t conn_hdl)
836+
bool BLECharacteristic::indicate32(uint16_t conn_hdl, int num)
837837
{
838-
return indicate32((uint32_t) num, conn_hdl);
838+
return indicate32(conn_hdl, (uint32_t) num);
839+
}
840+
841+
/*------------------------------------------------------------------*/
842+
/* INDICATE single connections
843+
*------------------------------------------------------------------*/
844+
bool BLECharacteristic::indicate(const void* data, uint16_t len)
845+
{
846+
return indicate(BLE_CONN_HANDLE_INVALID, data, len);
847+
}
848+
849+
bool BLECharacteristic::indicate(const char* str)
850+
{
851+
return indicate(BLE_CONN_HANDLE_INVALID, str);
852+
}
853+
854+
bool BLECharacteristic::indicate8(uint8_t num)
855+
{
856+
return indicate8(BLE_CONN_HANDLE_INVALID, num);
857+
}
858+
859+
bool BLECharacteristic::indicate16(uint16_t num)
860+
{
861+
return indicate16(BLE_CONN_HANDLE_INVALID, num);
862+
}
863+
864+
bool BLECharacteristic::indicate32(uint32_t num)
865+
{
866+
return indicate32(BLE_CONN_HANDLE_INVALID, num);
867+
}
868+
869+
bool BLECharacteristic::indicate32(int num)
870+
{
871+
return indicate32(BLE_CONN_HANDLE_INVALID, num);
839872
}

libraries/Bluefruit52Lib/src/BLECharacteristic.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class BLECharacteristic
147147
bool notify32 (uint32_t num);
148148
bool notify32 (int num);
149149

150-
/*------------- Notify -------------*/
150+
/*------------- Notify multiple connections -------------*/
151151
bool notify (uint16_t conn_hdl, const void* data, uint16_t len);
152152
bool notify (uint16_t conn_hdl, const char* str);
153153

@@ -160,13 +160,22 @@ class BLECharacteristic
160160
bool indicateEnabled(void);
161161
bool indicateEnabled(uint16_t conn_hdl);
162162

163-
bool indicate (const void* data, uint16_t len, uint16_t conn_hdl = BLE_CONN_HANDLE_INVALID);
164-
bool indicate (const char* str, uint16_t conn_hdl = BLE_CONN_HANDLE_INVALID);
163+
bool indicate (const void* data, uint16_t len);
164+
bool indicate (const char* str);
165+
166+
bool indicate8 (uint8_t num);
167+
bool indicate16 (uint16_t num);
168+
bool indicate32 (uint32_t num);
169+
bool indicate32 (int num);
170+
171+
/*------------- Indicate multiple connections -------------*/
172+
bool indicate (uint16_t conn_hdl, const void* data, uint16_t len);
173+
bool indicate (uint16_t conn_hdl, const char* str);
165174

166-
bool indicate8 (uint8_t num, uint16_t conn_hdl = BLE_CONN_HANDLE_INVALID);
167-
bool indicate16 (uint16_t num, uint16_t conn_hdl = BLE_CONN_HANDLE_INVALID);
168-
bool indicate32 (uint32_t num, uint16_t conn_hdl = BLE_CONN_HANDLE_INVALID);
169-
bool indicate32 (int num, uint16_t conn_hdl = BLE_CONN_HANDLE_INVALID);
175+
bool indicate8 (uint16_t conn_hdl, uint8_t num);
176+
bool indicate16 (uint16_t conn_hdl, uint16_t num);
177+
bool indicate32 (uint16_t conn_hdl, uint32_t num);
178+
bool indicate32 (uint16_t conn_hdl, int num);
170179

171180
/*------------- Internal Functions -------------*/
172181
virtual void _eventHandler(ble_evt_t* event);

0 commit comments

Comments
 (0)