133 |
133 |
134 // Store module status |
134 // Store module status |
135 User::LeaveIfError(iModuleStatusArray.Append(module)); |
135 User::LeaveIfError(iModuleStatusArray.Append(module)); |
136 } |
136 } |
137 CleanupStack::PopAndDestroy(idList); |
137 CleanupStack::PopAndDestroy(idList); |
138 iActivePosModuleArray.Reset(); |
138 |
139 |
|
140 // Get the CategoryUid from the cenrep file owned by LbsRoot. |
|
141 CRepository* rep = CRepository::NewLC(KLbsCenRepUid); |
|
142 TInt posStatusCategory; |
|
143 DEBUG_TRACE("Opening Status API Settings...", __LINE__) |
|
144 User::LeaveIfError(rep->Get(KMoPositioningStatusAPIKey, posStatusCategory)); |
|
145 DEBUG_TRACE("Opened Status API Settings...", __LINE__) |
|
146 CleanupStack::PopAndDestroy(rep); |
|
147 iPosStatusCategory = TUid::Uid(posStatusCategory); |
|
148 |
|
149 iTimer = CPeriodic::NewL(EPriorityLow); |
139 iTimer = CPeriodic::NewL(EPriorityLow); |
150 } |
140 } |
151 |
141 |
152 /** |
142 /** |
153 * Two-phased constructor. |
143 * Two-phased constructor. |
459 // This should never happen if PSYs are implemented correctly. |
449 // This should never happen if PSYs are implemented correctly. |
460 // Ignore the event. |
450 // Ignore the event. |
461 return; |
451 return; |
462 } |
452 } |
463 |
453 |
464 NotifyPosModuleStatusToSubscriber(aImplementationUid, aStatus); |
|
465 |
|
466 TPosModule& storedModule = iModuleStatusArray[index]; |
454 TPosModule& storedModule = iModuleStatusArray[index]; |
467 TPositionModuleStatus::TDeviceStatus storedDeviceStatus = |
455 TPositionModuleStatus::TDeviceStatus storedDeviceStatus = |
468 storedModule.iStatus.DeviceStatus(); |
456 storedModule.iStatus.DeviceStatus(); |
469 if (storedDeviceStatus == KStatusDisabled) |
457 if (storedDeviceStatus == KStatusDisabled) |
470 { |
458 { |
708 } |
696 } |
709 DEBUG_TRACE("Writing event object out", __LINE__); |
697 DEBUG_TRACE("Writing event object out", __LINE__); |
710 } |
698 } |
711 |
699 |
712 /** |
700 /** |
713 * Notify event to subscriber |
|
714 */ |
|
715 void CPosModulesStatus::NotifyPosModuleStatusToSubscriber(const TPositionModuleId& aImplementationUid, const TPositionModuleStatus& aStatus) |
|
716 { |
|
717 //1. Search for uid in the list of active uids |
|
718 //2. If uid doesnt exist, and status is active - add uid in the list |
|
719 //3. If uid exists and status is inactive - remove it from the list |
|
720 |
|
721 TPositionModuleStatus::TDeviceStatus devStatus = aStatus.DeviceStatus(); |
|
722 TInt item = iActivePosModuleArray.Find(aImplementationUid); |
|
723 if(item == KErrNotFound) |
|
724 { |
|
725 if(devStatus == TPositionModuleStatus::EDeviceActive || devStatus == TPositionModuleStatus::EDeviceReady) |
|
726 { |
|
727 //Ignoring error as RArray by default creates array of Granularity 8 |
|
728 iActivePosModuleArray.Append(aImplementationUid); |
|
729 } |
|
730 } |
|
731 else |
|
732 { |
|
733 if(!(devStatus == TPositionModuleStatus::EDeviceActive || devStatus == TPositionModuleStatus::EDeviceReady)) |
|
734 { |
|
735 iActivePosModuleArray.Remove(item); |
|
736 } |
|
737 } |
|
738 |
|
739 TInt itemCount = iActivePosModuleArray.Count(); |
|
740 if(itemCount > 0) |
|
741 { |
|
742 RProperty::Set(iPosStatusCategory, KLbsMoPositioningStatusKey, itemCount); |
|
743 } |
|
744 else |
|
745 { |
|
746 RProperty::Set(iPosStatusCategory, KLbsMoPositioningStatusKey, 0); |
|
747 } |
|
748 } |
|
749 |
|
750 /** |
|
751 * Timer callback |
701 * Timer callback |
752 */ |
702 */ |
753 TInt CPosModulesStatus::TimerCallback(TAny* aModulesStatus) |
703 TInt CPosModulesStatus::TimerCallback(TAny* aModulesStatus) |
754 { |
704 { |
755 CPosModulesStatus* moduleStatus = |
705 CPosModulesStatus* moduleStatus = |