Skip to content

Commit 7f9ccb5

Browse files
committed
Added reference to assigned numbers for units #314
1 parent 15b6fc0 commit 7f9ccb5

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

cpp_utils/BLE2904.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,47 @@ BLE2904::BLE2904() : BLEDescriptor(BLEUUID((uint16_t) 0x2904)) {
2525
} // BLE2902
2626

2727

28+
/**
29+
* @brief Set the description.
30+
*/
2831
void BLE2904::setDescription(uint16_t description) {
2932
m_data.m_description = description;
3033
setValue((uint8_t*)&m_data, sizeof(m_data));
3134
}
3235

3336

37+
/**
38+
* @brief Set the exponent.
39+
*/
3440
void BLE2904::setExponent(int8_t exponent) {
3541
m_data.m_exponent = exponent;
3642
setValue((uint8_t*)&m_data, sizeof(m_data));
3743
} // setExponent
3844

45+
46+
/**
47+
* @brief Set the format.
48+
*/
3949
void BLE2904::setFormat(uint8_t format) {
4050
m_data.m_format = format;
4151
setValue((uint8_t*)&m_data, sizeof(m_data));
4252
} // setFormat
4353

54+
55+
/**
56+
* @brief Set the namespace.
57+
*/
4458
void BLE2904::setNamespace(uint8_t namespace_value) {
4559
m_data.m_namespace = namespace_value;
4660
setValue((uint8_t*)&m_data, sizeof(m_data));
4761
} // setNamespace
4862

63+
64+
/**
65+
* @brief Set the units for this value. It should be one of the encoded values defined here:
66+
* https://www.bluetooth.com/specifications/assigned-numbers/units
67+
* @param [in] uint The type of units of this characteristic as defined by assigned numbers.
68+
*/
4969
void BLE2904::setUnit(uint16_t unit) {
5070
m_data.m_unit = unit;
5171
setValue((uint8_t*)&m_data, sizeof(m_data));

cpp_utils/BLE2904.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
struct BLE2904_Data {
1616
uint8_t m_format;
1717
int8_t m_exponent;
18-
uint16_t m_unit;
18+
uint16_t m_unit; // See https://www.bluetooth.com/specifications/assigned-numbers/units
1919
uint8_t m_namespace;
2020
uint16_t m_description;
2121

cpp_utils/BLEUtils.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1611,13 +1611,15 @@ void BLEUtils::dumpGattClientEvent(
16111611
// - esp_gatt_status_t status
16121612
// - uint16_t conn_id
16131613
// - uint16_t handle
1614+
// - uint16_t offset
16141615
//
16151616
case ESP_GATTC_WRITE_CHAR_EVT: {
1616-
ESP_LOGD(LOG_TAG, "[status: %s, conn_id: %d, handle: %d 0x%.2x]",
1617+
ESP_LOGD(LOG_TAG, "[status: %s, conn_id: %d, handle: %d 0x%.2x, offset: %d]",
16171618
BLEUtils::gattStatusToString(evtParam->write.status).c_str(),
16181619
evtParam->write.conn_id,
16191620
evtParam->write.handle,
1620-
evtParam->write.handle
1621+
evtParam->write.handle,
1622+
evtParam->write.offset
16211623
);
16221624
break;
16231625
} // ESP_GATTC_WRITE_CHAR_EVT

0 commit comments

Comments
 (0)