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


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

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


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

示例1: readInfo


//.........这里部分代码省略.........
        errno= 0;
        int result = bt_gatt_read_value(dc->getDeviceInformationServiceInstance(), dc->getHardwareRevisionValueHandle(), 0, hardware_revision_bytes, hwr_max_len, 0);
        if (result < 0) {
            qDebug() << "XXXX bt_gatt_read_value hardware revision - errno=(" << errno<< ") :" << strerror(errno);
        } else {
            char *hardware_revision_string = (char*) hardware_revision_bytes;
            dc->setHardwareRevision(QString(hardware_revision_string));
            _handler->emitSignalLogMessage("HARDWARE REVISION:"+dc->getHardwareRevision());
        }
        free(hardware_revision_bytes);
    } else {
        _handler->emitSignalLogMessage("HARDWARE REVISION:not present");
    }

    if (dc->getFirmwareRevisionHandle() != 0) {
        qDebug() << "XXXX reading firmware revision from service instance " << dc->getDeviceInformationServiceInstance();
        int fwr_max_len = 80;
        uint8_t *firmware_revision_bytes;
        firmware_revision_bytes = (uint8_t*) calloc(fwr_max_len,sizeof(uint8_t));
        errno= 0;
        int result = bt_gatt_read_value(dc->getDeviceInformationServiceInstance(), dc->getFirmwareRevisionValueHandle(), 0, firmware_revision_bytes, fwr_max_len, 0);
        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);
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:67,代码来源:BluetoothHandler.cpp


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