// -----------------------------------------------------------------------------
// CPluginServiceTimer::ConstructL()
// -----------------------------------------------------------------------------
//
void CPluginServiceTimer::ConstructL()
	{
	DBG_FILE( _S8( "CPluginServiceTimer::ConstructL()" ) );
	// create a thread-relative timer
	User::LeaveIfError( iTimer.CreateLocal() );
	DBG_FILE( _S8( "CPluginServiceTimer::ConstructL() : end" ) );
	}
Ejemplo n.º 2
0
// -----------------------------------------------------------------------------
// CNSmlHTTP::DoCancel()
// DoCancel() from CActive
// -----------------------------------------------------------------------------
//
void CNSmlHTTP::DoCancel() 
	{DBG_FILE(_S8("CNSmlHTTP::DoCancel() BEGIN"));
	iEngineState = ExptIdle;
	TInt cancelReason;
	
	iShutdown->Cancel();
	iDialUpAgent->Cancel();
	iSess.Close();

	if( iTimeOut )
		{DBG_FILE(_S8("CNSmlHTTP::DoCancel() timing out"));
		cancelReason = TNSmlHTTPErrCode::ENSmlHTTPErr_RequestTimeout;
		}
	else
		{
		cancelReason = KErrCancel;
		}
	// signal current (engine) thread request semaphore that this AO's 
	// request has completed
	TRequestStatus* status = &iStatus;		
	User::RequestComplete( status, cancelReason );
	// signal agent
	TRequestStatus* agentStatus = iAgentStatus;
	User::RequestComplete( agentStatus, cancelReason );
	DBG_FILE(_S8("CNSmlHTTP::DoCancel() END"));
	}
Ejemplo n.º 3
0
// -----------------------------------------------------------------------------
// CNSmlHTTP::~CNSmlHTTP()
// desctructor
// -----------------------------------------------------------------------------
//
CNSmlHTTP::~CNSmlHTTP() 
	{
DBG_FILE(_S8("CNSmlHTTP::~CNSmlHTTP() BEGIN"));
if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement))
{
	DeleteCertificate(); 
}

	Cancel();
	delete iData;
	delete iReqBodySubmitBuffer;
	delete iURI;
	delete iMimeType;
	delete iHTTPusername;	
	delete iHTTPpassword;	
	delete iShutdown;
	iShutdown = NULL;
	if(iNetworkStatusEngine)
	{
		delete iNetworkStatusEngine;
		iNetworkStatusEngine = NULL;
	}
	iSess.Close();
	delete iTransObs;
	delete iDialUpAgent;
    delete iIAPidArray;
    FeatureManager::UnInitializeLib();
    DBG_FILE(_S8("CNSmlHTTP::~CNSmlHTTP() END"));
	}
// -----------------------------------------------------------------------------
// CPluginServiceTimer::StopTimer()
// -----------------------------------------------------------------------------
//
void CPluginServiceTimer::StopTimer()
	{
	DBG_FILE( _S8( "CPluginServiceTimer::StopTimer()" ) );
	iEngine->iSessionActive = ETrue;	
	DBG_FILE( _S8( "iSessiActive = ETrue" ) );
	DBG_FILE( _S8( "CPluginServiceTimer::StopTimer() : end" ) );
	}
Ejemplo n.º 5
0
void CATBase::ParseBufferLC()
//
//  Parses buffer
//
/**
 * This function is currently not used by the Etel regression test harness.
 */	{
	LOGTEXT(_S8("CATBase Parse the Buffer List"));
	iBuffer.Set(iIo->GetRxBufferLC(iBufferMarker));
	TInt pos=iBuffer.FindF(KOKString);
	if(pos==KErrNotFound)
		{
		LOGTEXT(_S8("CATBase Error - Cannot find OK'"));
		User::Leave(pos);
		}
	//	Place everything before the OK into buffer
	iBuffer.Set(iBuffer.Left(pos));

	TLex8 yyLex(iBuffer);
	TChar peek;
	//	Look for '=' sign and move seeker cursor to the right of it if it exists
	pos=iBuffer.Find(_L8("="));
	if (pos!=KErrNotFound)
		{
		yyLex.Inc(pos+1);
		}
	//	Move cursor past any spaces or open brackets
	yyLex.SkipSpace();
	peek=yyLex.Peek();
	if ((TUint)peek=='(' || (TUint)peek=='[' || (TUint)peek=='{')
		yyLex.Inc();

	yyLex.SkipSpace();
	peek = yyLex.Peek();
	do
		{
		// Search for the next character that is not a comma, and mark it. Keep looking at 
		// subsequent characters until it is a space,comma,closing bracket or end of string.
		// Store the string (between marked character and current character) as an item in
		// an array of CATParamListEntry object pointers.
		if (peek!=',')
			{
			yyLex.Mark();
			do
				{
				yyLex.Inc();
				peek=yyLex.Peek();
				}
			while (peek!=',' && !peek.IsSpace() && peek!=')'&& peek!=']'&& peek!='}' && !yyLex.Eos());
			CATParamListEntry* aParamListEntry = new (ELeave) CATParamListEntry(yyLex.MarkedToken());
			iRxResults.AddLast(*aParamListEntry);
			}
		// Move cursor to the next non-space character, and end the loop if it is a closing
		// bracket or the end of the buffer.
		yyLex.Inc();
		yyLex.SkipSpace();
		peek = yyLex.Peek();
		}
	while (!yyLex.Eos() && peek!=')'&& peek!=']'&& peek!='}');
	}
