// ----------------------------------------------------------------------------- // CRegistrationMonitor::ConstructL // ----------------------------------------------------------------------------- // void CRegistrationMonitor::ConstructL() { // Look for phones, report failure if none was found TInt phones; User::LeaveIfError( iTelServer.Connect() ); User::LeaveIfError( iTelServer.EnumeratePhones( phones ) ); if( phones > 0 ) { // Get a phone RTelServer::TPhoneInfo phoneinfo; User::LeaveIfError( iTelServer.GetPhoneInfo( 0, phoneinfo ) ); User::LeaveIfError( iPhone.Open( iTelServer, phoneinfo.iName ) ); // Get current status TRequestStatus status; iPhone.GetNetworkRegistrationStatus( status, iRegistrationStatus ); User::WaitForRequest( status ); User::LeaveIfError( status.Int() ); iIsRegistered = IsRegistered(); // Start to monitor the status MonitorStatus(); } else { User::Leave( KErrNotSupported ); } }
// ----------------------------------------------------------------------------- // CCoverageMonitor::RunL // ----------------------------------------------------------------------------- // void CRegistrationMonitor::RunL() { TBool isRegistered = IsRegistered(); TInt errorCode = iStatus.Int(); MonitorStatus(); // Notify observers about state changes and errors if( ( isRegistered != iIsRegistered ) || ( errorCode != KErrNone ) ) { iIsRegistered = isRegistered; iObserver.MonitorStateChanged( errorCode ); } }
BOOL TestUrl(LPCTSTR pszURL) { if(_tcsnicmp(pszURL, _T("ed2k://"), 7) == 0) return TRUE; if(!MonitorStatus()) return FALSE; if(_tcsnicmp(pszURL, _T("http://"), 7) == 0 || _tcsnicmp (pszURL, _T("ftp://"), 6) == 0) { LPCTSTR pszDot = _tcsrchr(pszURL, '.'); if(pszDot == NULL || !IsSuitableExt(pszDot + 1)) return FALSE; return TRUE; } return FALSE; }