void REIXSXESMCPDetector::onControlsConnected(bool connected){ if(connected) setConnected(connected); else setConnected(false); if(connected) setReadyForAcquisition(); else if(!isNotReadyForAcquisition()) setNotReadyForAcquisition(); }
void LNetworkConnectionMonitor::onStateChange( uint newState ) { qDebug() << "Networkmanager state change!"; if ( newState == Disconnected ) { setConnected( false ); } else if ( newState == Connected ) { setConnected( true ); } }
void lastfm::LNetworkConnectionMonitor::onStateChange( uint newState ) { qDebug() << "Networkmanager state change!"; if ( newState == NM_STATE_DISCONNECTED || newState == NM_STATE_ASLEEP ) { setConnected( false ); } else if ( newState == NM_STATE_CONNECTED_GLOBAL ) { setConnected( true ); } }
void CDatabaseItem::init(const QString &dbname) { #ifdef DEBUG qDebug("CDatabaseItem::init('%s')", debug_string(dbname)); #endif setText(0,dbname); setDatabaseName(dbname); widgetData.setAutoDelete(true); if (databaseDisconnectedIcon.isNull()) databaseDisconnectedIcon = getPixmapIcon("databaseDisconnectedIcon"); if (databaseConnectedIcon.isNull()) databaseConnectedIcon = getPixmapIcon("databaseConnectedIcon"); databaseConnectIcon = getPixmapIcon("databaseConnectIcon"); databaseDisconnectIcon = getPixmapIcon("databaseDisconnectIcon"); sqlIcon = getPixmapIcon("sqlIcon"); deleteIcon = getPixmapIcon("deleteIcon"); newWindowIcon = getPixmapIcon("newWindowIcon"); if (is_connected) setConnected(is_connected); else setPixmap(0, databaseDisconnectedIcon); }
void IcyConnector::ProcessHeaders(const QString &hdrs) { QStringList f0; QStringList f1; QString txt; f0=hdrs.split("\r\n"); if(f0[0]!="OK2") { Log(LOG_WARNING, QString().sprintf("login to \"%s:%d\" rejected: %s", (const char *)hostHostname().toUtf8(), 0xFFFF&hostPort(), (const char *)f0[0].toUtf8())); return; } icy_authenticated=true; WriteHeader("icy-name: "+streamName()); WriteHeader("icy-genre: "+streamGenre()); WriteHeader("icy-pub: "+QString().sprintf("%d",streamPublic())); WriteHeader("icy-br: "+QString().sprintf("%u",audioBitrate())); if(icy_protocol_version==1) { WriteHeader("icy-url: "+streamUrl()); } WriteHeader("icy-irc: "+streamIrc()); WriteHeader("icy-icq: "+streamIcq()); WriteHeader("icy-aim: "+streamAim()); WriteHeader("Content-Type: "+contentType()); WriteHeader(""); setConnected(true); }
void WlanCoreImpl::cacheInterfaceInfo() { m_deviceOk = false; memset(&m_deviceId, 0, sizeof(m_deviceId)); PWLAN_INTERFACE_INFO_LIST intfList; if (ERROR_SUCCESS == m_wlanapi->WlanEnumInterfaces(m_wlanHandle, NULL, &intfList)) { if (intfList->dwNumberOfItems > 0) { const WLAN_INTERFACE_INFO *intf = intfList->InterfaceInfo + 0; m_deviceOk = true; m_deviceId = intf->InterfaceGuid; m_deviceState = intf->isState; m_deviceDesc = QString::fromWCharArray(intf->strInterfaceDescription); } m_wlanapi->WlanFreeMemory(intfList); } if (m_deviceOk) { cacheRadioState(); cacheConnectionInfo(); } else { setSoftwareEnabled(false); setHardwareEnabled(false); setEnabled(false); setSsid(QString()); setMacAddress(QByteArray()); setSignalQuality(0); setProfileName(QString()); setConnected(false); } }
void WlanCoreImpl::cacheConnectionInfo() { QString profileName; QString ssid; bool connected = false; int signalQuality = 0; QByteArray macAddress; if (m_deviceOk) { PWLAN_CONNECTION_ATTRIBUTES conn; DWORD cb = sizeof(conn); WLAN_OPCODE_VALUE_TYPE vt; if (ERROR_SUCCESS == m_wlanapi->WlanQueryInterface(m_wlanHandle, &m_deviceId, wlan_intf_opcode_current_connection, NULL, &cb, reinterpret_cast<PVOID*>(&conn), &vt)) { profileName = QString::fromWCharArray(conn->strProfileName).trimmed(); connected = (conn->isState == wlan_interface_state_connected); ssid = QString::fromLatin1(reinterpret_cast<char*>(conn->wlanAssociationAttributes.dot11Ssid.ucSSID), conn->wlanAssociationAttributes.dot11Ssid.uSSIDLength); signalQuality = conn->wlanAssociationAttributes.wlanSignalQuality; macAddress = QByteArray(reinterpret_cast<char*>(conn->wlanAssociationAttributes.dot11Bssid), 6); m_wlanapi->WlanFreeMemory(conn); } } setSsid(ssid); setMacAddress(macAddress); setSignalQuality(signalQuality); setProfileName(profileName); setConnected(connected); }
void DkCamControls::closeDeviceAndSetState() { bool lvActive = false; try { lvActive = maidFacade->isLiveViewActive(); } catch (Maid::MaidError) { lvActive = false; } if (lvActive) { maidFacade->toggleLiveView(); liveViewTimer->stop(); // TODO: get the plugin viewport here?! //viewport->setImage(QImage()); //emit updateImage(QImage()); // is setting an empty image here intentional? } try { maidFacade->closeSource(); } catch (Maid::MaidError) { // there is probably nothing left to close } connectedDeviceId.second = false; setConnected(false); updateUiValues(); }
void DkCamControls::onDeviceOpened() { if (openDeviceProgressDialog) { openDeviceProgressDialog->cancel(); } try { if (!maidFacade->isSourceAlive()) { return; } if (!maidFacade->checkCameraType()) { QMessageBox dialog(this); dialog.setIcon(QMessageBox::Warning); dialog.setText(tr("This program is not compatible with the selected camera model.")); dialog.show(); dialog.exec(); //qDebug() << tr("This program is not compatible with the selected camera model."); closeDeviceAndSetState(); return; } setConnected(true); updateUiValues(); } catch (Maid::MaidError e) { qDebug() << tr("[ERROR] after opening device"); } }
void BioXASSSRLMonochromatorRegionControl::updateConnected() { bool slitsOK = ( maskUpperBlade_ && maskUpperBlade_->isConnected() && maskLowerBlade_ && maskLowerBlade_->isConnected() && maskBladesStatus_ && maskBladesStatus_->isConnected() ); bool paddleOK = (paddle_ && paddle_->isConnected()); bool paddleStatusOK = (paddleStatus_ && paddleStatus_->isConnected()); bool keyStatusOK = (keyStatus_ && keyStatus_->isConnected()); bool brakeStatusOK = (brakeStatus_ && brakeStatus_->isConnected()); bool braggOK = (bragg_ && bragg_->isConnected()); bool braggAtCrystalChangePositionStatusOK = (braggAtCrystalChangePositionStatus_ && braggAtCrystalChangePositionStatus_->isConnected()); bool crystalChangeOK = (crystalChange_ && crystalChange_->isConnected()); bool crystalChangeCWLimitStatusOK = (crystalChangeCWLimitStatus_ && crystalChangeCWLimitStatus_->isConnected()); bool crystalChangeCCWLimitStatusOK = (crystalChangeCCWLimitStatus_ && crystalChangeCCWLimitStatus_->isConnected()); bool regionAStatusOK = (regionAStatus_ && regionAStatus_->isConnected()); bool regionBStatusOK = (regionBStatus_ && regionBStatus_->isConnected()); bool isConnected = ( slitsOK && paddleOK && paddleStatusOK && keyStatusOK && brakeStatusOK && braggOK && braggAtCrystalChangePositionStatusOK && crystalChangeOK && crystalChangeCWLimitStatusOK && crystalChangeCCWLimitStatusOK && regionAStatusOK && regionBStatusOK ); setConnected(isConnected); }
int HidController::close() { if (!isOpen()) { qDebug() << "HID device" << getName() << "already closed"; return -1; } qDebug() << "Shutting down HID device" << getName(); // Stop the reading thread if (m_pReader == NULL) { qWarning() << "HidReader not present for" << getName() << "yet the device is open!"; } else { disconnect(m_pReader, SIGNAL(incomingData(QByteArray, mixxx::Duration)), this, SLOT(receive(QByteArray, mixxx::Duration))); m_pReader->stop(); hid_set_nonblocking(m_pHidDevice, 1); // Quit blocking controllerDebug(" Waiting on reader to finish"); m_pReader->wait(); delete m_pReader; m_pReader = NULL; } // Stop controller engine here to ensure it's done before the device is closed // incase it has any final parting messages stopEngine(); // Close device setConnected(false); controllerDebug(" Closing device"); hid_close(m_pHidDevice); setOpen(false); return 0; }
void Server::sendMessage(wstring* message) { if(isConnected()) { int result = 0; int mbsize = WideCharToMultiByte(CP_UTF8, 0, message->c_str(), static_cast<int>(message->length()), NULL, 0, NULL, NULL); if (mbsize > 0) { char *szMessage = (char*)malloc(mbsize); int bytes = WideCharToMultiByte(CP_UTF8, 0, message->c_str(), static_cast<int>(message->length()), szMessage, mbsize, NULL, NULL); result = send(serverSocket, szMessage, bytes, 0); DebugPrint(L"Capture-Server-sendMessage: Allocated: %i, Converted: %i, Sent: %i\n", mbsize, bytes, result); if(result == SOCKET_ERROR) { DebugPrint(L"Capture-Server-sendMessage: Socket Error %i: %s\n", WSAGetLastError(), szMessage); if(WSAGetLastError() == WSAENOTCONN) { setConnected(false); } } free(szMessage); } } }
void Ableton::setup(string abletonOscHost) { this->abletonOscHost = abletonOscHost; sender.setup(abletonOscHost, ABLETON_OSC_PORT_OUT); receiver.setup(ABLETON_OSC_PORT_IN); setConnected(true); setAutoUpdate(true); setAutoDraw(true); control.addToggle("Connected", &connected, this, &Ableton::eventSetConnected); // unusued control.addButton("Refresh", this, &Ableton::eventRefresh); GuiWidget *widgetGlobal = control.addWidget("Global"); widgetGlobal->addSlider("Tempo", &tempo, 4.0f, 999.0f, this, &Ableton::eventSetTempo); widgetGlobal->addSlider("Time", &time, 4.0f, 999.0f, this, &Ableton::eventSetTime); widgetGlobal->addSlider("Volume", &volume, 0.0f, 1.0f, this, &Ableton::eventSetVolume); widgetGlobal->addSlider("Pan", &pan, -1.0f, 1.0f, this, &Ableton::eventSetPan); widgetGlobal->addToggle("Overdub", &overdub, this, &Ableton::eventSetOverdub); GuiWidget *widgetPlayback = control.addWidget("Playback"); widgetPlayback->addButton("Prev cue", this, &Ableton::eventPrevCue); widgetPlayback->addButton("Next cue", this, &Ableton::eventNextCue); widgetPlayback->addButton("Play", this, &Ableton::eventPlay); widgetPlayback->addButton("Continue", this, &Ableton::eventPlayContinue); widgetPlayback->addButton("Play selection", this, &Ableton::eventPlaySelection); widgetPlayback->addButton("Stop", this, &Ableton::eventStop); scanLiveSet(); // REFRESH OPTION! // -> delete everything // -> redo scanLiveSet // CONNECTED variable }
/** * Initializes the temperature sensor. * This method is called when the sensor is first created and also any time the sensor reports it's disconnected. * If the result is TEMP_SENSOR_DISCONNECTED then subsequent calls to read() will also return TEMP_SENSOR_DISCONNECTED. * Clients should attempt to re-initialize the sensor by calling init() again. */ bool OneWireTempSensor::init(){ // save address and pinNr for log messages char addressString[17]; printBytes(sensorAddress, 8, addressString); uint8_t pinNr = oneWire->pinNr(); bool success = false; if (sensor==NULL) { sensor = new DallasTemperature(oneWire); if (sensor==NULL) { logErrorString(ERROR_SRAM_SENSOR, addressString); } } logDebug("init onewire sensor"); // This quickly tests if the sensor is connected and initializes the reset detection. // During the main TempControl loop, we don't want to spend many seconds // scanning each sensor since this brings things to a halt. if (sensor && sensor->initConnection(sensorAddress) && requestConversion()) { logDebug("init onewire sensor - wait for conversion"); waitForConversion(); temperature temp = readAndConstrainTemp(); DEBUG_ONLY(logInfoIntStringTemp(INFO_TEMP_SENSOR_INITIALIZED, pinNr, addressString, temp)); success = temp!=DEVICE_DISCONNECTED && requestConversion(); } setConnected(success); logDebug("init onewire sensor complete %d", success); return success; }
void JabberRoomChat::joined() { auto details = static_cast<ChatDetailsRoom *>(m_chat.details()); details->setConnected(true); emit joined(m_chat); }
void Player::setConnectionThread(Thread *th) { thread = th; connect(this, SIGNAL(toClient(QString)), thread, SLOT(toClient(QString))); connect(thread, SIGNAL(fromClient(QString)), this, SIGNAL(fromPlayer(QString))); qDebug() << "Thread Set!"; setConnected(true); }
void AAPIO::checkForFileTimeout() { Gate g(this, "checkForFileTimeout()"); QFile file("/dev/aap0"); bool exists = file.exists(); g.log() << "Exists" << exists; setConnected(exists); }
void CloudConnection::onConnected() { qCDebug(dcCloud()) << "Connected to cloud proxy server" << m_proxyServerUrl.toString(); m_error = Cloud::CloudErrorNoError; setConnected(true); m_reconnectionTimer->stop(); }
void JabberRoomChat::left() { auto details = static_cast<ChatDetailsRoom *>(m_chat.details()); details->setConnected(false); emit left(m_chat); }
void WESplClient::onConnect() { //TODO // update all the flags on Connect. // alert data can be send now // do not allow to connect back again. // when reconnect happens, reset the variables setRollbackRslt(0); setCleanupRslt(0); setCpiPassed(false); setCpiFailed(false); setContinue(true); setConnected(true); ByteStream bsWrite; bsWrite << (ByteStream::byte) WE_CLT_SRV_KEEPALIVE; try { this->write(bsWrite); // send the keep init keep alive } catch(...) { } // need to send Alarm fIpAddress = fClnt->addr2String(); }
void SGMUndulatorControl::updateConnected() { setConnected(encoderControl_->isConnected() && stepControl_->isConnected() && stepVelocityControl_->isConnected() && stepAccelerationControl_->isConnected()); }
// // connect() // void Socket::connect(const SocketAddress& endpoint, time_t timeout,const char* interface) throw(IllegalBlockingModeException, IllegalArgumentException, IOException) { // Comprueba si endpoint es referencia a un objeto InetSocketAddress const InetSocketAddress* addrptr = dynamic_cast<const InetSocketAddress*>(&endpoint); if (addrptr == NULL) { throw IllegalArgumentException("Invalid SocketAddress"); } try { Synchronized synchronized(_sync); { // Comprueba el modo de bloqueo del canal asociado, si existe if (_channel && _channel->isBlocking()==false) { throw IllegalBlockingModeException( "SocketChannel in non-blocking mode"); } // Invoca a la operacion connect de SocketImpl _impl->connect(endpoint, timeout,interface); setConnected(); } } catch(TIDThr::Exception& e) { throw IOException(e.what()); } }
DGLTreeView::DGLTreeView(QWidget* parrent, DglController* controller) : QDockWidget(tr("State Tree"), parrent), m_TreeWidget(this), m_controller(controller) { setObjectName("DGLTreeView"); // m_TreeWidget.setMinimumSize(QSize(200, 0)); setConnected(false); setWidget(&m_TreeWidget); // inbound CONNASSERT(controller, SIGNAL(setConnected(bool)), this, SLOT(setConnected(bool))); CONNASSERT(controller, SIGNAL(debugeeInfo(const std::string&)), this, SLOT(debugeeInfo(const std::string&))); CONNASSERT(controller, SIGNAL(setBreaked(bool)), &m_TreeWidget, SLOT(setEnabled(bool))); CONNASSERT(controller, SIGNAL(breakedWithStateReports( opaque_id_t, const std::vector< dglnet::message::utils::ContextReport>&)), this, SLOT(breakedWithStateReports( opaque_id_t, const std::vector< dglnet::message::utils::ContextReport>&))); // internal CONNASSERT(&m_TreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(onDoubleClicked(QTreeWidgetItem*, int))); }
bool StarbookDriver::Disconnect() { if (isConnected()) { bool rc = Telescope::Disconnect(); last_known_state = starbook::UNKNOWN; // Disconnection is successful, set it IDLE and updateProperties. if (rc) { setConnected(false, IPS_IDLE); updateProperties(); } else setConnected(true, IPS_ALERT); return rc; } else { return false; } }
//------------------------------------------------------------------------------ void WESplClient::onDisconnect() { //TODO // - set fContinue to false - set the thread free setContinue(false); setConnected(false); setRollbackRslt(-1); setCleanupRslt(-1); if((!fCpiPassed)&&(!fCpiFailed)) //a hard disconnection { fOwner.onCpimportFail(fPmId); fOwner.setDisconnectFailure(true); } // update all the flags of disconnect. // alert on roll back // do not allow to connect back again. try { // send alarm ALARMManager alarmMgr; //std::string alarmItem = sin_addr2String(fClnt->serv_addr().sin_addr); std::string alarmItem = fClnt->addr2String(); alarmItem.append(" WriteEngineServer"); alarmMgr.sendAlarmReport(alarmItem.c_str(), oam::CONN_FAILURE, SET); } catch(...) { // just ignore it for time being. } }
bool Server::connectToServer(bool startSenderAndReciever) { if(initialiseWinsock2()) { char sport[6]; size_t charsConverted; char szServerAddress[2048]; struct addrinfo aiHints; struct addrinfo *aiList = NULL; _itoa_s(port, sport, 6, 10); memset(&aiHints, 0, sizeof(aiHints)); aiHints.ai_family = AF_INET; aiHints.ai_socktype = SOCK_STREAM; aiHints.ai_protocol = IPPROTO_TCP; DebugPrint(L"Connecting to: %ls:%s\n", serverAddress.c_str(), sport); wcstombs_s(&charsConverted, szServerAddress, 512, serverAddress.c_str(), serverAddress.length() + 1); if ((getaddrinfo(szServerAddress, sport, &aiHints, &aiList)) == 0) { struct addrinfo *ai = aiList; struct sockaddr_in *sa = (struct sockaddr_in *) ai->ai_addr; serverSocket = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if(connect(serverSocket, (struct sockaddr *)sa, static_cast<int>(ai->ai_addrlen) ) != SOCKET_ERROR ) { u_long iMode = 1; //ioctlsocket(serverSocket, FIONBIO, &iMode); printf("Connected to server at %s\n", szServerAddress); setConnected(true); if(startSenderAndReciever) { serverReceive->start(); } freeaddrinfo(aiList); return true; } else { printf("Could not connect to server\n"); printf("\tSocket error: %i\n", WSAGetLastError()); } freeaddrinfo(aiList); } } setConnected(false); return false; }
bool SCI_Transporter::init_remote() { DBUG_ENTER("SCI_Transporter::init_remote"); sci_error_t err; Uint32 offset = 0; if(!m_mapped ) { DBUG_PRINT("info", ("Map remote segments")); for(Uint32 i=0; i < m_adapters ; i++) { m_TargetSegm[i].rhm[i].remoteHandle=0; SCIConnectSegment(sciAdapters[i].scidesc, &(m_TargetSegm[i].rhm[i].remoteHandle), m_remoteNodes[i], remoteSegmentId(localNodeId, remoteNodeId), i, 0, 0, 0, 0, &err); if(err != SCI_ERR_OK) { NdbSleep_MilliSleep(10); DBUG_PRINT("error", ("Error connecting segment, err 0x%x", err)); DBUG_RETURN(false); } } // Map the remote memory segment into program space for(Uint32 i=0; i < m_adapters ; i++) { m_TargetSegm[i].mappedMemory = SCIMapRemoteSegment((m_TargetSegm[i].rhm[i].remoteHandle), &(m_TargetSegm[i].rhm[i].map), offset, m_BufferSize, NULL, FLAGS, &err); if(err!= SCI_ERR_OK) { DBUG_PRINT("error", ("Cannot map a segment to the remote node %d. Error code 0x%x", m_RemoteSciNodeId, err)); //NDB SHOULD TERMINATE AND COMPUTER REBOOTED! report_error(TE_SCI_CANNOT_MAP_REMOTESEGMENT); DBUG_RETURN(false); } } m_mapped=true; setupRemoteSegment(); setConnected(); DBUG_PRINT("info", ("connected and mapped to segment, remoteNode: %d", remoteNodeId)); DBUG_PRINT("info", ("remoteSegId: %d", remoteSegmentId(localNodeId, remoteNodeId))); DBUG_RETURN(true); } else { DBUG_RETURN(getConnectionStatus()); } }
void IrcSessionPrivate::_q_error(QAbstractSocket::SocketError error) { Q_Q(IrcSession); qWarning() << "IrcSessionPrivate::_q_error():" << error; setConnected(false); setActive(false); emit q->socketError(error); }
void BaseRelationship::connectRelationship(void) { if(!connected) { setConnected(true); setCodeInvalidated(true); } }
void BaseRelationship::disconnectRelationship(void) { if(connected) { setConnected(false); setCodeInvalidated(true); } }