void CNsmlNetworkStatusEngine::ConstructL( )
{
	DBG_FILE(_S8("CNsmlNetworkStatusEngine::ConstructL, BEGIN "));
	iTimerOn = EFalse;
	iConnectionMonitor.ConnectL();
	iTimedExecuteStopSession = NULL;
	DBG_FILE(_S8("CNsmlNetworkStatusEngine::ConstructL, END "));	 
}
// -----------------------------------------------------------------------------
// CNsmlNetworkStatusEngine::StopDMSession()
// Stops DM session by calling http cancel 
// -----------------------------------------------------------------------------
//	
void CNsmlNetworkStatusEngine::StopDMSession()
	{
	DBG_FILE(_S8("CNsmlNetworkStatusEngine::StopDMSession STARTS   "));
	iTimerOn = EFalse;
	DBG_FILE(_S8("CNsmlNetworkStatusEngine::StopDMSession calling http->Cancel"));
	iAgent->iTimeOut =ETrue; //added for showing timeout note
	iAgent->Cancel();
	DBG_FILE(_S8("CNsmlNetworkStatusEngine::StopDMSession ENDS    "));
	}
// -----------------------------------------------------------------------------
// CPluginServiceTimer::RunL()
// -----------------------------------------------------------------------------
//
void CPluginServiceTimer::RunL()
	{
	DBG_FILE( _S8( "CPluginServiceTimer::RunL()" ) );
	iEngine->iSessionActive = EFalse;
	DBG_FILE( _S8( "iSessionActive = EFalse" ) );
	iEngine->iStartTimer = EFalse;
	DBG_FILE( _S8( "iStartTimer = EFalse" ) );
	DBG_FILE( _S8( "CPluginServiceTimer::RunL() : end" ) );
	}
void CNsmlNetworkStatusEngine::NotifyL()
{
	DBG_FILE(_S8("CNsmlNetworkStatusEngine::NotifyL Begin  "));
	iConnectionMonitor.NotifyEventL( *this );
	DBG_FILE(_S8("CNsmlNetworkStatusEngine::NotifyL, after registering  "));
   // Threholds
	TInt    err = iConnectionMonitor.SetUintAttribute( EBearerIdGPRS, 
                                               0, 
                                               KSignalStrengthThreshold, 
                                               1 );    
	DBG_FILE(_S8("CNsmlNetworkStatusEngine::NotifyL : END "));
                                                                                          
}
// -----------------------------------------------------------------------------
// CPluginServiceTimer::StartTimer()
// -----------------------------------------------------------------------------
//
void CPluginServiceTimer::StartTimer()
	{
	DBG_FILE( _S8( "CPluginServiceTimer::StartTimer()" ) );
	if( !IsActive() )
		{
		DBG_FILE( _S8( "!IsActive()" ) );
		iTimer.After( iStatus, TTimeIntervalMicroSeconds32( iValue ) );
		iEngine->iSessionActive = ETrue;
		SetActive();
		DBG_FILE( _S8( "SetActive()" ) );
		}

	DBG_FILE( _S8( "CPluginServiceTimer::StartTimer() : end" ) );
	}
