本文整理汇总了C++中BLEDevice::bt_le_address方法的典型用法代码示例。如果您正苦于以下问题:C++ BLEDevice::bt_le_address方法的具体用法?C++ BLEDevice::bt_le_address怎么用?C++ BLEDevice::bt_le_address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLEDevice
的用法示例。
在下文中一共展示了BLEDevice::bt_le_address方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BLEAttribute
BLECharacteristicImp::BLECharacteristicImp(const bt_uuid_t* uuid,
unsigned char properties,
uint16_t handle,
const BLEDevice& bledevice):
BLEAttribute(uuid, BLETypeCharacteristic),
_value_length(0),
_value_buffer(NULL),
_value_updated(false),
_value_handle(handle),
_cccd_handle(0),
_attr_chrc_value(NULL),
_attr_cccd(NULL),
_subscribed(false),
_reading(false),
_ble_device()
{
_value_size = BLE_MAX_ATTR_DATA_LEN;// Set as MAX value. TODO: long read/write need to twist
_value = (unsigned char*)malloc(_value_size);
// TODO: Enable when max value is not set.
// if (_value_size > BLE_MAX_ATTR_DATA_LEN)
// {
// _value_buffer = (unsigned char*)malloc(_value_size);
// }
if (_value)
{
memset(_value, 0, _value_size);
}
else
{
errno = ENOMEM;
}
memset(&_ccc_cfg, 0, sizeof(_ccc_cfg));
memset(&_ccc_value, 0, sizeof(_ccc_value));
memset(&_gatt_chrc, 0, sizeof(_gatt_chrc));
memset(&_sub_params, 0, sizeof(_sub_params));
memset(&_discover_params, 0, sizeof(_discover_params));
_ccc_value.cfg = &_ccc_cfg;
_ccc_value.cfg_len = 1;
if (BLERead & properties)
{
_gatt_chrc.properties |= BT_GATT_CHRC_READ;
}
if (BLEWrite & properties)
{
_gatt_chrc.properties |= BT_GATT_CHRC_WRITE;
}
if (BLEWriteWithoutResponse & properties)
{
_gatt_chrc.properties |= BT_GATT_CHRC_WRITE_WITHOUT_RESP;
}
if (BLENotify & properties)
{
_gatt_chrc.properties |= BT_GATT_CHRC_NOTIFY;
_sub_params.value |= BT_GATT_CCC_NOTIFY;
}
if (BLEIndicate & properties)
{
_gatt_chrc.properties |= BT_GATT_CHRC_INDICATE;
_sub_params.value |= BT_GATT_CCC_INDICATE;
}
_gatt_chrc.uuid = (bt_uuid_t*)this->bt_uuid();//&_characteristic_uuid;//this->uuid();
memset(_event_handlers, 0, sizeof(_event_handlers));
memset(_oldevent_handlers, 0, sizeof(_oldevent_handlers));
_sub_params.notify = profile_notify_process;
// Update BLE device object
_ble_device.setAddress(*bledevice.bt_le_address());
memset(&_descriptors_header, 0, sizeof(_descriptors_header));
}