clean up
This commit is contained in:
1 parent
bba444f0b4
commit
666c00cbf4
4 files changed
+15
-12
No files matched your search
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "bluefruit.h"
|
||||
|
||||
void BLECharacteristic::init(void)
|
||||
void BLECharacteristic::_init(void)
|
||||
{
|
||||
_is_temp = false;
|
||||
|
||||
@@ -68,13 +68,13 @@ void BLECharacteristic::init(void)
|
||||
BLECharacteristic::BLECharacteristic(void)
|
||||
: uuid()
|
||||
{
|
||||
init();
|
||||
_init();
|
||||
}
|
||||
|
||||
BLECharacteristic::BLECharacteristic(BLEUuid bleuuid)
|
||||
: uuid(bleuuid)
|
||||
{
|
||||
init();
|
||||
_init();
|
||||
}
|
||||
|
||||
void BLECharacteristic::setUuid(BLEUuid bleuuid)
|
||||
|
||||
@@ -104,7 +104,7 @@ class BLECharacteristic
|
||||
write_cb_t _wr_cb;
|
||||
write_cccd_cb_t _cccd_wr_cb;
|
||||
|
||||
void init(void);
|
||||
void _init(void);
|
||||
void eventHandler(ble_evt_t* event);
|
||||
|
||||
public:
|
||||
@@ -128,7 +128,7 @@ class BLECharacteristic
|
||||
void setStringDescriptor(const char* descriptor); // aka user descriptor
|
||||
void setReportRefDescriptor(uint8_t id, uint8_t type);
|
||||
|
||||
/*------------- Callback -------------*/
|
||||
/*------------- Callbacks -------------*/
|
||||
void setWriteCallback(write_cb_t fp);
|
||||
void setCccdWriteCallback(write_cccd_cb_t fp);
|
||||
void setReadAuthorizeCallback(read_authorize_cb_t fp);
|
||||
|
||||
@@ -314,12 +314,12 @@ void AdafruitBluefruit::setDisconnectCallback( disconnect_callback_t fp )
|
||||
_discconnect_cb = fp;
|
||||
}
|
||||
|
||||
err_t AdafruitBluefruit::_registerCharacteristic(BLECharacteristic* chars)
|
||||
bool AdafruitBluefruit::_registerCharacteristic(BLECharacteristic* chars)
|
||||
{
|
||||
if ( _chars_count == BLE_MAX_CHARS ) return NRF_ERROR_NO_MEM;
|
||||
if ( _chars_count == BLE_MAX_CHARS ) return false;
|
||||
_chars_list[ _chars_count++ ] = chars;
|
||||
|
||||
return ERROR_NONE;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t AdafruitBluefruit::connHandle(void)
|
||||
@@ -536,11 +536,14 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
break;
|
||||
|
||||
case BLE_EVT_TX_COMPLETE:
|
||||
if ( _txbuf_sem )
|
||||
if ( evt->evt.common_evt.conn_handle == _conn_hdl )
|
||||
{
|
||||
for(uint8_t i=0; i<evt->evt.common_evt.params.tx_complete.count; i++)
|
||||
if ( _txbuf_sem )
|
||||
{
|
||||
xSemaphoreGive(_txbuf_sem);
|
||||
for(uint8_t i=0; i<evt->evt.common_evt.params.tx_complete.count; i++)
|
||||
{
|
||||
xSemaphoreGive(_txbuf_sem);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -121,7 +121,7 @@ class AdafruitBluefruit
|
||||
COMMENT_OUT ( bool setPIN(const char* pin); )
|
||||
|
||||
// internal usage only
|
||||
err_t _registerCharacteristic(BLECharacteristic* chars);
|
||||
bool _registerCharacteristic(BLECharacteristic* chars);
|
||||
|
||||
private:
|
||||
/*------------- BLE para -------------*/
|
||||
|
||||
Reference in new issue
Block a user