CNsmlNetworkStatusEngine::~CNsmlNetworkStatusEngine( )
{
	DBG_FILE(_S8("~CNsmlNetworkStatusEngine Destructor starts  "));
	StopNotify();
	iConnectionMonitor.Close();
	if ( iTimedExecuteStopSession ) 
    {
     iTimedExecuteStopSession->Cancel();
     delete iTimedExecuteStopSession;
     iTimedExecuteStopSession = NULL;
     }
    DBG_FILE(_S8("~CNsmlNetworkStatusEngine Destructor ENDs  "));     
            
}
Ejemplo n.º 12
0
//------------------------------------------------------------
// CNsmlObexClient::SendDataL( TDesC8& aStartPtr, TBool /*aFinalPacket*/, TRequestStatus &aStatus )
//------------------------------------------------------------
void CNsmlObexClient::SendDataL( TDesC8& aStartPtr, TBool /*aFinalPacket*/, TRequestStatus &aStatus )
    {
	iAgentStatus = &aStatus;
	// agent
	*iAgentStatus = KRequestPending;

	if ( iState == EWaitingToReceive )
		{
		iClient->Abort();
		iState = EWaitingToSend;
		}
    if ( iState != EWaitingToSend )
        {
        User::Leave( KErrDisconnected );
        }
    else if ( IsActive() ) 
        {
        User::Leave( KErrInUse );
        }

    iCurrObject->Reset();
	
	DBG_DUMP((void*)aStartPtr.Ptr(), aStartPtr.Length(), 
	        _S8("SendDataL (WBXML)") );
#ifdef __NSML_DEBUG__
	_DBG_FILE("CNsmlObexClient::SendDataL: CWbxml2XmlConverter::ConvertL() begin");
	CWbxml2XmlConverter* c = CWbxml2XmlConverter::NewLC();
	c->ConvertL(aStartPtr.Ptr(), aStartPtr.Length());
	DBG_DUMP((void*)c->Document().Ptr(), c->Document().Length(), 
	        _S8("SendDataL (XML)") );
	CleanupStack::PopAndDestroy(); // c
	_DBG_FILE("CNsmlObexClient::SendDataL: CWbxml2XmlConverter::ConvertL() end");
#endif // __NSML_DEBUG__
		        
	iDocumentLength = aStartPtr.Length();

	iDataBuf->Reset();
	iDataBuf->InsertL( 0, aStartPtr );
    TRAPD( err, iCurrObject->SetDataBufL( iDataBuf ) );

    if( KErrNone == err )
		{
        TBuf8<KNameLen> str;
		str.Copy( this->iMimeType->Des() );
        iCurrObject->SetTypeL( str );

        iClient->Put( *iCurrObject, iStatus );
		SetActive ();
		}
    }
Ejemplo n.º 13
0
void CATBase::ValidateExpectStringL()
/**
 * This function is currently not used by the Etel regression test harness.
 */
	{
	if(iIo->FoundChatString()==iErrorExpectString)
		{
		LOGTEXT(_S8("CATBase Modem returned ERROR in response to command"));
		User::Leave(KErrGeneral);
		}
	if(iIo->FoundChatString()==iOKExpectString)
		return;
	LOGTEXT(_S8("CATBase Modem returned unexpected response to command"));
	User::Leave(KErrUnknown);
	}
static TInt StaticDoStopDMSession(TAny *aPtr)
    {

    DBG_FILE(_S8("StaticDoStopDMSession start "));
               
    CNsmlNetworkStatusEngine* srv = (CNsmlNetworkStatusEngine*) aPtr;
    TRAPD( err,  srv->StopDMSession() );
    if(err) 
        {
       	DBG_FILE_CODE(err,_S8("StaticDoStopDMSession err after calling StopDMSession"));
        }

    DBG_FILE(_S8(" StaticDoStopDMSession ENDS "));
    return err;
    }
Ejemplo n.º 15
0
void CATBase::RemoveStdExpectStrings()
/**
 * This function is currently not used by the Etel regression test harness.
 */
	{
	LOGTEXT(_S8("RemoveStdExpectStrings()"));
	iIo->RemoveExpectString(iOKExpectString);
	iOKExpectString=NULL;
	iIo->RemoveExpectString(iErrorExpectString);
	iErrorExpectString=NULL;
	}
Ejemplo n.º 16
0
//------------------------------------------------------------
// CNsmlObexClient::ReceiveDataL( TDes8& aStartPtr, TRequestStatus &aStatus )
//------------------------------------------------------------
void CNsmlObexClient::ReceiveDataL( TPtr8& aStartPtr, TRequestStatus &aStatus )
    {
	iAgentStatus = &aStatus;
	// agent
	*iAgentStatus = KRequestPending;
	
	iDataPtr.Set( aStartPtr );

    if ( iState != EWaitingToReceive )
        {
        User::Leave( KErrDisconnected );
        }
    else if ( IsActive() ) 
        {
        User::Leave( KErrInUse );
        }
	iDataBuf->Reset();
	iCurrObject->Reset();

	TBuf8<KNameLen> str;
	str.Copy( this->iMimeType->Des() );
	iCurrObject->SetTypeL( str );

	iClient->Get( *iCurrObject, iStatus );
	
	DBG_DUMP((void*)aStartPtr.Ptr(), aStartPtr.Length(), 
	_S8("ReceiveDataL (WBXML)"));
#ifdef __NSML_DEBUG__
	_DBG_FILE("CNsmlObexClient::ReceiveDataL: CWbxml2XmlConverter::ConvertL()\
	 begin");
	CWbxml2XmlConverter* c = CWbxml2XmlConverter::NewLC();
	c->ConvertL(aStartPtr.Ptr(), aStartPtr.Length());
	DBG_DUMP((void*)c->Document().Ptr(), c->Document().Length(), 
	_S8("ReceiveDataL (XML)") );
	CleanupStack::PopAndDestroy(); // c
	_DBG_FILE("CNsmlObexClient::ReceiveDataL: CWbxml2XmlConverter::ConvertL() end");
#endif // __NSML_DEBUG__

	SetActive ();
    }
