本文整理汇总了C++中DataContainer::getLinkLossServiceInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ DataContainer::getLinkLossServiceInstance方法的具体用法?C++ DataContainer::getLinkLossServiceInstance怎么用?C++ DataContainer::getLinkLossServiceInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataContainer
的用法示例。
在下文中一共展示了DataContainer::getLinkLossServiceInstance方法的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);
}
}
示例2: setLinkLossAlertLevel
void setLinkLossAlertLevel()
{
if (!link_loss_connected) {
qDebug() << "XXXX not yet connected to the link loss service so ignoring alert request from user";
return;
}
qDebug() << "XXXX BluetoothHandler::setLinkLossAlertLevel()";
uint8_t level[] = { 0 };
// we set the level to HIGH
level[0] = 2;
errno= 0;
DataContainer* dc = DataContainer::getInstance();
int link_loss_service_instance = dc->getLinkLossServiceInstance();
uint16_t alert_level_value_handle = dc->getLinkLossAlertLevelValueHandle();
qDebug() << "XXXX setting link loss service alert level with bt_gatt_write_value_noresp. alert_service_instance=" << link_loss_service_instance;
if (bt_gatt_write_value_noresp(link_loss_service_instance, alert_level_value_handle, 0, level, sizeof(level)) == EOK) {
qDebug() << "XXXX BluetoothHandler::setLinkLossAlertLevel() - value written successfully";
} else {
qDebug() << "XXXX BluetoothHandler::setLinkLossAlertLevel() - errno=(" << errno<< ") :" << strerror(errno);
}
}