本文整理汇总了C++中ErrorPtr::isError方法的典型用法代码示例。如果您正苦于以下问题:C++ ErrorPtr::isError方法的具体用法?C++ ErrorPtr::isError怎么用?C++ ErrorPtr::isError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorPtr
的用法示例。
在下文中一共展示了ErrorPtr::isError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deviceInfoReceived
void DaliDeviceContainer::deviceInfoReceived(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, CompletedCB aCompletedCB, DaliComm::DaliDeviceInfoPtr aDaliDeviceInfoPtr, ErrorPtr aError)
{
bool missingData = aError && aError->isError(DaliCommError::domain(), DaliCommErrorMissingData);
bool badData =
aError &&
(aError->isError(DaliCommError::domain(), DaliCommErrorBadChecksum) || aError->isError(DaliCommError::domain(), DaliCommErrorBadDeviceInfo));
if (!aError || missingData || badData) {
// no error, or error but due to missing or bad data -> device exists
if (missingData) { LOG(LOG_INFO,"Device at shortAddress %d does not have device info\n",aDaliDeviceInfoPtr->shortAddress); }
if (badData) { LOG(LOG_INFO,"Device at shortAddress %d does not have valid device info\n",aDaliDeviceInfoPtr->shortAddress); }
// update device info entry in dali bus device
(*aNextDev)->setDeviceInfo(*aDaliDeviceInfoPtr);
}
else {
LOG(LOG_ERR,"Error reading device info: %s\n",aError->description().c_str());
return aCompletedCB(aError);
}
// check next
++aNextDev;
queryNextDev(aBusDevices, aNextDev, aCompletedCB, ErrorPtr());
}
示例2: isYes
bool DaliComm::isYes(bool aNoOrTimeout, uint8_t aResponse, ErrorPtr &aError, bool aCollisionIsYes)
{
bool isYes = !aNoOrTimeout;
if (aError && aCollisionIsYes && aError->isError(DaliCommError::domain(), DaliCommErrorDALIFrame)) {
// framing error -> consider this a YES
isYes = true;
aError.reset(); // not considered an error when aCollisionIsYes is set
}
else if (isYes && !aCollisionIsYes) {
// regular answer, must be DALIANSWER_YES to be a regular YES
if (aResponse!=DALIANSWER_YES) {
// invalid YES response
aError.reset(new DaliCommError(DaliCommErrorInvalidAnswer));
}
}
if (aError)
return false; // real error, consider NO
// return YES/NO
return isYes;
}