add BLECharacteristic constructor with max_len and fixed len
This commit is contained in:
1 parent
e732631e5c
commit
3995b428a1
2 files changed
+20
-5
No files matched your search
@@ -90,6 +90,20 @@ BLECharacteristic::BLECharacteristic(BLEUuid bleuuid, uint8_t properties)
|
||||
setProperties(properties);
|
||||
}
|
||||
|
||||
BLECharacteristic::BLECharacteristic(BLEUuid bleuuid, uint8_t properties, int max_len, bool fixed_len)
|
||||
: uuid(bleuuid)
|
||||
{
|
||||
_init();
|
||||
setProperties(properties);
|
||||
if (fixed_len)
|
||||
{
|
||||
setFixedLen(max_len);
|
||||
}else
|
||||
{
|
||||
setMaxLen(max_len);
|
||||
}
|
||||
}
|
||||
|
||||
void BLECharacteristic::setUuid(BLEUuid bleuuid)
|
||||
{
|
||||
uuid = bleuuid;
|
||||
@@ -135,11 +149,6 @@ uint16_t BLECharacteristic::getMaxLen(void)
|
||||
return _max_len;
|
||||
}
|
||||
|
||||
bool BLECharacteristic::isFixedLen(void)
|
||||
{
|
||||
return _attr_meta.vlen == 0;
|
||||
}
|
||||
|
||||
void BLECharacteristic::setFixedLen(uint16_t fixed_len)
|
||||
{
|
||||
if ( fixed_len )
|
||||
@@ -152,6 +161,11 @@ void BLECharacteristic::setFixedLen(uint16_t fixed_len)
|
||||
}
|
||||
}
|
||||
|
||||
bool BLECharacteristic::isFixedLen(void)
|
||||
{
|
||||
return _attr_meta.vlen == 0;
|
||||
}
|
||||
|
||||
// Use application buffer instead of SD stack buffer
|
||||
void BLECharacteristic::setBuffer(void* buf, uint16_t bufsize)
|
||||
{
|
||||
|
||||
@@ -79,6 +79,7 @@ class BLECharacteristic
|
||||
BLECharacteristic(void);
|
||||
BLECharacteristic(BLEUuid bleuuid);
|
||||
BLECharacteristic(BLEUuid bleuuid, uint8_t properties);
|
||||
BLECharacteristic(BLEUuid bleuuid, uint8_t properties, int max_len, bool fixed_len = false);
|
||||
|
||||
// Destructor
|
||||
virtual ~BLECharacteristic();
|
||||
|
||||
Reference in new issue
Block a user