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


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

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


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

示例1: gatt_service_disconnected

void gatt_service_disconnected(const char *bdaddr, const char *service, int instance, int reason, void *userData)
{

    Q_UNUSED(userData)
    Q_UNUSED(instance)
    Q_UNUSED(reason)

    QString bdaddr_str = QString(bdaddr);
    QString service_str = QString(service);
    qDebug() << QString("XXXX gatt_service_disconnected: bdaddr:%1 : %2 - %3").arg(bdaddr_str).arg(service_str).arg(parse_service_uuid(service));

    DataContainer *dc = DataContainer::getInstance();

    if (instance == dc->getLinkLossServiceInstance()) {
        qDebug() << "XXXX reacting to link loss service disconnection";
        link_loss_connected = false;
        dc->setLinkLossServiceInstance(0);
        _handler->emitSignalLostLink();
    }

    if (instance == dc->getTxPowerServiceInstance()) {
        qDebug() << "XXXX reacting to tx power service disconnection";
        tx_power_connected = false;
        dc->setTxPowerServiceInstance(0);
    }

    if (instance == dc->getAlertServiceInstance()) {
        qDebug() << "XXXX reacting to immediate alert service disconnection";
        immediate_alert_connected = false;
        dc->setAlertServiceInstance(0);
    }

}
开发者ID:rascyber,项目名称:Cascades-Community-Samples,代码行数:33,代码来源:BluetoothHandler.cpp

示例2: sendAlertRequest

void BluetoothHandler::sendAlertRequest()
{

    if (!immediate_alert_connected) {
        qDebug() << "XXXX not yet connected to the immediate alert service so ignoring alert request from user";
        return;
    }

    qDebug() << "XXXX BluetoothHandler::sendAlertRequest()";
    uint8_t level[] = { 0 };

    switch (_alertLevel) {
    case BluetoothHandler::Off:
        level[0] = 0;
        break;
    case BluetoothHandler::Mild:
        level[0] = 1;
        break;
    case BluetoothHandler::High:
        level[0] = 2;
        break;
    default:
        level[0] = 0;
        break;
    }

    errno= 0;

    DataContainer* dc = DataContainer::getInstance();

    int alert_service_instance = dc->getAlertServiceInstance();
    uint16_t alert_level_value_handle = dc->getImmediateAlertLevelValueHandle();

    qDebug() << "XXXX setting immediate alert service alert level with bt_gatt_write_value_noresp. alert_service_instance=" << alert_service_instance;

    if (bt_gatt_write_value_noresp(alert_service_instance, alert_level_value_handle, 0, level, sizeof(level)) == EOK) {
        qDebug() << "XXXX BluetoothHandler::sendAlertRequest() - value written successfully";
    } else {
        qDebug() << "XXXX BluetoothHandler::sendAlertRequest() - errno=(" << errno<< ") :" << strerror(errno);
    }
}
开发者ID:rascyber,项目名称:Cascades-Community-Samples,代码行数:41,代码来源:BluetoothHandler.cpp


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