Esempio n. 1
0
//
// Receive an SMS
//
void CWapSmsProtocol::ProcessSmsL(const CSmsMessage& aSmsMessage)
	{
    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CWAPSMSPROTOCOL_PROCESSSMSL_1, "CWapSmsProtocol::ProcessSmsL");
	TInt index=0;
	TBool storeDatagramComplete = EFalse;
	TBool isNewStyleClient = EFalse;

	__ASSERT_DEBUG(aSmsMessage.IsComplete(),Panic(EWapSmsIncompleteSms));

	CWapDatagram* wapDatagram = CWapDatagram::NewL(aSmsMessage);

	CleanupStack::PushL(wapDatagram);
	TBool isCompleteDatagram = wapDatagram->IsComplete();
	if (!isCompleteDatagram)
		{

		storeDatagramComplete = iWapStore->AddMessageL(index,*wapDatagram);
		if (!storeDatagramComplete)
			{
			CleanupStack::PopAndDestroy(wapDatagram);
			return;
			}
		iWapStore->GetDatagramL(index,*wapDatagram);
		}

	CWapSmsProvider* wapsmsProvider = LookupSAP(wapDatagram);

	if (wapsmsProvider)
		{
		isNewStyleClient= wapsmsProvider->IsNewStyleClient();
		if(isCompleteDatagram && isNewStyleClient)//8 bit datagram or complete messages, Need to store it for new clients
			{
			storeDatagramComplete = iWapStore->AddMessageL(index,*wapDatagram);
			if (!storeDatagramComplete)
				{
				CleanupStack::PopAndDestroy(wapDatagram);
				return;
				}
			}
		if(!isNewStyleClient && !isCompleteDatagram)
			{
			iWapStore->BeginTransactionLC();
			iWapStore->DeleteEntryL(index);
			iWapStore->CommitTransactionL();
			}
		CleanupStack::Pop(wapDatagram);
		wapsmsProvider->AddToQueue(wapDatagram);
		return;
		}
	else if(!isCompleteDatagram)
		{
		iWapStore->BeginTransactionLC();
		iWapStore->DeleteEntryL(index);
		iWapStore->CommitTransactionL();
		}

	CleanupStack::PopAndDestroy(wapDatagram);
	User::Leave(KErrNotFound);
	} // CWapSmsProtocol::ProcessSmsL
void CWapDgrmTestStep::_Print(CSmsMessage& aSms)
/**
 *  print a SMS message to the console
 */
{
	TSmsUserDataSettings UserDataSettings;
	TBool                IsComplete = EFalse;
	const TPtrC&         Address = aSms.ToFromAddress();
	TInt                 ToPort = 0;
	TInt                 FromPort = 0;
	TInt                 Is16BitPorts = 0;
	TBool                IsPorts = EFalse;
	TSmsDataCodingScheme::TSmsAlphabet Alphabet;

	// Print CSmsMessage settings
	CSmsPDU& Pdu = aSms.SmsPDU();

	IsComplete = aSms.IsComplete();
	aSms.UserDataSettings(UserDataSettings);
	Alphabet = UserDataSettings.Alphabet();

	_Print(_L8("CSmsMessage:: IsComplete: ToFromAddress: Alphabet\n"));
	_PrintBool(IsComplete);
	_Print(_L8(": "));
	_Print(Address);
	_Print(_L8(": "));
	_Print(Alphabet);
	_Print(_L8("\n"));

	IsPorts = Pdu.ApplicationPortAddressing(ToPort,FromPort,&Is16BitPorts);
	_Print(_L8("IsPorts: FromPort: ToPort: Is16BitPorts\n"));
	_PrintBool(IsPorts);
	_Print(_L8(": "));
	_Print(FromPort);
	_Print(_L8(": "));
	_Print(ToPort);
	_Print(_L8(": "));
	_PrintBool(Is16BitPorts);
	_Print(_L8("\n"));
}
/**
It adds the message segment to the reassembly store.
This function first checks on which re-assembly store the message should be stored and then add
the message to appropriate re-assembly store.

@note Only SUBMIT or DELIVER PDUs can be added to the reassembly store.

@param aSmsMessage  a reference to the SMS message.
	It acts both as input & output. At the time of function call it contains the message.
	When the function returns it contains full decoded message if it is complete.
	But in case of class 0 messages it might not contain complete class 0 messages.

@param aGsmSms	a reference to GsmSms object which contain actual PDU.
	It acts as pure input.

@param aIsComplete  boolean value indicating whether the message is complete or not.
	It acts both as input & output.
	In case of multi-segment message, the value of aIsComplete will be true when function returns 
	if the added segment makes the messsage complete.

@param aIsEnumeration	boolean value indicating whether the function is called at the time of enumeration.
	It acts as only input.

@param aCount  value indicating the number of current PDUs in the re-assembly store for the given SMS message.
	It acts as only output.

@param aTotal	value indicating the total number of PDUs for the given sms message.
	It acts as only output.

@internalComponent

NOTE:
	When function returns, if the value of aIsComplete is True, then aSmsMesssage will contain the
	complete decoded SMS message.
	But the above statement might not be always true:
	In case of class 0 messages, it is possible to forward the incomplete messages. So after forwarding
	the incomplete message, if we receive other constituent PDU of that message then in that case we 
	might receive all the constituent PDU of that message but aSmsMesssage will contain partial complete message.
	To find out complete/incompletness of the message, CSmsMessage::IsComplete() message function has to be called.
*/
void CFacadeSmsReassemblyStore::AddSegmentToReassemblyStoreL(CSmsMessage& aSmsMessage,const TGsmSms& aGsmSms, TInt& aIndex, TBool& aIsComplete, TBool aIsEnumeration, TInt& aCount, TInt& aTotal)
	{
	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CFACADESMSREASSEMBLYSTORE_ADDSEGMENTTOREASSEMBLYSTOREL_1, "CFacadeSmsReassemblyStore::AddSegmentToReassemblyStoreL(): isComplete Message=%d",aSmsMessage.IsComplete());

	TBool toBeStoredInClass0ReassemblyStore = IsForClass0ReassemblyStore(aSmsMessage);

	if (toBeStoredInClass0ReassemblyStore)
		{
		iClass0ReassemblyStore->AddSegmentToReassemblyStoreL(aSmsMessage, aGsmSms, aIndex, aIsComplete, aIsEnumeration, aCount, aTotal);
		}
	else
		{
		AddSegmentToNonClass0ReassemblyStoreL(aSmsMessage, aGsmSms, aIndex, aIsComplete, aIsEnumeration, aCount, aTotal);
		}
	}