use BLEAdafruitSensor as base class for other services
This commit is contained in:
1 parent
603447a0d6
commit
8db3f2e372
10 files changed
+42
-56
No files matched your search
@@ -54,15 +54,15 @@ const uint8_t BLEAdafruitTemperature::UUID128_CHR_TEMPERATURE[16] =
|
||||
|
||||
// Constructor
|
||||
BLEAdafruitTemperature::BLEAdafruitTemperature(void)
|
||||
: BLEService(UUID128_SERVICE), Temperature(UUID128_CHR_TEMPERATURE), Period(UUID128_CHR_ADAFRUIT_MEASUREMENT_PERIOD)
|
||||
: BLEAdafruitSensor(UUID128_SERVICE), Temperature(UUID128_CHR_TEMPERATURE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
err_t BLEAdafruitTemperature::begin (void)
|
||||
{
|
||||
// Invoke base class begin()
|
||||
VERIFY_STATUS( BLEService::begin() );
|
||||
// Invoke base class begin(), this will add service and Period chr
|
||||
VERIFY_STATUS( BLEAdafruitSensor::begin(1000) );
|
||||
|
||||
// Add Temperature Characteristic
|
||||
Temperature.setProperties(CHR_PROPS_READ | CHR_PROPS_NOTIFY);
|
||||
@@ -70,13 +70,5 @@ err_t BLEAdafruitTemperature::begin (void)
|
||||
Temperature.setFixedLen(4);
|
||||
VERIFY_STATUS( Temperature.begin() );
|
||||
|
||||
// Add Measurement Interval Characteristic
|
||||
Period.setProperties(CHR_PROPS_READ | CHR_PROPS_WRITE);
|
||||
Period.setPermission(SECMODE_OPEN, SECMODE_OPEN);
|
||||
Period.setFixedLen(4);
|
||||
VERIFY_STATUS( Period.begin() );
|
||||
|
||||
Period.write32(30); // measure every 30 seconds
|
||||
|
||||
return ERROR_NONE;
|
||||
}
|
||||
Reference in new issue
Block a user