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


C++ ErrorPtr::description方法代码示例

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


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

示例1: initDiscovery

 void initDiscovery()
 {
   // get discovery params
   // - host name
   string s;
   string hostname;
   if (!getStringOption("hostname", hostname)) {
     // none specified, create default
     hostname = string_format("plan44-vdcd-%s", p44VdcHost->getDsUid().getString().c_str());
   }
   // start DS advertising if not disabled
   if (!getOption("nodiscovery")) {
     // start the basic service
     ErrorPtr err = DiscoveryManager::sharedDiscoveryManager().start(
       hostname.c_str()
     );
     if (Error::isOK(err)) {
       // started ok, set discovery params
       int sshPort = 0;
       getIntOption("sshport", sshPort);
       // start discovery manager
       DiscoveryManager::sharedDiscoveryManager().advertiseDS(
         p44VdcHost,
         getOption("noauto"),
         p44VdcHost->webUiPort,
         p44VdcHost->webUiPath,
         sshPort
       );
     }
     else {
       LOG(LOG_ERR, "**** Cannot start discovery manager: %s", err->description().c_str());
     }
   }
 }
开发者ID:plan44,项目名称:vdcd,代码行数:34,代码来源:p44_vdcd_main.cpp

示例2: testRWResponse

void DaliDeviceContainer::testRWResponse(CompletedCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
{
  if (Error::isOK(aError) && !aNoOrTimeout && aResponse==aTestByte) {
    LOG(LOG_NOTICE,"  - sent 0x%02X, received 0x%02X\n",aTestByte, aResponse, aNoOrTimeout);
    // successfully read back same value from DTR as sent before
    // - check if more tests
    switch (aTestByte) {
      case 0x55: aTestByte = 0xAA; break; // next test: inverse
      case 0xAA: aTestByte = 0x00; break; // next test: all 0
      case 0x00: aTestByte = 0xFF; break; // next test: all 1
      case 0xFF: aTestByte = 0xF0; break; // next test: half / half
      case 0xF0: aTestByte = 0x0F; break; // next test: half / half inverse
      default:
        // all tests done
        aCompletedCB(aError);
        // turn off lights
        daliComm->daliSendDirectPower(DaliBroadcast, 0); // off
        return;
    }
    // launch next test
    testRW(aCompletedCB, aShortAddr, aTestByte);
  }
  else {
    // not ok
    if (Error::isOK(aError) && aNoOrTimeout) aError = ErrorPtr(new DaliCommError(DaliCommErrorMissingData));
    // report
    LOG(LOG_ERR,"DALI self test error: sent 0x%02X, error: %s\n",aTestByte, aError->description().c_str());
    aCompletedCB(aError);
  }
}
开发者ID:viiimmx,项目名称:vdcd,代码行数:30,代码来源:dalidevicecontainer.cpp

示例3: socketStatusHandler

void SsdpSearch::socketStatusHandler(ErrorPtr aError)
{
  FOCUSLOG("SSDP socket status: %s", aError ? aError->description().c_str() : "<no error>");
  if (Error::isOK(aError)) {
    FOCUSLOG("### sending UDP M-SEARCH");
    // unregister socket status handler (or we'll get called when connection closes)
    setConnectionStatusHandler(NULL);
    // send search request
    string ssdpSearch = string_format(
      "M-SEARCH * HTTP/1.1\n"
      "HOST: %s:%s\n"
      "MAN: \"ssdp:discover\"\n"
      "MX: %d\n"
      "ST: %s\n",
      SSDP_BROADCAST_ADDR,
      SSDP_PORT,
      SSDP_MX,
      searchTarget.c_str()
    );
    transmitString(ssdpSearch);
    // start timer (wait 1.5 the MX for answers)
    timeoutTicket = MainLoop::currentMainLoop().executeOnce(boost::bind(&SsdpSearch::searchTimedOut, this), SSDP_MX*1500*MilliSecond);
  }
  else {
    // error starting search
    if (searchResultHandler) {
      searchResultHandler(this, aError);
    }
  }
}
开发者ID:chhitz,项目名称:p44utils,代码行数:30,代码来源:ssdpsearch.cpp

示例4: handleCreateUserAnswer

 void handleCreateUserAnswer(JsonObjectPtr aJsonResponse, ErrorPtr aError)
 {
   if (Error::isOK(aError)) {
     FOCUSLOG("Received success answer:\n%s", aJsonResponse->json_c_str());
     JsonObjectPtr s = HueComm::getSuccessItem(aJsonResponse);
     // apparently successful, extract user name
     if (s) {
       JsonObjectPtr u = s->get("username");
       if (u) {
         hueComm.userName = u->stringValue();
         hueComm.uuid = currentAuthCandidate->first;
         hueComm.baseURL = currentAuthCandidate->second;
         hueComm.apiReady = true; // can use API now
         FOCUSLOG("hue Bridge %s @ %s: successfully registered as user %s", hueComm.uuid.c_str(), hueComm.baseURL.c_str(), hueComm.userName.c_str());
         // successfully registered with hue bridge, let caller know
         callback(ErrorPtr());
         // done!
         keepAlive.reset(); // will delete object if nobody else keeps it
         return;
       }
     }
   }
   else {
     LOG(LOG_ERR, "hue Bridge: Error creating user: %s", aError->description().c_str());
   }
   // try next
   ++currentAuthCandidate;
   processCurrentAuthCandidate(); // process next, if any
 }
开发者ID:chhitz,项目名称:vdcd,代码行数:29,代码来源:huecomm.cpp

示例5: transmitString

bool FdComm::transmitString(const string &aString)
{
  ErrorPtr err;
  size_t res = transmitBytes(aString.length(), (uint8_t *)aString.c_str(), err);
  if (!Error::isOK(err)) {
    FOCUSLOG("FdComm: Error sending data: %s", err->description().c_str());
  }
  return Error::isOK(err) && res==aString.length(); // ok if no error and all bytes sent
}
开发者ID:plan44,项目名称:p44utils,代码行数:9,代码来源:fdcomm.cpp

示例6: terminateAppWith

void Application::terminateAppWith(ErrorPtr aError)
{
  if (Error::isOK(aError)) {
    mainLoop.terminate(EXIT_SUCCESS);
  }
  else {
    LOG(LOG_ERR, "Terminating because of error: %s", aError->description().c_str());
    mainLoop.terminate(EXIT_FAILURE);
  }
}
开发者ID:plan44,项目名称:p44utils,代码行数:10,代码来源:application.cpp

示例7: handleRadioPacket

void EnoceanDeviceContainer::handleRadioPacket(Esp3PacketPtr aEsp3PacketPtr, ErrorPtr aError)
{
  if (aError) {
    LOG(LOG_INFO, "Radio packet error: %s\n", aError->description().c_str());
    return;
  }
  // check learning mode
  if (learningMode) {
    // no learn/unlearn actions detected so far
    // - check if we know that device address already. If so, it is a learn-out
    bool learnIn = enoceanDevices.find(aEsp3PacketPtr->radioSender())==enoceanDevices.end();
    // now add/remove the device (if the action is a valid learn/unlearn)
    // detect implicit (RPS) learn in only with sufficient radio strength (or explicit override of that check),
    // explicit ones are always recognized
    if (aEsp3PacketPtr->eepHasTeachInfo(disableProximityCheck ? 0 : MIN_LEARN_DBM, false)) {
      LOG(LOG_NOTICE, "Received EnOcean learn packet while learn mode enabled: %s\n", aEsp3PacketPtr->description().c_str());
      // This is actually a valid learn action
      ErrorPtr learnStatus;
      if (learnIn) {
        // new device learned in, add logical devices for it
        int numNewDevices = EnoceanDevice::createDevicesFromEEP(this, aEsp3PacketPtr->radioSender(), aEsp3PacketPtr->eepProfile(), aEsp3PacketPtr->eepManufacturer());
        if (numNewDevices>0) {
          // successfully learned at least one device
          // - update learn status (device learned)
          getDeviceContainer().reportLearnEvent(true, ErrorPtr());
        }
      }
      else {
        // device learned out, un-pair all logical dS devices it has represented
        // but keep dS level config in case it is reconnected
        unpairDevicesByAddress(aEsp3PacketPtr->radioSender(), false);
        getDeviceContainer().reportLearnEvent(false, ErrorPtr());
      }
      // - only allow one learn action (to prevent learning out device when
      //   button is released or other repetition of radio packet)
      learningMode = false;
    } // learn action
  }
  else {
    // not learning mode, dispatch packet to all devices known for that address
    for (EnoceanDeviceMap::iterator pos = enoceanDevices.lower_bound(aEsp3PacketPtr->radioSender()); pos!=enoceanDevices.upper_bound(aEsp3PacketPtr->radioSender()); ++pos) {
      if (aEsp3PacketPtr->eepHasTeachInfo(MIN_LEARN_DBM, false) && aEsp3PacketPtr->eepRorg()!=rorg_RPS) {
        // learning packet in non-learn mode -> report as non-regular user action, may be attempt to identify a device
        // Note: RPS devices are excluded because for these all telegrams are regular regular user actions. signalDeviceUserAction() will be called
        //   from button
        if (getDeviceContainer().signalDeviceUserAction(*(pos->second), false)) {
          // consumed for device identification purposes, suppress further processing
          break;
        }
      }
      // handle regularily (might be RPS switch which does not have separate learn/action packets
      pos->second->handleRadioPacket(aEsp3PacketPtr);
    }
  }
}
开发者ID:Torkalis,项目名称:vdcd,代码行数:55,代码来源:enoceandevicecontainer.cpp

示例8: childAnswerCollected

void MainLoop::childAnswerCollected(ExecCB aCallback, FdStringCollectorPtr aAnswerCollector, ErrorPtr aError)
{
  LOG(LOG_DEBUG, "childAnswerCollected: error = %s", Error::isOK(aError) ? "none" : aError->description().c_str());
  // close my end of the pipe
  aAnswerCollector->stopMonitoringAndClose();
  // now get answer
  string answer = aAnswerCollector->collectedData;
  LOG(LOG_DEBUG, "- Answer = %s", answer.c_str());
  // call back directly
  aCallback(cycleStartTime, aError, answer);
}
开发者ID:plan44,项目名称:p44utils,代码行数:11,代码来源:mainloop.cpp

示例9: handleServiceDescriptionAnswer

 void handleServiceDescriptionAnswer(const string &aResponse, ErrorPtr aError)
 {
   if (Error::isOK(aError)) {
     // show
     //FOCUSLOG("Received bridge description:\n%s", aResponse.c_str());
     FOCUSLOG("Received service description XML");
     // TODO: this is poor man's XML scanning, use some real XML parser eventually
     // do some basic checking for model
     size_t i = aResponse.find("<manufacturer>Royal Philips Electronics</manufacturer>");
     if (i!=string::npos) {
       // is from Philips
       // - check model number
       i = aResponse.find("<modelNumber>929000226503</modelNumber>"); // original 2012 hue bridge, FreeRTOS
       if (i==string::npos) i = aResponse.find("<modelNumber>BSB002</modelNumber>"); // hue bridge 2015 with homekit, Linux
       if (i!=string::npos) {
         // is the right model
         // - get base URL
         string token = "<URLBase>";
         i = aResponse.find(token);
         if (i!=string::npos) {
           i += token.size();
           size_t e = aResponse.find("</URLBase>", i);
           if (e!=string::npos) {
             // create the base address for the API
             string url = aResponse.substr(i,e-i) + "api";
             if (refind) {
               // that's my known hue bridge, save the URL and report success
               hueComm.baseURL = url; // save it
               hueComm.apiReady = true; // can use API now
               FOCUSLOG("pre-known hue Bridge %s found at %s", hueComm.uuid.c_str(), hueComm.baseURL.c_str());
               callback(ErrorPtr()); // success
               keepAlive.reset(); // will delete object if nobody else keeps it
               return; // done
             }
             else {
               // that's a hue bridge, remember it for trying to authorize
               FOCUSLOG("- Seems to be a hue bridge at %s", url.c_str());
               authCandidates[currentBridgeCandidate->first] = url;
             }
           }
         }
       }
     }
   }
   else {
     FOCUSLOG("Error accessing bridge description: %s", aError->description().c_str());
   }
   // try next
   ++currentBridgeCandidate;
   processCurrentBridgeCandidate(); // process next, if any
 }
开发者ID:chhitz,项目名称:vdcd,代码行数:51,代码来源:huecomm.cpp

示例10: reconnectHandler

void SerialComm::reconnectHandler()
{
  if (reconnecting) {
    ErrorPtr err = establishConnection();
    if (!Error::isOK(err)) {
      LOG(LOG_ERR, "SerialComm: re-connect failed: %s -> retry again later", err->description().c_str());
      reconnecting = true;
      MainLoop::currentMainLoop().executeOnce(boost::bind(&SerialComm::reconnectHandler, this), 15*Second);
    }
    else {
      LOG(LOG_NOTICE, "SerialComm: successfully reconnected to %s", connectionPath.c_str());
    }
  }
}
开发者ID:chhitz,项目名称:p44utils,代码行数:14,代码来源:serialcomm.cpp

示例11: connectionMonitorHandler

bool SocketComm::connectionMonitorHandler(MLMicroSeconds aCycleStartTime, int aFd, int aPollFlags)
{
  ErrorPtr err;
  if ((aPollFlags & POLLOUT) && isConnecting) {
    // became writable, check status
    err = socketError(aFd);
  }
  else if (aPollFlags & POLLHUP) {
    err = ErrorPtr(new SocketCommError(SocketCommErrorHungUp, "Connection HUP while opening (= connection rejected)"));
  }
  else if (aPollFlags & POLLERR) {
    err = socketError(aFd);
  }
  // now check if successful
  if (Error::isOK(err)) {
    // successfully connected
    connectionOpen = true;
    isConnecting = false;
    currentAddressInfo = NULL; // no more addresses to check
    freeAddressInfo();
    LOG(LOG_DEBUG, "Connection to %s:%s established", hostNameOrAddress.c_str(), serviceOrPortOrSocket.c_str());
    // call handler if defined
    if (connectionStatusHandler) {
      // connection ok
      connectionStatusHandler(this, ErrorPtr());
    }
    // let FdComm base class operate open connection (will install handlers)
    setFd(aFd);
  }
  else {
    // this attempt has failed, try next (if any)
    LOG(LOG_DEBUG, "- Connection attempt failed: %s", err->description().c_str());
    // this will return no error if we have another address to try
    err = connectNextAddress();
    if (err) {
      // no next attempt started, report error
      LOG(LOG_WARNING, "Connection to %s:%s failed: %s", hostNameOrAddress.c_str(), serviceOrPortOrSocket.c_str(), err->description().c_str());
      if (connectionStatusHandler) {
        connectionStatusHandler(this, err);
      }
      freeAddressInfo();
      internalCloseConnection();
    }
  }
  // handled
  return true;
}
开发者ID:chhitz,项目名称:p44utils,代码行数:47,代码来源:socketcomm.cpp

示例12: bridgeDiscoveryHandler

 void bridgeDiscoveryHandler(SsdpSearchPtr aSsdpSearch, ErrorPtr aError)
 {
   if (Error::isOK(aError)) {
     // check device for possibility of being a hue bridge
     if (aSsdpSearch->server.find("IpBridge")!=string::npos) {
       LOG(LOG_INFO, "hue bridge candidate device found at %s, server=%s, uuid=%s", aSsdpSearch->locationURL.c_str(), aSsdpSearch->server.c_str(), aSsdpSearch->uuid.c_str());
       // put into map
       bridgeCandiates[aSsdpSearch->uuid.c_str()] = aSsdpSearch->locationURL.c_str();
     }
   }
   else {
     FOCUSLOG("discovery ended, error = %s (usually: timeout)", aError->description().c_str());
     aSsdpSearch->stopSearch();
     // now process the results
     currentBridgeCandidate = bridgeCandiates.begin();
     processCurrentBridgeCandidate();
   }
 }
开发者ID:chhitz,项目名称:vdcd,代码行数:18,代码来源:huecomm.cpp

示例13: deviceLearnHandler

 void deviceLearnHandler(bool aLearnIn, ErrorPtr aError)
 {
   // back to normal...
   stopLearning(false);
   // ...but as we acknowledge the learning with the LEDs, schedule a update for afterwards
   shutDownTicket.executeOnce(boost::bind(&P44Vdcd::showAppStatus, this), 2*Second);
   // acknowledge the learning (if any, can also be timeout or manual abort)
   if (Error::isOK(aError)) {
     if (aLearnIn) {
       // show device learned
       indicateTempStatus(tempstatus_success);
     }
     else {
       // show device unlearned
       indicateTempStatus(tempstatus_failure);
     }
   }
   else {
     LOG(LOG_ERR, "Learning error: %s", aError->description().c_str());
   }
 }
开发者ID:plan44,项目名称:vdcd,代码行数:21,代码来源:p44_vdcd_main.cpp

示例14: 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());
}
开发者ID:viiimmx,项目名称:vdcd,代码行数:21,代码来源:dalidevicecontainer.cpp

