added BLECharacteristic notify32/indicate32(float)
This commit is contained in:
1 parent
2a34e2afd5
commit
3cb7236c6a
4 files changed
+25
-10
No files matched your search
-2
@@ -150,8 +150,6 @@ uint16_t measure_color(uint8_t* buf, uint16_t bufsize)
|
||||
return sizeof(rgb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void gesture_enable_callback(uint16_t conn_hdl, bool enabled)
|
||||
{
|
||||
(void) conn_hdl;
|
||||
|
||||
@@ -751,6 +751,11 @@ bool BLECharacteristic::notify32(uint16_t conn_hdl, int num)
|
||||
return notify(conn_hdl, (uint8_t*) &num, sizeof(num));
|
||||
}
|
||||
|
||||
bool BLECharacteristic::notify32(uint16_t conn_hdl, float num)
|
||||
{
|
||||
return notify(conn_hdl, (uint8_t*) &num, sizeof(num));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Notify with single connection
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -784,6 +789,10 @@ bool BLECharacteristic::notify32(int num)
|
||||
return notify32(BLE_CONN_HANDLE_INVALID, num);
|
||||
}
|
||||
|
||||
bool BLECharacteristic::notify32(float num)
|
||||
{
|
||||
return notify32(BLE_CONN_HANDLE_INVALID, num);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* INDICATE multiple connections
|
||||
@@ -874,6 +883,11 @@ bool BLECharacteristic::indicate32(uint16_t conn_hdl, int num)
|
||||
return indicate32(conn_hdl, (uint32_t) num);
|
||||
}
|
||||
|
||||
bool BLECharacteristic::indicate32(uint16_t conn_hdl, float num)
|
||||
{
|
||||
return indicate(conn_hdl, (uint8_t*) &num, sizeof(num));
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* INDICATE single connections
|
||||
*------------------------------------------------------------------*/
|
||||
@@ -906,3 +920,8 @@ bool BLECharacteristic::indicate32(int num)
|
||||
{
|
||||
return indicate32(BLE_CONN_HANDLE_INVALID, num);
|
||||
}
|
||||
|
||||
bool BLECharacteristic::indicate32(float num)
|
||||
{
|
||||
return indicate32(BLE_CONN_HANDLE_INVALID, num);
|
||||
}
|
||||
@@ -134,6 +134,7 @@ class BLECharacteristic
|
||||
bool notify16 (uint16_t num);
|
||||
bool notify32 (uint32_t num);
|
||||
bool notify32 (int num);
|
||||
bool notify32 (float fnum);
|
||||
|
||||
/*------------- Notify multiple connections -------------*/
|
||||
// bool notify (uint16_t conn_hdl);
|
||||
@@ -144,6 +145,7 @@ class BLECharacteristic
|
||||
bool notify16 (uint16_t conn_hdl, uint16_t num);
|
||||
bool notify32 (uint16_t conn_hdl, uint32_t num);
|
||||
bool notify32 (uint16_t conn_hdl, int num);
|
||||
bool notify32 (uint16_t conn_hdl, float num);
|
||||
|
||||
/*------------- Indicate -------------*/
|
||||
bool indicateEnabled(void);
|
||||
@@ -156,6 +158,7 @@ class BLECharacteristic
|
||||
bool indicate16 (uint16_t num);
|
||||
bool indicate32 (uint32_t num);
|
||||
bool indicate32 (int num);
|
||||
bool indicate32 (float num);
|
||||
|
||||
/*------------- Indicate multiple connections -------------*/
|
||||
bool indicate (uint16_t conn_hdl, const void* data, uint16_t len);
|
||||
@@ -165,6 +168,7 @@ class BLECharacteristic
|
||||
bool indicate16 (uint16_t conn_hdl, uint16_t num);
|
||||
bool indicate32 (uint16_t conn_hdl, uint32_t num);
|
||||
bool indicate32 (uint16_t conn_hdl, int num);
|
||||
bool indicate32 (uint16_t conn_hdl, float num);
|
||||
|
||||
/*------------- Internal Functions -------------*/
|
||||
virtual void _eventHandler(ble_evt_t* event);
|
||||
|
||||
@@ -41,12 +41,6 @@
|
||||
#define CFG_BLE_TX_POWER_LEVEL 0
|
||||
#endif
|
||||
|
||||
#ifdef USB_PRODUCT
|
||||
#define CFG_DEFAULT_NAME USB_PRODUCT
|
||||
#else
|
||||
#define CFG_DEFAULT_NAME "Feather nRF52832"
|
||||
#endif
|
||||
|
||||
#ifndef CFG_BLE_TASK_STACKSIZE
|
||||
#define CFG_BLE_TASK_STACKSIZE (256*5)
|
||||
#endif
|
||||
@@ -195,7 +189,7 @@ void AdafruitBluefruit::configServiceChanged(bool changed)
|
||||
_sd_cfg.service_changed = (changed ? 1 : 0);
|
||||
}
|
||||
|
||||
void AdafruitBluefruit::configUuid128Count(uint8_t uuid128_max)
|
||||
void AdafruitBluefruit::configUuid128Count(uint8_t uuid128_max)
|
||||
{
|
||||
_sd_cfg.uuid128_max = uuid128_max;
|
||||
}
|
||||
@@ -460,7 +454,7 @@ bool AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
|
||||
|
||||
// Default device name
|
||||
ble_gap_conn_sec_mode_t sec_mode = BLE_SECMODE_OPEN;
|
||||
VERIFY_STATUS(sd_ble_gap_device_name_set(&sec_mode, (uint8_t const *) CFG_DEFAULT_NAME, strlen(CFG_DEFAULT_NAME)), false);
|
||||
VERIFY_STATUS(sd_ble_gap_device_name_set(&sec_mode, (uint8_t const *) USB_PRODUCT, strlen(USB_PRODUCT)), false);
|
||||
|
||||
// Init Central role
|
||||
if (_central_count) Central.begin();
|
||||
|
||||
Reference in new issue
Block a user