Ejemplo n.º 17
0
// ---------------------------------------------------------
// CNSmlDSAlert::StartSync( const TDesC8& aSyncMLMessage, TInt aTransport, TBTDevAddr aBTAddress,
//    						const TDesC& aBTName, MNSmlAlertObexPluginContext* aPluginContext )
// Both standards supported (1.1 and 1.2)
// ---------------------------------------------------------
//
	TNSmlAlertResult CNSmlDSAlert::StartSyncL(
    const TDesC8& aSyncMLMessage,
    TInt aTransport,
    TBTDevAddr /* aBTAddress */,
    const TDesC& /* aBTName */,
    MNSmlAlertObexPluginContext* /* aPluginContext */)
 	{
	DBG_FILE(_S8("CNSmlDSAlert::StartSync begins"));
	// Handling 1.2 Notification package
	//==================================
	TSmlProtocolVersion protocol(ESmlVersion1_2);
		
	if ( ! Is12Package( aSyncMLMessage ) )
		{
		// Handling 1.1 Package0
		//======================
		TRAPD( parseErr, ParseMessageL( aSyncMLMessage ) );
		if ( ( parseErr != KErrNone ) || (iPacketShouldGoToMdo) )
			{
			// It may be MDO package
			return TNSmlAlertResult( ENSmlErrNotConsumed );
			}
		
		protocol = ESmlVersion1_1_2;
		
		}
	
	RNSmlPrivateAPI privateApi;
	TRAPD(openErr, privateApi.OpenL());
	
	if ( openErr != KErrNone )
		{
		return ENSmlErrUndefined;
		}
	
	const TUid transportId = { aTransport };
 	
	TRAPD(connErr, privateApi.SendL(aSyncMLMessage, ESmlDataSync, 
	        protocol, transportId ));
	
	if ( connErr != KErrNone )
		{
		privateApi.Close();
		return ENSmlErrUndefined;
		}
		
	privateApi.Close();
	
	return ENSmlErrNone;
	}
Ejemplo n.º 18
0
class CDesC8Array& WFArrayUtil::CopyArrayL(class CDesC8Array& aDst, 
                                           const char*const* aSrc,
                                           TInt aSrcSize)
{
   const TInt minSize = Min(aDst.Count(), aSrcSize);
   for(TInt i = 0; i < minSize; ++i){
      const TText8* tt = reinterpret_cast<const TText8*>(aSrc[i]);
      const TPtrC8 ptr(tt ? tt : _S8(""));
      if(aDst[i] != ptr){
         aDst.InsertL(i, ptr);
         aDst.Delete(i + 1);
      }
   }
   for(TInt j = minSize; j < aSrcSize; ++j){
      const TText8* tt = reinterpret_cast<const TText8*>(aSrc[j]);
      const TPtrC8 ptr(tt ? tt : _S8(""));
      aDst.AppendL(ptr);
   }
   if(aSrcSize < aDst.Count()){
      aDst.Delete(aSrcSize, aDst.Count() - aSrcSize);
      aDst.Compress();
   }
   return aDst;
}
Ejemplo n.º 19
0
GLDEF_C void TestCopy8()
//	Test TPtr8 copy constructor
	{
    TBuf8<0x20> buf(_S8("Paddington Station"));
	TPtr8 ptr1((TText8*)buf.Ptr(),buf.Length(),buf.MaxLength());
	TPtr8 ptr2(ptr1);
	ptr2[11]='B';
	ptr2[12]='e';
	ptr2[13]='a';
	ptr2[14]='r';
	ptr2[15]=' ';
	ptr1.SetLength(15);
	ptr2.Append(_L8(" acid"));
	ptr1.__DbgTestInvariant();
	ptr2.__DbgTestInvariant();
	test(ptr1==_L8("Paddington Bear"));
	test(ptr2==_L8("Paddington Bear on acid"));
	}
/*!
 * Fetch contact
 */