示例15: initialized

 virtual void initialized(ErrorPtr aError)
 {
   #if SELFTESTING_ENABLED
   if (selfTesting) {
     // self test mode
     if (Error::isOK(aError)) {
       // start self testing (which might do some collecting if needed for testing)
       p44VdcHost->selfTest(boost::bind(&P44Vdcd::selfTestDone, this, _1), button, redLED, greenLED); // do the self test
     }
     else {
       // - init already unsuccessful, consider test failed, call test end routine directly
       selfTestDone(aError);
     }
   }
   else
   #endif // SELFTESTING_ENABLED
   if (!Error::isOK(aError)) {
     // cannot initialize, this is a fatal error
     setAppStatus(status_fatalerror);
     // exit in 15 seconds
     LOG(LOG_ALERT, "****** Fatal error - vdc host initialisation failed: %s", aError->description().c_str());
     shutDownTicket.executeOnce(boost::bind(&P44Vdcd::terminateAppWith, this, aError), 15*Second);
     return;
   }
   else {
     // Initialized ok and not testing
     #if !DISABLE_DISCOVERY
     // - initialize discovery
     initDiscovery();
     #endif
     // - start running normally
     p44VdcHost->startRunning();
     // - collect devices
     collectDevices(rescanmode_normal);
   }
 }
开发者ID:plan44,项目名称:vdcd,代码行数:36,代码来源:p44_vdcd_main.cpp


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