void CReferenceHandler::CreateReferenceObject7L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 200; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef7Name); aObject.SetTypeL(KRefImageJpegType); aObject.SetLengthL(aObjectBuf.Size()); const TTime KRef5Time = TDateTime(2001, EFebruary, 14, 15, 38, 24, 0);//set time to 15:38:24.0 on 14th Feb 2001 - obex doesn't transfer microseconds!! aObject.SetTimeL(KRef5Time); _LIT8(KRef1HTTP, "Accept: text/*"); _LIT8(KRef2HTTP, "Location: http://www.w3.org"); _LIT8(KRef3HTTP, "Date: Tue, 10 Nov 2002 09:17:21 GMT"); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); /* ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); */ CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefSyncMLTarget); aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrTime | KObexHdrLength | KObexHdrHttp | KObexHdrTarget); }
//Empty object with EoB headder void CReferenceHandler::CreateReferenceObject10L(CObexBufObject& aObject, CBufFlat& /*aObjectBuf*/, TTransport /*aTransport*/) { //Reset the object (also resets the buffer) aObject.Reset(); aObject.SetNameL(KRef8Name); aObject.SetTypeL(KRefType); const TTime KRef10Time = TDateTime(2005, EJanuary, 17, 14, 35, 30, 0); aObject.SetTimeL(KRef10Time); aObject.SetTargetL(KRefIrMCTarget); TBuf8<40> param; param.Copy(_L("\x04")); param.Append(_L("\x03")); param.Append(_L("PARAM 435")); aObject.SetAppParamL(param); _LIT8(KRef1HTTP, "Accept: text/*"); aObject.AddHttpL(KRef1HTTP); CObexHeader* header = CObexHeader::NewL(); CleanupStack::PushL(header); _LIT(KUserDefUnicode2, "UserDef2"); header->SetUnicodeL(0x34, KUserDefUnicode2); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBC, 0x23); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); TBuf8<1000> dummy; header->SetByteSeqL(TObexInternalHeader::EEndOfBody, dummy); aObject.AddHeaderL(*header); CleanupStack::Pop(header); HBufC* descBuf = HBufC::NewLC(0); CleanupStack::PopAndDestroy(descBuf); }
void CReferenceHandler::CreateReferenceObject1L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 2; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef2Name); // check the deletecurrentheader method aObject.SetNameL(KRef1Name); _LIT8(KRef1HTTP, "Accept: text/*"); _LIT8(KRef2HTTP, "Location: http://www.w3.org"); _LIT8(KRef3HTTP, "Date: Tue, 10 Nov 2002 09:17:21 GMT"); // add Http header using old API // /* aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); // USE THE HEADER MASK TO REMOVE HTTP HEADERS FROM HEADERSET // THIS DOES NOT REMOVE THE ITEMS FROM iHttp LIST - this tests // the Http() function which should remove items from iHttp list // TObexMatchHeader* headerMask = new(ELeave) TObexMatchHeader; headerMask->SetHeader(TObexInternalHeader::EName); aObject.HeaderSet().SetMask(headerMask); aObject.HeaderSet().DeleteMasked(); aObject.HeaderSet().SetMask(NULL); delete headerMask; */ aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef3HTTP); /* if (aObject.Http()) { NULL; } */ // add a Count header using new API // CObexHeader* tempheader = CObexHeader::NewL(); CleanupStack::PushL(tempheader); tempheader->SetFourByte(TObexInternalHeader::ECount, 0xFE22FF54); aObject.AddHeaderL(*tempheader); CleanupStack::Pop(tempheader); // add an Http header using new API // tempheader = CObexHeader::NewL(); CleanupStack::PushL(tempheader); tempheader->SetByteSeqL(TObexInternalHeader::EHttp, KRef1HTTP); aObject.AddHeaderL(*tempheader); CleanupStack::Pop(tempheader); aObject.SetTypeL(KRefType); // set again to check header update functionality aObject.SetTypeL(KRefType); aObject.SetLengthL(aObjectBuf.Size()); // set again to check header update functionality aObject.SetLengthL(aObjectBuf.Size()); TBuf8<40> param; param.Copy(_L("\x04")); param.Append(_L("\x03")); param.Append(_L("App params 123")); aObject.SetAppParamL(param); // set again to check header update functionality aObject.SetAppParamL(param); const TTime KRef1Time = TDateTime(2003, EApril, 29, 10, 10, 10, 0); aObject.SetTimeL(KRef1Time); // set again to check header update functionality aObject.SetTimeL(KRef1Time); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); // set again to check header update functionality aObject.SetDescriptionL(ptr); CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefTarget); // set again to check header update functionality aObject.SetTargetL(KRefTarget); CObexHeader* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x30, KRef1Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(TObexInternalHeader::ECreatorID, 0x5F3A2343); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x36, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(TObexInternalHeader::EWanUUID, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x3F, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xB0, 0x03); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBF, 0x12); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBE, 0x12); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xF0, 0x54545454); aObject.AddHeaderL(*header); CleanupStack::Pop(header); // THIS NEXT HEADER IS A NEGATIVE TEST. It should cause a panic // 0x2F header doesnt have a FourByte HI Type. /* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0x2F, 0x54); aObject.AddHeaderL(*header); CleanupStack::Pop(header); */ header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xFF, 0x00111243); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(0x73, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(TObexInternalHeader::EObjectClass, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); aObject.SetHeaderMask(KObexHdrName |KObexHdrType | KObexHdrLength | KObexHdrTime | KObexHdrDescription | KObexHdrTarget | KObexHdrHttp | KObexHdrCount | KObexHdrAppParam | KObexHdrUserDefined | KObexHdrObjectClass | KObexHdrWanUUID | KObexHdrCreatorID); }
void CReferenceHandler::CreateReferenceObject8L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 200; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef8Name); aObject.SetTypeL(KRefType); const TTime KRef10Time = TDateTime(2005, EJanuary, 17, 14, 35, 30, 0); aObject.SetTimeL(KRef10Time); aObject.SetTargetL(KRefIrMCTarget); TBuf8<40> param; param.Copy(_L("\x04")); param.Append(_L("\x03")); param.Append(_L("PARAM 435")); aObject.SetAppParamL(param); _LIT8(KRef1HTTP, "Accept: text/*"); aObject.AddHttpL(KRef1HTTP); CObexHeader* header = CObexHeader::NewL(); CleanupStack::PushL(header); _LIT(KUserDefUnicode2, "UserDef2"); header->SetUnicodeL(0x34, KUserDefUnicode2); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBC, 0x23); aObject.AddHeaderL(*header); CleanupStack::Pop(header); // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); /* ASSERT(descBuf); Ptr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); */ CleanupStack::PopAndDestroy(descBuf); aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrTime | KObexHdrTarget | KObexHdrAppParam | KObexHdrHttp |KObexHdrUserDefined); }
void CReferenceHandler::CreateReferenceObject6L(CObexBufObject& aObject, CBufFlat& aObjectBuf, TTransport aTransport) { //Reset the object (also resets the buffer) aObject.Reset(); const TUint KNumOfAlphabets = 200; aObjectBuf.ResizeL(KNumOfAlphabets * 30); //populate the buffer... TBuf8<4> buf; TUint i; for (i=0; i<KNumOfAlphabets; i++) { buf.Zero(); buf.AppendNumFixedWidth(i, EDecimal, 4); aObjectBuf.Write(30*i, buf); aObjectBuf.Write(30*i + 4, KAlphabet); } //populate the object aObject.SetNameL(KRef6Name); aObject.SetTypeL(KRefImageJpegType); aObject.SetLengthL(aObjectBuf.Size()); const TTime KRef5Time = TDateTime(2001, EFebruary, 14, 15, 38, 24, 0);//set time to 15:38:24.0 on 14th Feb 2001 - obex doesn't transfer microseconds!! aObject.SetTimeL(KRef5Time); _LIT8(KRef1HTTP, "Accept: text/*"); _LIT8(KRef2HTTP, "Location: http://www.w3.org"); _LIT8(KRef3HTTP, "Date: Tue, 10 Nov 2002 09:17:21 GMT"); /* TObexMatchHeader* headerMask = new(ELeave) TObexMatchHeader; headerMask->SetHeader(TObexInternalHeader::EName); aObject.HeaderSet().SetMask(headerMask); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef3HTTP); if (aObject.Http()) { NULL; } aObject.HeaderSet().SetMask(headerMask); aObject.HeaderSet().DeleteMasked(); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef3HTTP); if (aObject.Http()) { NULL; } aObject.HeaderSet().SetMask(headerMask); aObject.HeaderSet().DeleteMasked(); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef3HTTP); if (aObject.Http()) { NULL; } aObject.HeaderSet().SetMask(headerMask); aObject.HeaderSet().DeleteMasked(); delete headerMask; */ aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef3HTTP); aObject.AddHttpL(KRef1HTTP); aObject.AddHttpL(KRef2HTTP); aObject.AddHttpL(KRef2HTTP); /* if (aObject.Http()) { NULL; } aObject.HeaderSet().SetMask(NULL); */ // Set up the MF description header const TUint KDescLength = ( (aTransport==EBluetooth?KObexPacketDefaultSize:2044) - KObexPacketHeaderSize - 5 - 5)/sizeof(TText); // Size in characters HBufC* descBuf = HBufC::NewLC(KDescLength); /* ASSERT(descBuf); TPtr ptr(descBuf->Des()); ptr.Zero(); for (i=0; i<KDescLength; i++) { ptr.AppendNumFixedWidth(i%10, EDecimal, 1); } aObject.SetDescriptionL(ptr); */ CleanupStack::PopAndDestroy(descBuf); aObject.SetTargetL(KRefTarget); CObexHeader* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x30, KRef1Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x36, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetUnicodeL(0x3F, KRef5Name); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xB0, 0x03); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByte(0xBF, 0x12); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xF0, 0x54); aObject.AddHeaderL(*header); CleanupStack::Pop(header); // THIS NEXT HEADER IS A NEGATIVE TEST. It should cause a panic // 0x2F header doesnt have a FourByte HI Type. /* header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0x2F, 0x54); aObject.AddHeaderL(*header); CleanupStack::Pop(header); */ header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetFourByte(0xFF, 0x43); aObject.AddHeaderL(*header); CleanupStack::Pop(header); header = CObexHeader::NewL(); CleanupStack::PushL(header); header->SetByteSeqL(0x73, KRefTarget); aObject.AddHeaderL(*header); CleanupStack::Pop(header); aObject.SetHeaderMask(KObexHdrName | KObexHdrType | KObexHdrTime | KObexHdrLength | KObexHdrHttp | KObexHdrTarget | KObexHdrUserDefined ); }