TInt CNsmlContactsDataStoreExtensionPrivate::ExportContactsL( const TUid &uid, CBufBase &contactbufbase )
{
    DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL: BEGIN: UID: %d"), uid);
   
    TInt error(KErrNone);
    QList<QContact> contacts;
    QBuffer contactsbuf;
    contactsbuf.open(QBuffer::ReadWrite);    
    mWriter->setDevice( &contactsbuf );  
    QContact contact = mContactManager->contact( uid.iUid );
    error = mContactManager->error();
    if( error != QContactManager::NoError )
        {
        DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL:Error %d"), error );
        return error; 
        }
	contacts.append( contact );    
    
    if( mExporter->exportContacts( contacts, QVersitDocument::VCard21Type ) )
        {
        QList<QVersitDocument> documents = mExporter->documents();        
        mWriter->startWriting( documents );
        bool status = mWriter->waitForFinished();  
        DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL:status %d"), status);  
        HBufC8* buf = XQConversions::qStringToS60Desc8( contactsbuf.data() );
        contactbufbase.InsertL( contactbufbase.Size(), *buf );
        delete buf;
        }
    else
        {
        error = KErrGeneral;
        DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL:Error in exporting %d"), error );
        }
    
    TPtr8 ptrbuf(contactbufbase.Ptr(0));
    DBG_DUMP( (void*)ptrbuf.Ptr(), ptrbuf.Length(),
           _S8("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL: From DB:"));  
    
    _DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::ExportContactsL: END");
    
    return error;
}
Ejemplo n.º 21
0
GLDEF_C void Test16To8()
//	Test ASCII dest with Unicode source
	{
    TBuf8<0x20> buf(_S8("Paddington Station"));
	TPtr8 ptr1((TText8*)buf.Ptr(),buf.Length(),buf.MaxLength());
	ptr1.__DbgTestInvariant();
	TPtr8 ptr2(ptr1);
	ptr2.__DbgTestInvariant();
	ptr2[11]='B';
	ptr2[12]='e';
	ptr2[13]='a';
	ptr2[14]='r';
	ptr2[15]=' ';
	ptr1.SetLength(15);
	ptr1.__DbgTestInvariant();
	ptr2.Append(_L16(" acid"));
	ptr2.__DbgTestInvariant();
	test(ptr1==_L8("Paddington Bear"));
	test(ptr2==_L8("Paddington Bear on acid"));
	}
/*!
 * Store contact
 */
