当前位置: 首页>>代码示例>>C++>>正文


C++ DataContainer::getSystemIdHandle方法代码示例

本文整理汇总了C++中DataContainer::getSystemIdHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ DataContainer::getSystemIdHandle方法的具体用法?C++ DataContainer::getSystemIdHandle怎么用?C++ DataContainer::getSystemIdHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataContainer的用法示例。


在下文中一共展示了DataContainer::getSystemIdHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readInfo


//.........这里部分代码省略.........
        if (result < 0) {
            qDebug() << "XXXX bt_gatt_read_value firmware revision - errno=(" << errno<< ") :" << strerror(errno);
        } else {
            char *firmware_revision_string = (char*) firmware_revision_bytes;
            dc->setFirmwareRevision(QString(firmware_revision_string));
            _handler->emitSignalLogMessage("FIRMWARE REVISION:"+dc->getFirmwareRevision());
        }
        free(firmware_revision_bytes);
    } else {
        _handler->emitSignalLogMessage("FIRMWARE REVISION:not present");
    }

    if (dc->getSoftwareRevisionHandle() != 0) {
        qDebug() << "XXXX reading software revision from service instance " << dc->getDeviceInformationServiceInstance();
        int swr_max_len = 80;
        uint8_t *software_revision_bytes;
        software_revision_bytes = (uint8_t*) calloc(swr_max_len,sizeof(uint8_t));
        errno= 0;
        int result = bt_gatt_read_value(dc->getDeviceInformationServiceInstance(), dc->getSoftwareRevisionValueHandle(), 0, software_revision_bytes, swr_max_len, 0);
        if (result < 0) {
            qDebug() << "XXXX bt_gatt_read_value software revision - errno=(" << errno<< ") :" << strerror(errno);
        } else {
            char *software_revision_string = (char*) software_revision_bytes;
            dc->setSoftwareRevision(QString(software_revision_string));
            _handler->emitSignalLogMessage("SOFTWARE REVISION:"+dc->getSoftwareRevision());
        }
        free(software_revision_bytes);
    } else {
        _handler->emitSignalLogMessage("SOFTWARE REVISION:not present");
    }

    qDebug() << "XXXX system ID next....";

    if (dc->getSystemIdHandle() != 0) {
        qDebug() << "XXXX reading system ID from service instance " << dc->getDeviceInformationServiceInstance();
        int sid_max_len = 8;
        uint8_t *system_id_bytes;
        system_id_bytes = (uint8_t*) calloc(sid_max_len,sizeof(uint8_t));
        errno= 0;
        int result = bt_gatt_read_value(dc->getDeviceInformationServiceInstance(), dc->getSystemIdValueHandle(), 0, system_id_bytes, sid_max_len, 0);
        if (result < 0) {
            qDebug() << "XXXX bt_gatt_read_value system ID - errno=(" << errno<< ") :" << strerror(errno);
        } else {
            uint64_t manufacturer_identifier=((system_id_bytes[4] << 40) + (system_id_bytes[3] << 32) + (system_id_bytes[2] << 16) + (system_id_bytes[1] << 8) + (system_id_bytes[0]));
            dc->setManufacturerIdentifier(manufacturer_identifier);
            _handler->emitSignalLogMessage(QString("MANUFACTURER ID:%1").arg(dc->getManufacturerIdentifier()));
            uint32_t organizationally_unique_identifier=((system_id_bytes[7] << 16) + (system_id_bytes[6] << 8) + (system_id_bytes[5]));
            dc->setOrgUniqueIdentifier(organizationally_unique_identifier);
            _handler->emitSignalLogMessage(QString("ORG UNIQUE ID:%1").arg(dc->getOrgUniqueIdentifier()));
        }
        free(system_id_bytes);
    } else {
        _handler->emitSignalLogMessage("SYSTEM ID:not present");
    }

    qDebug() << "XXXX certification data next....";
    if (dc->getCertificationDataHandle() != 0) {
        qDebug() << "XXXX reading certification data list from service instance " << dc->getDeviceInformationServiceInstance();
        int cdl_max_len = 80;
        uint8_t *certification_data_list_bytes;
        certification_data_list_bytes = (uint8_t*) calloc(cdl_max_len,sizeof(uint8_t));
        errno= 0;
        int result = bt_gatt_read_value(dc->getDeviceInformationServiceInstance(), dc->getCertificationDataHandle(), 0, certification_data_list_bytes, cdl_max_len, 0);
        if (result < 0) {
            qDebug() << "XXXX bt_gatt_read_value certification data - errno=(" << errno<< ") :" << strerror(errno);
        } else {
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:67,代码来源:BluetoothHandler.cpp


注:本文中的DataContainer::getSystemIdHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。