bool CNotificationBase::SendMessageEx( const uint64_t Idx, const std::string &Name, const std::string &Subject, const std::string &Text, const std::string &ExtraData, const int Priority, const std::string &Sound, const bool bFromNotification) { if (!IsConfigured()) { // subsystem not configured, skip return false; } if (bFromNotification) { if (!m_IsEnabled) return true; //not enabled } std::string fSubject = Subject; std::string fText = Text; if (_options & OPTIONS_HTML_SUBJECT) { fSubject = MakeHtml(Subject); } if (_options & OPTIONS_HTML_BODY) { fText = MakeHtml(Text); } if (_options & OPTIONS_URL_SUBJECT) { fSubject = CURLEncode::URLEncode(fSubject); } if (_options & OPTIONS_URL_BODY) { fText = CURLEncode::URLEncode(fText); } bool bRet = SendMessageImplementation(Idx, Name, fSubject, fText, ExtraData, Priority, Sound, bFromNotification); if (_subsystemid != "gcm") { if (bRet) { _log.Log(LOG_NORM, std::string(std::string("Notification sent (") + _subsystemid + std::string(") => Success")).c_str()); } else { _log.Log(LOG_ERROR, std::string(std::string("Notification sent (") + _subsystemid + std::string(") => Failed")).c_str()); } } return bRet; }
void SubsonicService::Login() { // Recreate fresh network state, otherwise old HTTPS settings seem to get reused network_->deleteLater(); network_ = new QNetworkAccessManager(this); network_->setCookieJar(new QNetworkCookieJar(network_)); // Forget login state whilst waiting login_state_ = LoginState_Unknown; if (IsConfigured()) { // Ping is enough to check credentials Ping(); } else { login_state_ = LoginState_IncompleteCredentials; emit LoginStateChanged(login_state_); } }
//Definition of StartPerforming //This function starts processing commands in stack //This function contains an almost never ending loop. //It shouldn't be called in interrupt, etc.. void StartPerforming(void) { bool configured = false; while(continuePerf && (configured = IsConfigured()))//until it is allowed and machine is configured { if(commandStack.first != commandStack.last && IsGood())//There are unprocessed items and no errors { if(RedistributeCommandForPerf(&(commandStack.buffer[commandStack.first]), true, false) == COMMAND_PROC_OK)//Distribute item { commandStack.lastItem = commandStack.buffer[commandStack.first].ID; //Item processed successfully - increase counter commandStack.first = CommandStackIncreaseValue(commandStack.first); } } } }
bool BeaconTransmitter::Start(int port) { if (!IsConfigured()) { return false; } netassert(!IsRunning()); if (IsRunning()) { printf("failure to start beacon on port %d; already started on another port\n", port); return false; } printf("start beacon on port %d\n", port); if (!mSocket.Open(port)) { return false; } mIsRunning = true; mTimeAccumulator = 0.0f; // resetting time accumulator return IsRunning(); }
bool CXBMCRenderManager::RendererHandlesPresent() const { return IsConfigured() && (m_firstFlipPage || m_format != RENDER_FMT_BYPASS); }
int CAEN_V814::Init() { int status=0; ostringstream s; s << "[CAEN_V814]::[INFO]::++++++ CAEN V814 INIT ++++++"; Log(s.str(),1); if (handle_<0) return ERR_CONF_NOT_FOUND; if (!IsConfigured()) return ERR_CONF_NOT_FOUND; //Read Version to check connection WORD data=0; status |= CAENVME_ReadCycle(handle_,configuration_.baseAddress+CAEN_V814_VERSION_ADD,&data,CAEN_V814_ADDRESSMODE,CAEN_V814_DATAWIDTH); if (status) { s.str(""); s << "[CAEN_V814]::[ERROR]::Cannot open V814 board @0x" << std::hex << configuration_.baseAddress << std::dec << " " << status; Log(s.str(),1); return ERR_OPEN; } int version = (data&0xF000)>>12; int serial = (data&0x0FFF); s.str(""); s << "[CAEN_V814]::[INFO]::Open V814 board @0x" << std::hex << configuration_.baseAddress << std::dec << " Version " << version << " S/N " << serial; Log(s.str(),1); status |= SetPatternInhibit(); #ifdef CAEN_V814_VERBOSE s.str(""); s << "[CAEN_V814]::[INFO]::Pattern Mask has been set to " << configuration_.patternMask; Log(s.str(),1); #endif status |= SetThreshold(-1); #ifdef CAEN_V814_VERBOSE s.str(""); s << "[CAEN_V814]::[INFO]::All Thresholds have been set"; Log(s.str(),1); #endif for (unsigned i=0;i<CAEN_V814_CHANNELS;++i) if (configuration_.chThreshold[i]>0) { status |= SetThreshold(i); #ifdef CAEN_V814_VERBOSE s.str(""); s << "[CAEN_V814]::[INFO]::Set specific threshold for Ch" <<i << " to 0x" << configuration_.chThreshold[i]; Log(s.str(),1); #endif } status|=SetMajorityThreshold(); // single 0x6 double 0x13 triple 0x1F #ifdef CAEN_V814_VERBOSE s.str(""); s << "[CAEN_V814]::[INFO]::Majority Threshold has been set to 0x" << configuration_.majorityThreshold; Log(s.str(),1); #endif status|=SetOutputWidth(); #ifdef CAEN_V814_VERBOSE s.str(""); s << "[CAEN_V814]::[INFO]::Output Width has been set to 0x" << configuration_.outputWidth; Log(s.str(),1); #endif if (status) { s.str(""); s << "[CAEN_V814]::[ERROR]::Cannot config V814 @0x" << std::hex << configuration_.baseAddress << std::dec; Log(s.str(),1); return ERR_OPEN; } s.str(""); s << "[CAEN_V814]::[INFO]::++++++ CAEN V814 CONFIGURED ++++++"; Log(s.str(),1); return 0; }