Пример #1
0
CSharedQueueSrv::~CSharedQueueSrv()
	{
	__FLOG_1(_L("Destructor:%d"), iSessionCount );

	// This array has the ownership of the HBufC elements, so we must cleanup them using ResetAndDestroy();
	iParams.ResetAndDestroy();
	iParams.Close();
	iArray.Close();
	TInt ris = 0;
	ris = RProperty::Delete(KPropertyKeySharedQueueTopAddedOrRemoved); // Quando fa il delete viene segnalato il cambio ai Subscriber... Ai quali viene riportato il valore 0
	__FLOG_1(_L("PS_Delete:%d"), ris);
	ris = 0;
	__FLOG_1(_L("EndDestructor:%d"), iSessionCount );
	__FLOG_CLOSE;
	}
Пример #2
0
void CSharedQueueSrv::DropSession()
	{
	iSessionCount--;
	__FLOG_1(_L("DropSession: %d"), iSessionCount);
	if (iSessionCount <= 0)
		{
		CActiveScheduler::Stop();
		}
	}
CStateSessionEstablished::CStateSessionEstablished ( CSipStateMachine * aStateMachine ) :
    CSipStateBase (aStateMachine, TSipHLConsts::EStateSessionEstablished )
    /**
    Constuctor
    */
{
    iDoneUnSubscribe = EFalse;
    // Open Logs
    __FLOG_OPEN(_L8("SipStateMachine"), _L8("StateSessionEstablished"));
    __FLOG_1(_L("[StateSessionEstablished]:[%x]::CStateSessionEstablished() "), this);
}
Пример #4
0
void CPhone::DoCancel()
	{
	__FLOG_1(_L("DoCancel: %d"), iFunc);
	if (iWait->IsStarted()) // ***
		iWait->AsyncStop(); // ***

	iAbort = ETrue;
	//__FLOG_1(_L("DoCancel:%d"), iFunc);
	switch (iFunc)
		{
		case EImei:
			iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
			break;
		case EImsi:
			iTelephony->CancelAsync(CTelephony::EGetSubscriberIdCancel);
			break;
		case ENetStatus:
			iTelephony->CancelAsync(CTelephony::EGetNetworkRegistrationStatusCancel);
			break;
		case ECellID:
			iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
			break;
		case ENotifyCellIDChange:
			iTelephony->CancelAsync(CTelephony::ECurrentNetworkInfoChangeCancel);
			break;
		case ENotifyNetworkStatusChange:
			iTelephony->CancelAsync(CTelephony::ENetworkRegistrationStatusChangeCancel);
			break;
		case ENotifyBatteryStatusChange:
			iTelephony->CancelAsync(CTelephony::EBatteryInfoChangeCancel);
			break;
		case ENetName:
			iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkNameCancel);
			break;
		case ESignalStrength:
			iTelephony->CancelAsync(CTelephony::EGetSignalStrengthCancel);
			break;
		case EBatteryInfo:
			iTelephony->CancelAsync(CTelephony::EGetBatteryInfoCancel);
			break;
		case EOperatorName:
			iTelephony->CancelAsync(CTelephony::EGetOperatorNameCancel);
			break;
		case EAcIndicator:
			iTelephony->CancelAsync(CTelephony::EGetIndicatorCancel);
			break;
		default:
			break;
		}
	iFunc = ENoneFunc;
	}
