void CMLan::Check() { while(1) { Sleep(MLAN_SLEEP); EnterCriticalSection(&m_csAccessClass); TContact* cont = m_pRootContact; while (cont) { if (cont->m_status != ID_STATUS_OFFLINE) { if (cont->m_time) cont->m_time--; if (cont->m_time==MLAN_TIMEOUT) RequestStatus(true, cont->m_addr.S_un.S_addr); if (!cont->m_time) { cont->m_status = ID_STATUS_OFFLINE; MCONTACT hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false); if (hContact) { db_set_w(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE); } } } cont = cont->m_prev; } LeaveCriticalSection(&m_csAccessClass); } }
void CMLan::StopChecking() { EnterCriticalSection(&m_csAccessClass); if (m_hCheckThread) { TerminateThread(m_hCheckThread, 0); m_hCheckThread = NULL; } LeaveCriticalSection(&m_csAccessClass); EnterCriticalSection(&m_csReceiveThreadLock); m_mirStatus = ID_STATUS_OFFLINE; RequestStatus(false); StopListen(); LeaveCriticalSection(&m_csReceiveThreadLock); TFileConnection* fc = m_pFileConnectionList; while (fc) { fc->Terminate(); fc = fc->m_pNext; } while (m_pFileConnectionList) Sleep(10); SetAllOffline(); }
void FFrontendFilter_CheckedOut::ActiveStateChanged(bool bActive) { if(bActive) { RequestStatus(); } }
bool Wiimote::Step() { const bool has_focus = HAS_FOCUS; // TODO: change this a bit m_motion_plus_present = m_extension->settings[0]->value != 0; // no rumble if no focus if (false == has_focus) m_rumble_on = false; m_rumble->controls[0]->control_ref->State(m_rumble_on); // when a movie is active, this button status update is disabled (moved), because movies only record data reports. if(!(Movie::IsPlayingInput() || Movie::IsRecordingInput()) || NetPlay::IsNetPlayRunning()) { UpdateButtonsStatus(has_focus); } // check if there is a read data request if (!m_read_requests.empty()) { ReadRequest& rr = m_read_requests.front(); // send up to 16 bytes to the wii SendReadDataReply(rr); //SendReadDataReply(rr.channel, rr); // if there is no more data, remove from queue if (0 == rr.size) { delete[] rr.data; m_read_requests.pop(); } // dont send any other reports return true; } // check if a status report needs to be sent // this happens on wiimote sync and when extensions are switched if (m_extension->active_extension != m_extension->switch_extension) { RequestStatus(); // Wiibrew: Following a connection or disconnection event on the Extension Port, // data reporting is disabled and the Data Reporting Mode must be reset before new data can arrive. // after a game receives an unrequested status report, // it expects data reports to stop until it sets the reporting mode again m_reporting_auto = false; return true; } return false; }
bool Wiimote::Step() { // TODO: change this a bit m_motion_plus_present = m_extension->boolean_settings[0]->GetValue(); m_rumble->controls[0]->control_ref->State(m_rumble_on); // when a movie is active, this button status update is disabled (moved), because movies only // record data reports. if (!Core::g_want_determinism) { UpdateButtonsStatus(); } // check if there is a read data request if (!m_read_requests.empty()) { ReadRequest& rr = m_read_requests.front(); // send up to 16 bytes to the Wii SendReadDataReply(rr); // SendReadDataReply(rr.channel, rr); // if there is no more data, remove from queue if (0 == rr.size) { delete[] rr.data; m_read_requests.pop(); } // don't send any other reports return true; } // check if a status report needs to be sent // this happens on Wiimote sync and when extensions are switched if (m_extension->active_extension != m_extension->switch_extension) { RequestStatus(); // WiiBrew: Following a connection or disconnection event on the Extension Port, // data reporting is disabled and the Data Reporting Mode must be reset before new data can // arrive. // after a game receives an unrequested status report, // it expects data reports to stop until it sets the reporting mode again m_reporting_auto = false; return true; } return false; }
/*! * Sets the the selected personality through usbwatcher */ void UsbUiModelActive::SetUsbPersonality(int personality) { myDebug() << ">>> UsbUiModelActive::SetUsbPersonality"; myDebug() << "requested personality is "; myDebug() << personality; // Change the personality asynchrously, result checked in RunL() if( IsActive() ) { Cancel(); } myDebug() << "setting new personality"; iUsbWatcher.SetPersonality(RequestStatus(), personality); SetActive(); myDebug() << "<<< UsbUiModelActive::SetUsbPersonality"; }
void CMLan::StartChecking() { if (m_hCheckThread) return; TContact* cont = m_pRootContact; while (cont) { cont->m_time = MLAN_CHECK + MLAN_TIMEOUT; cont = cont->m_prev; } DWORD threadId; m_hCheckThread = CreateThread(NULL, 0, CheckProc, (LPVOID)this, 0, &threadId); StartListen(); RequestStatus(true); }
void CMLan::SetMirandaStatus(u_int status) { if (status==ID_STATUS_INVISIBLE) { ProtoBroadcastAck(PROTONAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)m_mirStatus, m_mirStatus); return; } u_int old_status = m_mirStatus; m_mirStatus = status; if (old_status==ID_STATUS_OFFLINE && m_mirStatus!=ID_STATUS_OFFLINE) { StartChecking(); } else if (old_status!=ID_STATUS_OFFLINE && m_mirStatus==ID_STATUS_OFFLINE) { StopChecking(); } else if (m_mirStatus!=ID_STATUS_OFFLINE && m_mirStatus!=old_status) { RequestStatus(false); } ProtoBroadcastAck(PROTONAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,(HANDLE)old_status,m_mirStatus); }