14 * Description: Client's Status command buffering |
14 * Description: Client's Status command buffering |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <utf.h> |
19 |
20 #include <DevManInternalCRKeys.h> |
|
21 #include <centralrepository.h> |
|
22 //#include "nsmlcliagdefines.h" |
20 //#include "nsmlcliagdefines.h" |
23 #include "NSmlStatusContainer.h" |
21 #include "NSmlStatusContainer.h" |
24 #include "nsmlcliagconstants.h" |
22 #include "nsmlcliagconstants.h" |
25 #include "nsmlerror.h" |
23 #include "nsmlerror.h" |
26 #include "smlmetinfdtd.h" |
24 #include "smlmetinfdtd.h" |
27 |
|
28 // CONSTANTS |
|
29 _LIT8(KDbPersonal, "100000" ); |
|
30 |
25 |
31 // --------------------------------------------------------- |
26 // --------------------------------------------------------- |
32 // CNSmlStatusContainer::CNSmlStatusContainer |
27 // CNSmlStatusContainer::CNSmlStatusContainer |
33 // Constructor, nothing special in here. |
28 // Constructor, nothing special in here. |
34 // --------------------------------------------------------- |
29 // --------------------------------------------------------- |
205 } |
200 } |
206 if ( aFixStatus) |
201 if ( aFixStatus) |
207 { |
202 { |
208 (*iStatusArray)[aEntryID-1].statusIsFixed = ETrue; |
203 (*iStatusArray)[aEntryID-1].statusIsFixed = ETrue; |
209 } |
204 } |
210 // TargertUri Fix |
205 } |
211 |
|
212 TPtrC8 cmd( (TUint8*) (*iStatusArray)[aEntryID-1].status->cmd->content, (*iStatusArray)[aEntryID-1].status->cmd->length ); |
|
213 if ( cmd == KNSmlAgentExec ) |
|
214 { |
|
215 CRepository* cenrep = NULL; |
|
216 TInt err(KErrNone); |
|
217 TRAP(err, cenrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys )); |
|
218 if(err == KErrNone) |
|
219 { |
|
220 TBuf8<256> targetPath; |
|
221 TInt result = cenrep->Get( KNSmlDMSCOMOTargetRef, targetPath ); |
|
222 if((targetPath.Length()) && (result == KErrNone)) |
|
223 { |
|
224 TPtrC8 sourcePath( (TUint8*) (*iStatusArray)[aEntryID-1].status->targetRefList->targetRef->content, (*iStatusArray)[aEntryID-1].status->targetRefList->targetRef->length ); |
|
225 |
|
226 (*iStatusArray)[aEntryID-1].status->itemList = new ( ELeave ) SmlItemList_t; |
|
227 (*iStatusArray)[aEntryID-1].status->itemList->item = new( ELeave ) SmlItem_t; |
|
228 |
|
229 (*iStatusArray)[aEntryID-1].status->itemList->item->source = new( ELeave ) SmlSource_t; |
|
230 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locURI = new( ELeave ) SmlPcdata_t; |
|
231 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locURI->SetDataL( sourcePath ); |
|
232 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locURI->contentType = SML_PCDATA_OPAQUE; |
|
233 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locURI->extension = SML_EXT_UNDEFINED; |
|
234 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locName = NULL; |
|
235 |
|
236 _LIT8( KNSmlNull, "null" ); |
|
237 if(targetPath.Compare( KNSmlNull )!= 0) |
|
238 { |
|
239 (*iStatusArray)[aEntryID-1].status->itemList->item->target = new( ELeave ) SmlTarget_t; |
|
240 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locURI = new( ELeave ) SmlPcdata_t; |
|
241 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locURI->SetDataL( targetPath ); |
|
242 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locURI->contentType = SML_PCDATA_OPAQUE; |
|
243 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locURI->extension = SML_EXT_UNDEFINED; |
|
244 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locName = NULL; |
|
245 } |
|
246 (*iStatusArray)[aEntryID-1].status->targetRefList = NULL; |
|
247 |
|
248 _LIT8(KNullString, ""); |
|
249 result = cenrep->Set( KNSmlDMSCOMOTargetRef, KNullString ); |
|
250 } |
|
251 delete cenrep; |
|
252 cenrep = NULL; |
|
253 } |
|
254 } |
|
255 |
|
256 // TargertUri Fix Ends |
|
257 |
|
258 CleanupStack::PopAndDestroy(); //statusCode |
206 CleanupStack::PopAndDestroy(); //statusCode |
259 } |
|
260 } |
207 } |
261 // --------------------------------------------------------- |
208 // --------------------------------------------------------- |
262 // CNSmlStatusContainer::SetChalL() |
209 // CNSmlStatusContainer::SetChalL() |
263 // Creates Chal element |
210 // Creates Chal element |
264 // --------------------------------------------------------- |
211 // --------------------------------------------------------- |
535 } |
482 } |
536 } |
483 } |
537 return statusPresents; |
484 return statusPresents; |
538 } |
485 } |
539 // --------------------------------------------------------- |
486 // --------------------------------------------------------- |
540 // CNSmlStatusContainer::FillItemDataL() |
|
541 // Populates the Item structure |
|
542 // --------------------------------------------------------- |
|
543 EXPORT_C void CNSmlStatusContainer::FillItemDataL( SmlItem_t*& aItem ) |
|
544 { |
|
545 //Source |
|
546 aItem->source = new( ELeave ) SmlSource_t; |
|
547 SmlPcdata_t* srcdata = new( ELeave ) SmlPcdata_t; |
|
548 srcdata->SetDataL( KDbPersonal ); |
|
549 srcdata->contentType = SML_PCDATA_OPAQUE; |
|
550 srcdata->extension = SML_EXT_UNDEFINED; |
|
551 CopyPcdataL( srcdata, aItem->source->locURI ); |
|
552 |
|
553 // Source Parent |
|
554 aItem->sourceParent = new( ELeave ) SmlSourceParent_t; |
|
555 SmlPcdata_t* srcprntdata = new( ELeave ) SmlPcdata_t; |
|
556 srcprntdata->SetDataL( _L8("/") ); |
|
557 srcprntdata->contentType = SML_PCDATA_OPAQUE; |
|
558 srcprntdata->extension = SML_EXT_UNDEFINED; |
|
559 CopyPcdataL( srcprntdata, aItem->sourceParent->locURI ); |
|
560 } |
|
561 // --------------------------------------------------------- |
|
562 // CNSmlStatusContainer::StatusItem() |
|
563 // Retrieve the Status element bearing the ID provided |
|
564 // --------------------------------------------------------- |
|
565 EXPORT_C SmlStatus_t* CNSmlStatusContainer::StatusItem( TInt aStatusID ) |
|
566 { |
|
567 |
|
568 if( ( iStatusArray ) && |
|
569 ( iStatusArray->Count() <= aStatusID ) ) |
|
570 { |
|
571 |
|
572 return (*iStatusArray)[aStatusID-1].status; |
|
573 } |
|
574 |
|
575 return NULL; |
|
576 } |
|
577 // --------------------------------------------------------- |
|
578 // CNSmlStatusContainer::CreatePcdataL() |
487 // CNSmlStatusContainer::CreatePcdataL() |
579 // Creates Pcdata |
488 // Creates Pcdata |
580 // Created element is not pushed to Cleanup stack |
489 // Created element is not pushed to Cleanup stack |
581 // --------------------------------------------------------- |
490 // --------------------------------------------------------- |
582 void CNSmlStatusContainer::CreatePcdataL( SmlPcdata_t*& aPcdata, const TDesC8& aContent ) const |
491 void CNSmlStatusContainer::CreatePcdataL( SmlPcdata_t*& aPcdata, const TDesC8& aContent ) const |