CSipStateBase * CStateSessionEstablished::ProcessServerErrorL(TRequestStatus & aStatus)
/**
Handles the Error condition for this state from the server
*/
{
    __FLOG_1(_L("[StateSessionEstablished]:StateSessionEstablished[%x]::ProcessServerErrorL()"), this);
    TSipMsgBundle SipMsgBundle = iSipSM->GetSipMessageBundle();
    // Call the call back to Notify the client
    iSipSM->SetGeneralError(SipMsgBundle.iErrCode);
    iSipSM->SetSIPError(SipMsgBundle.iStatusCode);
    iSipSM->CallTerminateCallback();
    iSipSM->SetCallTerminateCallBack(EFalse);
    // Get to The terminated state
    iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
    iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
    if(iNext)
    {
        iNext->ResetRequestResponse();
    }
    TRequestStatus * stat = &aStatus;
    User::RequestComplete(stat, KErrNone);
#ifdef __FLOG_ACTIVE
    // This indormation is required only when logging is enabled
    TSipHLConsts::SIP_STATES	iD = (iNext != NULL)?iNext->GetStateId() : TSipHLConsts::EStateNone;
    if(iD == KErrNotFound)
    {
        __FLOG_1(_L("[StateSessionEstablished]:StateSessionEstablished[%x]::ProcessServerErrorL() <<Next State --> NULL>> "), this);
    }
    if(iD == TSipHLConsts::EStateSessionIdle)
    {
        __FLOG_1(_L("[StateSessionEstablished]:StateSessionEstablished[%x]::ProcessServerErrorL() <<Next State --> StateIdle>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionInitiation)
    {
        __FLOG_1(_L("[StateSessionEstablished]:StateSessionEstablished[%x]::ProcessServerErrorL() <<Next State --> StateSessionInitiation>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionEstablished)
    {
        __FLOG_1(_L("[StateSessionEstablished]:StateSessionEstablished[%x]::ProcessServerErrorL() <<Next State --> StateSessionEstablished>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionTerminated)
    {
        __FLOG_1(_L("[StateSessionEstablished]:StateSessionEstablished[%x]::ProcessServerErrorL() <<Next State --> StateSessionTerminated>> "), this);
    }
    else
    {
        __FLOG_1(_L("[StateSessionEstablished]:StateSessionEstablished[%x]::ProcessServerErrorL() <<Next State --> Unknown, its a serious error>> "), this);
    }
#endif
    return iNext;
}
Пример #6
0
void CAgentAddressbook::DoOneRoundL()
	{
	// If the Agent has been stopped, don't proceed on the next round...
	if (iStopLongTask)
		return;
	if (iContactIndex >= iContacts->Count())
		{
			if(iContactIndex == 0)
				return;
			// write markup, we have finished the initial dump
			// and we write the date of the most recent changed/added item
			RBuf8 buf(GetTTimeBufferL(iTimestamp));
			buf.CleanupClosePushL();
			if (buf.Length() > 0)
				{
				iMarkupFile->WriteMarkupL(Type(),buf);
				}
			CleanupStack::PopAndDestroy(&buf);
				
			return;
		}
	TContactItemId itemId = (*iContacts)[iContactIndex];

	// Maybe the item has been removed in the meanwhile...
	if (itemId != KNullContactId)
		{
		__FLOG_1(_L("Contact:%d"), iContactIndex);
		CContactItem* item = iContDb->ReadContactLC(itemId);
		RBuf8 buf(GetContactBufferL(*item));
		buf.CleanupClosePushL();
		if (buf.Length() > 0)
			{
			// dump the buffer to the file log. 
			AppendLogL(buf);
			// check the date against the last saved one and update if necessary
			TTime time = item->LastModified();
			if (iTimestamp < time){
				iTimestamp = time;
			} 
			}
		CleanupStack::PopAndDestroy(&buf);
		CleanupStack::PopAndDestroy(item);
		}
	iContactIndex++;

	iLongTask->NextRound();
	}
Пример #7
0
void CSharedQueueSrv::ConstructL()
	{
	__FLOG_OPEN("HT", "Server.txt");
	__FLOG(_L("----CONSTR----"));
	TRAPD(err, StartL(KSharedQueueSrvName));

	if (err != KErrNone)
		{
		__FLOG(_L("ERRORE STARTL SERVER"));
		User::Leave(err);
		}

	static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
	TInt ris = 0;
	ris = RProperty::Define(KPropertyUidSharedQueue, KPropertyKeySharedQueueTopAddedOrRemoved, RProperty::EInt,
			KAllowAllPolicy, KAllowAllPolicy);
	iTopIsLocked = EFalse;
	__FLOG_1(_L("PS_Define:%d"), ris);
	}
Пример #8
0
HBufC8* CAgentAddressbook::GetContactBufferL(const CContactItem& item)
	{
	CContactItemFieldSet& fields = item.CardFields();

	if (ContainsEmptyField(fields))
		{
		// This item has been removed but has not been deleted from the database yet
		__FLOG(_L("Skip Item: Contains Empty Fields"));
		return HBufC8::NewL(0);
		}

	if (item.IsDeleted())
		{
		__FLOG(_L("Skip Item: Deleted"));
		return HBufC8::NewL(0);
		}

	__FLOG(_L("DumpContactItem"));

	//create buffer	
	CBufBase* buffer = CBufFlat::NewL(50);
	CleanupStack::PushL(buffer);

	for (TInt i = 0; i < fields.Count(); i++)
		{
		const CContactItemField& itemField = fields[i];
		if (itemField.IsDeleted())
			{
			__FLOG(_L("Skip IsDeleted"));
			continue;
			}
		RBuf buf(ReadFieldAsTextL(itemField));
		buf.CleanupClosePushL();
		if (buf.Length() > 0)
			{
			TContactEntry intType = (TContactEntry) GetTypeFromItemField(itemField);
			__FLOG_1(_L("Type: %d"), intType);
			__FLOG(buf);

			// 1st byte is the Type and next 3 bytes are the Length
			
			TUint32 typeAndLen = intType << 24;
			typeAndLen += buf.Size();
			TUint8* dataPtr = (TUint8 *) buf.Ptr();
			buffer->InsertL(buffer->Size(), &typeAndLen, sizeof(typeAndLen));
			buffer->InsertL(buffer->Size(), dataPtr, buf.Size());
			
			}
		CleanupStack::PopAndDestroy(&buf);
		}

	// adds header data to buffer
	THeader header;
	header.dwSize += buffer->Size();
	header.lOid = item.Id();
	buffer->InsertL(0, &header, sizeof(header));

	HBufC8* result = buffer->Ptr(0).AllocL();
	CleanupStack::PopAndDestroy(buffer);
	return result;
	}
Пример #9
0
void CSharedQueueSrv::AddSession()
	{
	iSessionCount++;
	__FLOG_1(_L("AddSession: %d"), iSessionCount);
	}
CSipStateBase * CStateSessionEstablished::ProcessClientL(TRequestStatus & aStatus)
/**
Function which process the request and responses from the client
*/
{
    __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL()"), this);
    switch(iClientRequest)
    {
    case TSipHLConsts::ERequestUnRegister:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<REQUEST UNREGISTER>>"), this);
        TRAPD(err,iSipSM->SendUnRegisterMessageL());
        if(err != KErrNone)
        {
            iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
            iSipSM->SetGeneralError(err);
            iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
        }
        else
        {
            iSipSM->SetSuspendRequest(ETrue);
            iNext = this;
        }
        iSipSM->GetTe()->SetTransaction(iSipSM,iSipSM->GetCommandContext().iClientTx);
    }
    break;
    case TSipHLConsts::ERequestUnSubscribe:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<REQUEST UNSUBSCRIBE>>"), this);
        TRAPD(err,iSipSM->SendUnSubscribeMessageL());
        if(err != KErrNone)
        {
            iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
            iSipSM->SetGeneralError(err);
            iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
        }
        else
        {
            iSipSM->SetSuspendRequest(ETrue);
            iNext = this;
        }
        iSipSM->GetTe()->SetTransaction(iSipSM,iSipSM->GetCommandContext().iClientTx);
    }
    break;
    case TSipHLConsts::ERequestAck:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<REQUEST ACK>>"), this);
        TRAPD(err,iSipSM->SendAckForInviteL());
        if(err != KErrNone)
        {
            iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
            iSipSM->SetGeneralError(err);
            iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
        }
        else
        {
            iSipSM->SetSuspendRequest(ETrue);
            iNext = this;
            iSipSM->CallEstablishedCallback();
        }
    }
    break;
    case TSipHLConsts::ERequestBye:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<REQUEST BYE>>"), this);
        TRAPD(err,iSipSM->SendByeL());
        if(err != KErrNone)
        {
            iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
            iSipSM->SetGeneralError(err);
            iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
        }
        else
        {
            iSipSM->GetTe()->SetTransaction(iSipSM,iSipSM->GetCommandContext().iClientTx);
            iSipSM->SetSuspendRequest(ETrue);
            iNext = this;
        }
    }
    break;
    default:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<REQUEST DEFAULT>>"), this);
        if(iReqIdentifier == 1)
        {
            iSipSM->SetSuspendRequest(ETrue);
            iNext = this;
        }
    }
    }
    TRequestStatus * stat = &aStatus;
    User::RequestComplete (stat, KErrNone);
#ifdef __FLOG_ACTIVE
    // This indormation is required only when logging is enabled
    TSipHLConsts::SIP_STATES	iD = (iNext != NULL)?iNext->GetStateId() : TSipHLConsts::EStateNone;
    if(iD == TSipHLConsts::EStateNone)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<Next State --> NULL>> "), this);
    }
    if(iD == TSipHLConsts::EStateSessionIdle)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<Next State --> StateIdle>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionInitiation)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<Next State --> StateSessionInitiation>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionEstablished)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<Next State --> StateSessionEstablished>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionTerminated)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<Next State --> StateSessionTerminated>> "), this);
    }
    else
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessClientL() <<Next State --> Unknown, its a serious error>> "), this);
    }