CArrayFixFlat<TUid>* CNsmlContactsDataStoreExtensionPrivate::ImportContactsL( const TDesC8 &contactbufbase )
{
    _DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL: BEGIN");    

    DBG_DUMP((void*)contactbufbase.Ptr(), contactbufbase.Length(),
        _S8("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL: To DB :"));      
    
    TBool ret( ETrue );
    CArrayFixFlat<TUid>* contactItems = new(ELeave) CArrayFixFlat<TUid>(4);
    QBuffer contactsbuf;
    contactsbuf.open(QBuffer::ReadWrite);
    QByteArray bytearray((char*)contactbufbase.Ptr());
    
    contactsbuf.write(bytearray);
    contactsbuf.seek(0);
    
    mReader->setDevice(&contactsbuf);
    if (mReader->startReading() && mReader->waitForFinished()) 
        {
        DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Buffer Count: %d"), mReader->results().count() );
        
        QList<QContact> contacts;
        if ( mImporter->importDocuments( mReader->results() ) )
            {
            contacts = mImporter->contacts();
            QMap<int, QContactManager::Error> errorMap;
            ret = mContactManager->saveContacts( &contacts, &errorMap );           
            DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Import Status: %d"), ret );
            }
        if( ret )
            {
            foreach (QContact contact, contacts ) 
                {
                TUint contactid = contact.id().localId();
                
                DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Contact ID: %d"), contactid );
                
                contactItems->AppendL( TUid::Uid( contactid ) );
                }
            }
Ejemplo n.º 23
0
// -----------------------------------------------------------------------------
// CNSmlHTTP::CompleteRequest()
// called when asynchronous request should be completed with a purpose
// -----------------------------------------------------------------------------
//
void CNSmlHTTP::CompleteRequest()
{
	DBG_FILE(_S8("CNSmlHTTP::CompleteRequest BEGIN"));
		
		if(IsActive())
		{
		DBG_FILE(_S8("CNSmlHTTP::CompleteRequest iTrans.Cancel();"));
		iTrans.Cancel();
		DBG_FILE(_S8("CNSmlHTTP::CompleteRequest iTrans.Close();"));
		iTrans.Close();
		DBG_FILE(_S8("CNSmlHTTP::CompleteRequest isActive returned TRUE  "));
		iPreemptRequest++;
		DBG_FILE_CODE( iPreemptRequest, _S8("Increasing value of iPreemptRequest ") );
				TRequestStatus* status = &iStatus;
		User::RequestComplete( status, KErrTimedOut );
		}

	DBG_FILE(_S8("CNSmlHTTP::CompleteRequest ENDS "));
}
Ejemplo n.º 24
0
// CNSmlHTTP::RunL()
// Runl() from CActive
// called when asynchronous request completed
// -----------------------------------------------------------------------------
//
void CNSmlHTTP::RunL() 
	{
	DBG_FILE(_S8("CNSmlHTTP::RunL begins"));

	DBG_FILE_CODE( iEngineState, _S8("RunL iEgnineStatus is : ") );
	DBG_FILE_CODE( iStatus.Int(), _S8("RunL httpClient status is : ") );
	if(iEngineState == ExptOpenCommunication)
		{
		DBG_FILE(_S8("CNSmlHTTP::RunL before SetHttpConnectionInfoL"));
		DBG_FILE_CODE( iStatus.Int(), _S8("RunL HTTP client iStatus: ") );
		if( iStatus == KErrNone) 
			{  
			DBG_FILE(_S8("CNSmlHTTP::RunL Status was NO ERROR"));
			TRAPD( ret, SetHttpConnectionInfoL( EFalse ) );
			if ( ret != KErrNone )
				{
				DBG_FILE_CODE( ret, _S8("CNSmlHTTP::RunL SetHttpConnectionInfoL\
				 error:") );
				iShutdown->Cancel();
				TRequestStatus* status = iAgentStatus;
				User::RequestComplete( status, ret );
				iTimeOut = EFalse;
				return;
				}
// -----------------------------------------------------------------------------
// CPluginServiceTimer::DoCancel()
// -----------------------------------------------------------------------------
//
void CPluginServiceTimer::DoCancel()
	{
	DBG_FILE( _S8( "CPluginServiceTimer::DoCancel()" ) );
	iTimer.Cancel();
	DBG_FILE( _S8( "CPluginServiceTimer::DoCancel() : end" ) );
	}
// -----------------------------------------------------------------------------
// CPluginServiceTimer::~CPluginServiceTimer()
// -----------------------------------------------------------------------------
//
CPluginServiceTimer::~CPluginServiceTimer()
	{
	DBG_FILE( _S8( "CPluginServiceTimer::~CPluginServiceTimer()" ) );
	iTimer.Close();
	DBG_FILE( _S8( "CPluginServiceTimer::~CPluginServiceTimer() : end" ) );
	}
Ejemplo n.º 27
0
void CT_ISO2022JP1_2::TestIso2022Jp(CCnvCharacterSetConverter * characterSetConverter, TBool isS60version)
    {
    //
    INFO_PRINTF1(_L("Empty descriptor"));
    TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 0, 10, 0, KNullDesC8, KNullDesC8, KNullDesC16);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 0, 10, 0, 0, KNullDesC16, KNullDesC8);
    INFO_PRINTF1(_L("Testing converting to ISO-2022-JP"));

    _LIT(KTestUnicode,">.@>0l90");
    _LIT(KTestUnicode2,"\x0393\x03b1\x03c3\x03bf\x03c5\x3055\x3088");
    TestConversionFromUnicodeToIso(*characterSetConverter, KTestUnicode2);
    TestConversionFromUnicodeToIso(*characterSetConverter, KTestUnicode);
    
    TBuf16<50> originalUnicode;
    originalUnicode.Format(_L16("%c%c%c%c%c\xa5%c%c%c%c%c"), 0x0393, 0x03b1, 0x03c3, 0x03bf, 0x03c5, 0x3055, 0x3088, 0x3046, 0x306a, 0x3089);
    TestTruncatedConversionFromUnicodeToIso2022Jp(*characterSetConverter, originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 3, 7, 12, _L8(""), _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 8, 9, 11, _L8("\x1b\x24\x42\x26\x23\x1b\x28\x42"), _L8("\x1b\x24\x42\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 10, 11, 10, _L8("\x1b\x24\x42\x26\x23\x26\x41\x1b\x28\x42"), _L8("\x1b\x24\x42\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 12, 13, 9, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x1b\x28\x42"), _L8("\x1b\x24\x42\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 14, 15, 8, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x1b\x28\x42"), _L8("\x1b\x24\x42\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 16, 19, 7, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x42"), _L8("\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//    TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 20, 23, 6, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42"), _L8("\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 24, 28, 5, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\"), _L8("\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 29, 30, 4, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x1b\x28\x42"), _L8("\x1b\x24\x42\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 31, 32, 3, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x1b\x28\x42"), _L8("\x1b\x24\x42\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 33, 34, 2, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x1b\x28\x42"), _L8("\x1b\x24\x42\x24\x4a\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 35, 36, 1, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x1b\x28\x42"), _L8("\x1b\x24\x42\x24\x69\x1b\x28\x42"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 37, 50, 0, _L8("\x1b\x24\x42\x26\x23\x26\x41\x26\x52\x26\x4f\x26\x54\x1b\x28\x4a\\\x1b\x28\x42\\\x1b\x24\x42\x24\x35\x24\x68\x24\x26\x24\x4a\x24\x69\x1b\x28\x42"), KNullDesC8, originalUnicode);
    originalUnicode.Format(_L16("%cX%cY%cZ"), 0x6153, 0x6376, 0x65d9);
    TestTruncatedConversionFromUnicodeToIso2022Jp(*characterSetConverter, originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 3, 7, 6, _L8(""), _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 8, 11, 5, _L8("\x1b\x24\x42XX\x1b\x28\x42"), _L8("X\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 12, 16, 4, _L8("\x1b\x24\x42XX\x1b\x28\x42X"), _L8("\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 17, 20, 3, _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42"), _L8("Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 21, 25, 2, _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42Y"), _L8("\x1b\x24\x42ZZ\x1b\x28\x42Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 26, 29, 1, _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42"), _L8("Z"), originalUnicode);
//  TestSplittingConvertingFromUnicodeToIso2022Jp(*characterSetConverter, 30, 40, 0, _L8("\x1b\x24\x42XX\x1b\x28\x42X\x1b\x24\x42YY\x1b\x28\x42Y\x1b\x24\x42ZZ\x1b\x28\x42Z"), KNullDesC8, originalUnicode);
    INFO_PRINTF1(_L("Testing converting to Unicode"));
    const TPtrC8 originalIso2022Jp(_S8("\x1b\x24\x40\x1b\x28\x4aMy name is \x1b\x28\x4a\x1b\x28\x42\x1b\x24\x40\x25\x47\x25\x23\x25\x53\x25\x45\x1b\x28\x4a in \x1b\x24\x42\x46\x7c\x4b\x5c\x38\x6c\x1b\x28\x42\\~\x1b\x28\x4a\\~"));
    TBuf16<50> expectedUnicode;
    if (!isS60version)        
        expectedUnicode.Format(_L16("My name is %c%c%c%c in %c%c%c\\~%c%c"), 0x30c7, 0x30a3, 0x30d3, 0x30c5, 0x65e5, 0x672c, 0x8a9e, 0x00a5, 0x203e);
    else
        expectedUnicode.Format(_L16("My name is %c%c%c%c in %c%c%c\\~%c%c"), 0x30c7, 0x30a3, 0x30d3, 0x30c5, 0x65e5, 0x672c, 0x8a9e, 0x00a5, 0x7e);
    TestTruncatedConversionToUnicodeFromIso2022Jp(*characterSetConverter, expectedUnicode, originalIso2022Jp);
    TestTruncatedConversionToUnicodeFromIso2022Jp(*characterSetConverter, _L16(" Hello"), _L8("\x1b\x24\x42\x1b\x28\x4a\x1b\x24\x42\x1b\x28\x4a\x1b\x24\x42\x1b\x28\x4a Hello"));
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 0, 0, 60, 0, expectedUnicode, originalIso2022Jp);
    for (int i=1; i<=10; ++i)
        {
        TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, i, i, 54-i, i, expectedUnicode, originalIso2022Jp);
        }
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 11, 11, 34, 11, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 12, 12, 32, 12, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 13, 13, 30, 13, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 14, 14, 28, 14, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 15, 15, 23, 15, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 16, 16, 22, 16, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 17, 17, 21, 17, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 18, 18, 20, 18, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 19, 19, 16, 19, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 20, 20, 14, 20, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 21, 21, 12, 21, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 22, 22, 7, 22, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 23, 23, 6, 23, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 24, 24, 2, 24, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 25, 25, 1, 25, expectedUnicode, originalIso2022Jp);
    TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, 26, 40, 0, 26, expectedUnicode, originalIso2022Jp);
    INFO_PRINTF1(_L("Testing the default ISO-2022-JP state"));
    for (int i=0; i<=6; ++i)
        {
        TestSplittingConvertingToUnicodeFromIso2022Jp(*characterSetConverter, i, i, 6-i, i, _L16("Hello\xa5"), _L8("Hello\\"));
        }
    INFO_PRINTF1(_L("Testing ill-formed ISO-2022-JP"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24\x42\x21\x1b\x28\x4a def"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24\x42\x21\x21\x21\x1b\x28\x4a def"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24\x42\x21\x21\x21\x21\x21\x1b\x28\x4a def"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x24\xff"));
    TestIsIllFormedIso2022Jp(*characterSetConverter, _L8("abc \x1b\x26\x40"));
    }
Ejemplo n.º 28
0
//
// Description:
//

#include <s32file.h>
#include <s32crypt.h>
#include <e32test.h>
#include <s32mem.h>
#include <pbedata.h>
#include <pbe.h>

const TInt KTestCleanupStack=0x20;

// This is a path specification and should not be used as is
_LIT(KFileLocationSpec, "Z:\\STOR-TST\\T_CRYPT.DAT");
const TUint8* KTestData=_S8("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
const TInt KTestLength=36;
const TInt KTestTotal=KTestLength*(KTestLength+1);
const TPtrC8 KTestDes(KTestData,KTestLength);
const TPBPassword KTestPassword(_L("The password"));

LOCAL_D CTrapCleanup* TheTrapCleanup;
LOCAL_D RTest test(_L("t_storcrypt"));
LOCAL_D RFs TheFs;
LOCAL_D TStreamId TheTempId;
LOCAL_D TBuf8<KTestLength+1> TheBuf;

LOCAL_D CPBEncryptSet* thePBEKey;

/**
@SYMTestCaseID          SYSLIB-STORE-CT-1126
Ejemplo n.º 29
0
    TInt iResId;            ///< Resource id.
    };

// ================= CONSTANTS =======================

/// Number of bytes in a kilobyte.
LOCAL_D const TInt KCodKbyte = 1024;

/**
* Null-terminated MIME-to-resId mapping table.
* Order of entries is important (from most specific to most generic), as
* entries are evaluated linearly.
*/
LOCAL_D const TMimeAndResId KCodMimeAndResIds[] =
    {
        { _S8( "application/vnd.nokia.ringing-tone" ),  R_QTN_CD_TYPE_RTONE },
        { _S8( "application/x-nokiaGameData" ),         R_QTN_CD_TYPE_GAME_LEVEL },
        { _S8( "application/vnd.oma.drm" ),             R_QTN_CD_TYPE_NOT_CLASSIFIED },
        { _S8( "application/" ),                        R_QTN_CD_TYPE_APPLICATION },
        { _S8( "image/vnd.nokia.ota-bitmap" ),          R_QTN_CD_TYPE_OPERATOR_LOGO },
        { _S8( "image/vnd.nok-oplogo" ),                R_QTN_CD_TYPE_OPERATOR_LOGO },
        { _S8( "image/vnd.nok-picturemessage" ),        R_QTN_CD_TYPE_PICTURE_MESSAGE },
        { _S8( "image/" ),                              R_QTN_CD_TYPE_IMAGE },
        { _S8( "audio/" ),                              R_QTN_CD_TYPE_SOUND },
        { _S8( "text/X-vCard" ),                        R_QTN_CD_TYPE_VCARD },
        { _S8( "text/" ),                               R_QTN_CD_TYPE_DOCUMENT },
        { _S8( "" ),                                    R_QTN_CD_TYPE_NOT_CLASSIFIED },
        { NULL,                                         0 }                                     
    };

// ================= MEMBER FUNCTIONS =======================
void CNsmlNetworkStatusEngine::EventL( const CConnMonEventBase& aConnMonEvent )
{

	DBG_FILE(_S8("CNsmlNetworkStatusEngine::EventL, BEGIN"));
	DBG_ARGS8(_S8("CNsmlNetworkStatusEngine::EventL event is ==  %d"), aConnMonEvent.EventType()  );
	switch ( aConnMonEvent.EventType() )
	{
	case EConnMonNetworkStatusChange:
	{
	const CConnMonNetworkStatusChange* eventNetworkStatus;
    eventNetworkStatus = ( const CConnMonNetworkStatusChange* ) &aConnMonEvent;
    iNetwStatus   = eventNetworkStatus->NetworkStatus();
    DBG_ARGS8(_S8("CNsmlNetworkStatusEngine::EventL EConnMonNetworkStatusChange: Network status event is ==  %d"), iNetwStatus  );   	
    switch( eventNetworkStatus->NetworkStatus() )
	{
		case EConnMonStatusActive:
		DBG_FILE(_S8("Network status ACTIVE"));
	    if(iTimerOn)
	    {
			iTimerOn = EFalse;
		    iSuspendDuration.HomeTime();
		    TTimeIntervalSeconds duration;
		    iSuspendDuration.SecondsFrom(iSuspendedTime,duration);
		    DBG_FILE_CODE(duration.Int(), _S8("CNsmlNetworkStatusEngine::EventL suspendDuration is "));        	 
			if ( iTimedExecuteStopSession ) 
			{
				iTimedExecuteStopSession->Cancel();
				delete iTimedExecuteStopSession;
				iTimedExecuteStopSession = NULL;
			}
		    if(duration.Int() >= KDMMaxHttpAutoResumeDurationSec)
			{
				iAgent->CompleteRequest();
			}
	    } // if itimerOn
	           
        break;
        case EConnMonStatusSuspended:
        DBG_FILE(_S8("HTTP  Network status SUSPEND and Timer will be set ON "));
	   	if(!iTimerOn)
		{
	    	CRepository *rep = NULL;
			TRAPD( err1, rep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ))
			iDMSmlSessionTimeout = -1;
			if(err1 == KErrNone)
			{
				TInt dmsessionTimeout = -1;
				rep->Get( KDevManDMSessionTimeout, dmsessionTimeout );
				delete rep;
				DBG_FILE_CODE(dmsessionTimeout, _S8("CNsmlNetworkStatusEngine::EventL session timeout duration from cenrep is "));        	 
				if( dmsessionTimeout < KNSmlDMMinSessionTimeout  || dmsessionTimeout > KNSmlDMMaxSessionTimeout )
				{
					dmsessionTimeout = -1;
					iDMSmlSessionTimeout = -1;
				}
				else
				{
					iDMSmlSessionTimeout =  dmsessionTimeout * 60* 1000000;
					iTimerOn = ETrue;
	    			iSuspendedTime.HomeTime();
	 		    	iTimedExecuteStopSession = CPeriodic::NewL (EPriorityNormal) ;
					iTimedExecuteStopSession->Start (
		    		TTimeIntervalMicroSeconds32(iDMSmlSessionTimeout)
		    		, TTimeIntervalMicroSeconds32(iDMSmlSessionTimeout)
		    		, TCallBack(StaticDoStopDMSession,this) ) ;
				}
			
			} // if KErrnone
			
	    	
	    } //if !iTimerON
		break;   
	    default: //for eventNetworkStatus->NetworkStatus()
		break;
     }
    break;
    }

	default: // for EConnMonNetworkStatusChange
	    break;
	}
}