本文整理汇总了C++中DataContainer::setCertificationDataValueHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ DataContainer::setCertificationDataValueHandle方法的具体用法?C++ DataContainer::setCertificationDataValueHandle怎么用?C++ DataContainer::setCertificationDataValueHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataContainer
的用法示例。
在下文中一共展示了DataContainer::setCertificationDataValueHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: establishHandles
void establishHandles(int instance)
{
DataContainer *dc = DataContainer::getInstance();
bt_gatt_characteristic_t* c_manufacturer_name;
errno= 0;
int num_characteristics = bt_gatt_characteristics_count(instance);
if (num_characteristics == -1) {
qDebug() << "YYYY bt_gatt_characteristics_count failed: " + QString::number(errno) + " (" + QString(strerror(errno)) + ")";
Utilities::alert("GATT connect service request failed: " + QString::number(errno) + " (" + QString(strerror(errno)) + ")");
return;
}
if (num_characteristics > -1) {
qDebug() << QString("YYYY # characteristics: %1").arg(num_characteristics);
bt_gatt_characteristic_t *characteristicList;
characteristicList = (bt_gatt_characteristic_t*) malloc(num_characteristics * sizeof(bt_gatt_characteristic_t));
if (NULL == characteristicList) {
qDebug() << QString("YYYY GATT characteristics: Not enough memory");
bt_gatt_disconnect_instance(instance);
return;
}
/* BEGIN WORKAROUND - Temporary fix to address race condition */
int number = 0;
do {
number = bt_gatt_characteristics(instance, characteristicList, num_characteristics);
} while ((number == -1) && (errno== EBUSY));
int characteristicListSize = number;
for (int i = 0; i < characteristicListSize; i++) {
qDebug() << "YYYY characteristic: uuid,handle,value_handle:" << characteristicList[i].uuid << "," << characteristicList[i].handle << "," << characteristicList[i].value_handle;
if (strcmp(characteristicList[i].uuid, MANUFACTURER_NAME_UUID) == 0) {
qDebug() << "YYYY found manufacturer name characteristic";
dc->setManufacturerNameHandle(characteristicList[i].handle);
dc->setManufacturerNameValueHandle(characteristicList[i].value_handle);
continue;
}
if (strcmp(characteristicList[i].uuid, MODEL_NUMBER_UUID) == 0) {
qDebug() << "YYYY found model number characteristic";
dc->setModelNumberHandle(characteristicList[i].handle);
dc->setModelNumberValueHandle(characteristicList[i].value_handle);
continue;
}
if (strcmp(characteristicList[i].uuid, SERIAL_NUMBER_UUID) == 0) {
qDebug() << "YYYY found serial number characteristic";
dc->setSerialNumberHandle(characteristicList[i].handle);
dc->setSerialNumberValueHandle(characteristicList[i].value_handle);
continue;
}
if (strcmp(characteristicList[i].uuid, HARDWARE_REVISION_UUID) == 0) {
qDebug() << "YYYY found hardware revision characteristic";
dc->setHardwareRevisionHandle(characteristicList[i].handle);
dc->setHardwareRevisionValueHandle(characteristicList[i].value_handle);
continue;
}
if (strcmp(characteristicList[i].uuid, FIRMWARE_REVISION_UUID) == 0) {
qDebug() << "YYYY found firmware revision characteristic";
dc->setFirmwareRevisionHandle(characteristicList[i].handle);
dc->setFirmwareRevisionValueHandle(characteristicList[i].value_handle);
continue;
}
if (strcmp(characteristicList[i].uuid, SOFTWARE_REVISION_UUID) == 0) {
qDebug() << "YYYY found software revision characteristic";
dc->setSoftwareRevisionHandle(characteristicList[i].handle);
dc->setSoftwareRevisionValueHandle(characteristicList[i].value_handle);
continue;
}
if (strcmp(characteristicList[i].uuid, SYSTEM_ID_UUID) == 0) {
qDebug() << "YYYY found system ID characteristic";
dc->setSystemIdHandle(characteristicList[i].handle);
dc->setSystemIdValueHandle(characteristicList[i].value_handle);
continue;
}
if (strcmp(characteristicList[i].uuid, CERTIFICATION_DATA_UUID) == 0) {
qDebug() << "YYYY found certification data characteristic";
dc->setCertificationDataHandle(characteristicList[i].handle);
dc->setCertificationDataValueHandle(characteristicList[i].value_handle);
continue;
}
if (strcmp(characteristicList[i].uuid, PNP_ID_UUID) == 0) {
qDebug() << "YYYY found PnP ID characteristic";
dc->setPnpIdHandle(characteristicList[i].handle);
dc->setPnpIdValueHandle(characteristicList[i].value_handle);
continue;
}
qDebug() << "YYYY other characteristic: uuid,handle,value_handle=" << characteristicList[i].uuid << "," << characteristicList[i].handle << "," << characteristicList[i].value_handle;
}
if (characteristicList != NULL) {
free(characteristicList);
characteristicList = NULL;
}
/* END WORKAROUND */
//.........这里部分代码省略.........