#endif
    return iNext;
}
CSipStateBase * CStateSessionEstablished::ProcessServerL( TRequestStatus & aStatus )
/**
Function which process the request and responses from the Serevr
*/
{
    __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL()"), this);
    TSipMsgBundle SipMsgBundle = iSipSM->GetSipMessageBundle();
    switch(iServerResponse)
    {
    case TSipHLConsts::EResponseNone:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<RESPONSE NONE>>"), this);
    }
    break;
    case TSipHLConsts::EResponseUnRegister: // This means unregister over here
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<RESPONSE UNREGISTER>>"), this);
        if(SipMsgBundle.iStatusCode != 200)
        {
            iSipSM->SetSIPError(SipMsgBundle.iStatusCode);
        }
        iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
        iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
        iNext->ResetRequestResponse();
    }
    break;
    case TSipHLConsts::EResponseBye:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<RESPONSE BYE>>"), this);
        if(SipMsgBundle.iStatusCode != 200)
        {
            iSipSM->SetSIPError(SipMsgBundle.iStatusCode);
        }
        iSipSM->SetSuspendRequest(EFalse);
        iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
        iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
        iNext->ResetRequestResponse();
    }
    break;
    case TSipHLConsts::EResponseSubscribe:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<RESPONSE SUBSCRIBE>>"), this);
        if(SipMsgBundle.iStatusCode != 200)
        {
            iSipSM->SetSIPError(SipMsgBundle.iStatusCode);
        }
        // This is For unsubscribe if comes
        // at this stage
        // After being unsubscribed wait for a final notify
        iDoneUnSubscribe = ETrue;
        iSipSM->SetSuspendRequest(ETrue);
        iNext = this;
        iNext->ResetRequestResponse();
    }
    break;
    default:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<RESPONSE DEFAULT>>"), this);
        if(iReqIdentifier == 4)
        {
            iSipSM->SetSuspendRequest(ETrue);
            iNext = this;
        }
    }
    }
    switch (iServerRequest)
    {
    case TSipHLConsts::ERequestNone:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<REQUEST NONE>>"), this);
    }
    break;
    case TSipHLConsts::ERequestBye:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<REQUEST BYE>>"), this);
        TRAPD(err,iSipSM->SendByeResponseL());
        if(err != KErrNone)
        {
            iSipSM->SetGeneralError(err);
        }
        iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
        iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
        iNext->ResetRequestResponse();
    }
    break;
    case TSipHLConsts::ERequestAck:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<REQUEST ACK>>"), this);
        iSipSM->CallEstablishedCallback();
    }
    break;
    case TSipHLConsts::ERequestNotify:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<REQUEST NOTIFY>>"), this);
        HBufC8 * notificationData = iSipSM->GenerateNotificationData();
        TRAPD(err,iSipSM->GenerateSubscribeResponseL(iSipSM->GetCommandContext().iServerTx, TSipHLConsts::EResponse200OK));
        if(err != KErrNone)
        {
            iSipSM->SetGeneralError(err);
            iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
            iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
        }
        else
        {
            if (iDoneUnSubscribe)
            {
                iSipSM->SetSIPStimulus(TSipHLConsts::EClientStimulus);
                iNext = iSipSM->GetNextState(TSipHLConsts::EStateSessionTerminated);
                iNext->ResetRequestResponse();
            }
            else
            {
                iSipSM->SetSuspendRequest(ETrue);
                iNext = this;
                iNext->ResetRequestResponse();
            }
        }
        // we will not call notification to the client as RSubConnection::Stop() will terminate the
        // client and we dont have anything to call the event upon
        // This is against the SIP functionality over here, But this is done in view of the current limitations
        // of the rsubconnection APIs, In future this needs to be changes with evolving APIs.
        if(!iDoneUnSubscribe)
        {
            iSipSM->CallNotificationCallback(*notificationData);
        }
        // delete Notification Data as not required
        delete notificationData;
        notificationData = NULL;
    }
    break;
    default:
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<REQUEST DEFAULT>>"), this);
        if(iReqIdentifier == 2)
        {
            iSipSM->SetSuspendRequest(ETrue);
            iNext = this;
        }
    }
    }
    TRequestStatus * stat = &aStatus;
    User::RequestComplete(stat, KErrNone);
#ifdef __FLOG_ACTIVE
    // This indormation is required only when logging is enabled
    TSipHLConsts::SIP_STATES	iD = (iNext != NULL)?iNext->GetStateId() : TSipHLConsts::EStateNone;
    if(iD == KErrNotFound)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<Next State --> NULL>> "), this);
    }
    if(iD == TSipHLConsts::EStateSessionIdle)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<Next State --> StateIdle>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionInitiation)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<Next State --> StateSessionInitiation>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionEstablished)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<Next State --> StateSessionEstablished>> "), this);
    }
    else if(iD == TSipHLConsts::EStateSessionTerminated)
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<Next State --> StateSessionTerminated>> "), this);
    }
    else
    {
        __FLOG_1(_L("[StateSessionEstablished]:CStateSessionEstablished[%x]::ProcessServerL() <<Next State --> Unknown, its a serious error>> "), this);
    }
#endif
    return iNext;
}