add HAP Procedure define

This commit is contained in:
hathach committed 2017-10-16 14:59:27 +07:00
1 parent 5f40578b27
commit 988ed2d37f
2 files changed
+108 -1

No files matched your search

+11 -1
View File
@@ -47,11 +47,21 @@ HAPCharacteristic::HAPCharacteristic(BLEUuid bleuuid, uint8_t format, uint16_t u
setPresentationFormatDescriptor(format, 0, unit, 1, 0);
}
/**
* GATT Descriptor includes: Instance ID
* HAP Descriptor includes: HAP Properties, User String, Presentation Format,
* Valid Range (GATT), Step Value, Valid Values, Valid Values Range
* @return
*/
err_t HAPCharacteristic::begin(void)
{
uint8_t temp = _format_desc.format;
_format_desc.format = 0; // invalid to prevent adding presentation format
VERIFY_STATUS( BLECharacteristic::begin() );
_format_desc.format = temp;
VERIFY_STATUS( _addChrIdDescriptor() );
VERIFY_STATUS( _addHapDescriptor() );
return ERROR_NONE;
}