void DialerControl::newCall( const QPhoneCall& call ) { QPhoneCall c = call; c.connectStateChanged( this, SLOT(callStateChanged(QPhoneCall)) ); c.connectPendingTonesChanged( this, SIGNAL(pendingTonesChanged(QPhoneCall)) ); emit callCreated( c ); doActiveCalls(); callStateChanged( call ); //force an update }
/*! \internal */ QPhoneCall DialerControl::createCall( const QString& callType ) { QPhoneCall c = mCallManager->create(callType); c.connectStateChanged( this, SLOT(callStateChanged(QPhoneCall)) ); c.connectPendingTonesChanged( this, SIGNAL(pendingTonesChanged(QPhoneCall)) ); c.connectRequestFailed( this, SIGNAL(requestFailed(QPhoneCall,QPhoneCall::Request)) ); return c; }
void QPhoneHandler::setCallState(const QString &state) { m_callState = state; emit callStateChanged(); }
CarPI::CarPI(QObject * parent): QObject(parent) { qDebug() << "CarPI: Starting"; _sourceCurrent = sourceUnknown; _sourcePaused = false; /* Kontroler płyty głównej urządzenia */ _mainboard = MainBoard::getInstance(); /* Emulator wyświetlacza radia */ _displayEmulator = DisplayEmulator::getInstance(); /* Emulator zmieniarki CD */ _changerEmulator = ChangerEmulator::getInstance(); /* Kontroler modułu bluetooth */ _bluetooth = Bluetooth::getInstance(); /* Odtwarzacz MP3 */ _mp3Player = MP3Player::getInstance(); /* Nawigacja */ _navit = Navit::getInstance(); /* Interfejs OBD II */ _elm327 = Elm327::getInstance(); _atmosphericPressure = 100; /* Zakładamy ciśnienie 1000hPa */ connect(_mainboard, SIGNAL(radioPowerChanged(bool)), _displayEmulator, SLOT(radioPowerChanged(bool))); connect(_mainboard, SIGNAL(keyStateChanged(int)), this, SLOT(_pilotKeyStateChanged(int))); connect(_mainboard, SIGNAL(ignitionChanged(bool)), this, SLOT(_ignitionStateChanged(bool))); connect(_mainboard, SIGNAL(shutdown()), this, SLOT(shutdown())); connect(_displayEmulator, SIGNAL(displayTextChanged(QString)), this, SLOT(_displayTextChanged(QString))); connect(_displayEmulator, SIGNAL(displayIconsChanged(int)), this, SLOT(_displayIconsChanged(int))); connect(_displayEmulator, SIGNAL(displayMenuShow(int)), this, SLOT(_displayMenuShow(int))); connect(_displayEmulator, SIGNAL(displayMenuHide()), this, SLOT(_displayMenuHide())); connect(_displayEmulator, SIGNAL(displayMenuItemUpdate(int,QString,bool)), this, SLOT(_displayMenuSetItem(int,QString,bool))); connect(this, SIGNAL(radioNewKeyEvent(int)), _displayEmulator, SLOT(sendKeyEvent(int))); connect(_bluetooth, SIGNAL(connectionStateChanged(bool)), this, SLOT(_bluetoothConnectionStateChanged(bool))); connect(_bluetooth, SIGNAL(callStateChanged(BluetoothCallState,QString)), this, SLOT(_bluetoothCallStateChanged(BluetoothCallState,QString))); connect(_changerEmulator, SIGNAL(playbackStarted()), _mp3Player, SLOT(play())); connect(_changerEmulator, SIGNAL(playbackPaused()), _mp3Player, SLOT(pause())); connect(_changerEmulator, SIGNAL(playbackStopped()), _mp3Player, SLOT(stop())); connect(_changerEmulator, SIGNAL(nextTrack()), _mp3Player, SLOT(nextTrack())); connect(_changerEmulator, SIGNAL(prevTrack()), _mp3Player, SLOT(prevTrack())); connect(_changerEmulator, SIGNAL(loadCD(int)), this, SLOT(_changerEmulatorLoadCD(int))); connect(_mp3Player, SIGNAL(textChanged(QString)), this, SLOT(_mp3PlayerTextChanged(QString))); connect(this, SIGNAL(mp3PlayerNextAlbum()), _mp3Player, SLOT(nextAlbum())); connect(this, SIGNAL(mp3PlayerPrevAlbum()), _mp3Player, SLOT(prevAlbum())); connect(this, SIGNAL(mp3PlayerSwitchDisplayMode()), _mp3Player, SLOT(switchDisplayMode())); connect(_elm327, SIGNAL(pidValueChanged(int,QVector<int>)), this, SLOT(_elm327PidChanged(int,QVector<int>))); connect(_elm327, SIGNAL(voltageChanged(double)), this, SLOT(_elm327VoltageChanged(double))); connect(this, SIGNAL(elm327addWatchPid(int)), _elm327, SLOT(addWatchPid(int))); connect(this, SIGNAL(elm327start()), _elm327, SLOT(start())); connect(this, SIGNAL(elm327stop()), _elm327, SLOT(stop())); _mainboard->readState(); emit elm327addWatchPid(0x05); /* Temperatura wody */ emit elm327addWatchPid(0x04); /* Obciążenie silnika */ emit elm327addWatchPid(0x0B); /* Ciśnienie absolutne w kolektorze dolotowym */ emit elm327addWatchPid(0x0F); /* Temperatura powietrza w dolocie */ emit elm327addWatchPid(0x23); /* Ciśnienie paliwa */ }
//------------------------------------------------------------------------------ static tOplkError changeMode(tLeduMode newMode_p) { tOplkError ret; tLeduMode oldMode; tTimerArg timerArg; UINT32 timeout; BOOL fLedOn; ret = kErrorOk; oldMode = leduInstance_g.statusLedMode; if (oldMode != newMode_p) { // state changed -> save new mode leduInstance_g.statusLedMode = newMode_p; // Where are we coming from? if (oldMode == kLeduModeOff) { // status LED was off -> switch LED on fLedOn = TRUE; leduInstance_g.statusLedState = 0xFF; } else if (oldMode == kLeduModeOn) { // status LED was on -> switch LED off fLedOn = FALSE; leduInstance_g.statusLedState = 0; } else { // timer should be up and running return ret; } // select timeout corresponding to mode switch (newMode_p) { case kLeduModeFlickering: timeout = LEDU_DURATION_FLICKERING; break; case kLeduModeBlinking: timeout = LEDU_DURATION_BLINKING; break; case kLeduModeSingleFlash: case kLeduModeDoubleFlash: case kLeduModeTripleFlash: if (fLedOn == FALSE) timeout = LEDU_DURATION_FLASH_OFF; else timeout = LEDU_DURATION_FLASH_ON; break; default: return ret; // should not occur break; } // create new timer timerArg.eventSink = kEventSinkLedu; leduInstance_g.timerArg++; timerArg.argument.value = leduInstance_g.timerArg; ret = timeru_modifyTimer(&leduInstance_g.timerHdlLedBlink, timeout, timerArg); // call callback function ret = callStateChanged(kLedTypeStatus, fLedOn); } return ret; }
//------------------------------------------------------------------------------ tOplkError ledu_processEvent(tEvent* pEvent_p) { tOplkError ret; tTimerArg timerArg; UINT32 timeout = 0; BOOL fLedOn = FALSE; tTimerEventArg* pTimerEventArg; ret = kErrorOk; switch (pEvent_p->eventType) { // timer event case kEventTypeTimer: pTimerEventArg = (tTimerEventArg*)pEvent_p->pEventArg; if (pTimerEventArg->argument.value != leduInstance_g.timerArg) { // zombie timer, ignore it break; } leduInstance_g.statusLedState++; // select timeout and new LED state corresponding to mode switch (leduInstance_g.statusLedMode) { case kLeduModeInit: case kLeduModeOn: case kLeduModeOff: goto Exit; // should not occur break; case kLeduModeFlickering: if (leduInstance_g.statusLedState >= 2) { // reset state leduInstance_g.statusLedState = 0; fLedOn = FALSE; } else { fLedOn = TRUE; } timeout = LEDU_DURATION_FLICKERING; break; case kLeduModeBlinking: if (leduInstance_g.statusLedState >= 2) { // reset state leduInstance_g.statusLedState = 0; fLedOn = FALSE; } else { fLedOn = TRUE; } timeout = LEDU_DURATION_BLINKING; break; case kLeduModeSingleFlash: if (leduInstance_g.statusLedState >= 2) { // reset state leduInstance_g.statusLedState = 0; timeout = LEDU_DURATION_FLASH_OFF; fLedOn = FALSE; } else { timeout = LEDU_DURATION_FLASH_ON; fLedOn = ((leduInstance_g.statusLedState & 0x01) != 0x00) ? TRUE : FALSE; } break; case kLeduModeDoubleFlash: if (leduInstance_g.statusLedState >= 4) { // reset state leduInstance_g.statusLedState = 0; timeout = LEDU_DURATION_FLASH_OFF; fLedOn = FALSE; } else { timeout = LEDU_DURATION_FLASH_ON; fLedOn = ((leduInstance_g.statusLedState & 0x01) != 0x00) ? TRUE : FALSE; } break; case kLeduModeTripleFlash: if (leduInstance_g.statusLedState >= 6) { // reset state leduInstance_g.statusLedState = 0; timeout = LEDU_DURATION_FLASH_OFF; fLedOn = FALSE; } else { timeout = LEDU_DURATION_FLASH_ON; fLedOn = ((leduInstance_g.statusLedState & 0x01) != 0x00) ? TRUE : FALSE; } break; } // create new timer timerArg.eventSink = kEventSinkLedu; leduInstance_g.timerArg++; timerArg.argument.value = leduInstance_g.timerArg; ret = timeru_modifyTimer(&leduInstance_g.timerHdlLedBlink, timeout, timerArg); // call callback function ret = callStateChanged(kLedTypeStatus, fLedOn); break; default: ret = kErrorNmtInvalidEvent; } Exit: return ret; }
//------------------------------------------------------------------------------ tOplkError ledu_cbNmtStateChange(tEventNmtStateChange nmtStateChange_p) { tOplkError ret = kErrorOk; // activate status LED according to NMT state switch (nmtStateChange_p.newNmtState) { // status LED off case kNmtGsOff: case kNmtGsInitialising: case kNmtGsResetApplication: case kNmtGsResetCommunication: case kNmtGsResetConfiguration: case kNmtCsNotActive: case kNmtMsNotActive: if (leduInstance_g.statusLedMode != kLeduModeOff) { // state changed leduInstance_g.statusLedMode = kLeduModeOff; ret = timeru_deleteTimer(&leduInstance_g.timerHdlLedBlink); ret = callStateChanged(kLedTypeStatus, FALSE); } break; // status LED single flashing case kNmtCsPreOperational1: case kNmtMsPreOperational1: ret = changeMode(kLeduModeSingleFlash); break; // status LED double flashing case kNmtCsPreOperational2: case kNmtMsPreOperational2: ret = changeMode(kLeduModeDoubleFlash); break; // status LED triple flashing case kNmtCsReadyToOperate: case kNmtMsReadyToOperate: ret = changeMode(kLeduModeTripleFlash); break; // status LED on case kNmtCsOperational: case kNmtMsOperational: if (leduInstance_g.statusLedMode != kLeduModeOn) { // state changed leduInstance_g.statusLedMode = kLeduModeOn; ret = timeru_deleteTimer(&leduInstance_g.timerHdlLedBlink); ret = callStateChanged(kLedTypeStatus, TRUE); } break; // status LED blinking case kNmtCsStopped: ret = changeMode(kLeduModeBlinking); break; // status LED flickering case kNmtCsBasicEthernet: case kNmtMsBasicEthernet: ret = changeMode(kLeduModeFlickering); break; } // activate error LED according to NMT event switch (nmtStateChange_p.nmtEvent) { // error LED off case kNmtEventSwReset: // NMT_GT2 case kNmtEventStartNode: // NMT_CT7 case kNmtEventTimerBasicEthernet: // NMT_CT3 case kNmtEventEnterMsOperational: // NMT_MT5 ret = callStateChanged(kLedTypeError, FALSE); break; // error LED on case kNmtEventNmtCycleError: // NMT_CT11, NMT_MT6 case kNmtEventInternComError: // NMT_GT6 ret = callStateChanged(kLedTypeError, TRUE); break; default: // do nothing break; } return ret; }