547 void CSuplProxyProtocol::RequestNetworkLocation( |
547 void CSuplProxyProtocol::RequestNetworkLocation( |
548 const TLbsNetSessionId& aSessionId, |
548 const TLbsNetSessionId& aSessionId, |
549 const TLbsNetPosRequestOptionsBase& aOptions) |
549 const TLbsNetPosRequestOptionsBase& aOptions) |
550 { |
550 { |
551 LBSLOG(ELogP1, "CSuplProxyProtocol::RequestNetworkLocation() Begin\n"); |
551 LBSLOG(ELogP1, "CSuplProxyProtocol::RequestNetworkLocation() Begin\n"); |
|
552 |
|
553 if(!iSuplTiApiWrapper) |
|
554 { |
|
555 //Error, TI Plugin not available. Complete the request with error |
|
556 LBSLOG_ERR(ELogP1, "Error, TI Plugin not available, not able to complete request"); |
|
557 LBSLOG2(ELogP1, "-->ProcessSessionComplete(0x%x)\n", aSessionId.SessionNum()); |
|
558 iObserver.ProcessSessionComplete(aSessionId, KErrNotReady); |
|
559 return; |
|
560 } |
552 |
561 |
553 const TLbsNetPosRequestOptions reqParams = |
562 const TLbsNetPosRequestOptions reqParams = |
554 static_cast<const TLbsNetPosRequestOptions&> (aOptions); |
563 static_cast<const TLbsNetPosRequestOptions&> (aOptions); |
555 |
564 |
556 CLbsNetSession* netSession = new CLbsNetSession(aSessionId, MLbsNetworkProtocolObserver2::EServiceNetworkLocation); |
565 CLbsNetSession* netSession = new CLbsNetSession(aSessionId, MLbsNetworkProtocolObserver2::EServiceNetworkLocation); |
561 reqParams.GetRequestQuality(quality); |
570 reqParams.GetRequestQuality(quality); |
562 netSession->SetQuality(quality); |
571 netSession->SetQuality(quality); |
563 |
572 |
564 // Add this request to the queue of outstanding requests |
573 // Add this request to the queue of outstanding requests |
565 LBSLOG2(ELogP1, "CSuplProxyProtocol::RequestNetworkLocation() Adding sppm session object 0x%x to array\n", aSessionId); |
574 LBSLOG2(ELogP1, "CSuplProxyProtocol::RequestNetworkLocation() Adding sppm session object 0x%x to array\n", aSessionId); |
566 TInt err = iLbsNetSessions.Append(netSession); |
575 iLbsNetSessions.Append(netSession); |
567 if(KErrNone != err) |
|
568 { |
|
569 LBSLOG(ELogP1, "CSuplProxyProtocol::RequestNetworkLocation() - iLbsNetSessions.Append failed!!\n"); |
|
570 delete netSession; |
|
571 } |
|
572 } |
576 } |
573 |
577 |
574 //Create the prioritised list of positioning methods |
578 //Create the prioritised list of positioning methods |
575 TLbsNetPosRequestMethod posReqMethods; |
579 TLbsNetPosRequestMethod posReqMethods; |
576 TLbsNetPosMethod posMethod[2]; |
580 TLbsNetPosMethod posMethod[2]; |
645 if (aOptions.ClassType() != ELbsNetPosRequestOptionsAssistanceClass) |
649 if (aOptions.ClassType() != ELbsNetPosRequestOptionsAssistanceClass) |
646 { |
650 { |
647 LBSLOG2(ELogP1, "-->ProcessSessionComplete(0x%x)\n", aSessionId.SessionNum()); |
651 LBSLOG2(ELogP1, "-->ProcessSessionComplete(0x%x)\n", aSessionId.SessionNum()); |
648 iObserver.ProcessSessionComplete(aSessionId, KErrNone); |
652 iObserver.ProcessSessionComplete(aSessionId, KErrNone); |
649 } |
653 } |
|
654 else if(!iSuplTiApiWrapper) |
|
655 { |
|
656 //Error, TI Plugin not available. Complete the request with error |
|
657 LBSLOG_ERR(ELogP1, "Error, TI Plugin not available, not able to complete request"); |
|
658 LBSLOG2(ELogP1, "-->ProcessSessionComplete(0x%x)\n", aSessionId.SessionNum()); |
|
659 iObserver.ProcessSessionComplete(aSessionId, KErrNotReady); |
|
660 } |
650 else |
661 else |
651 { |
662 { |
652 |
663 |
653 //Parameters for the SelfLocation request |
664 //Parameters for the SelfLocation request |
654 const TLbsNetPosRequestOptionsAssistance |
665 const TLbsNetPosRequestOptionsAssistance |
720 // Store the positioning method |
731 // Store the positioning method |
721 netSession->SetPosMethod(posReqMethods); |
732 netSession->SetPosMethod(posReqMethods); |
722 |
733 |
723 // Add this request to the queue of outstanding requests |
734 // Add this request to the queue of outstanding requests |
724 LBSLOG2(ELogP1, "CSuplProxyProtocol::RequestSelfLocation() Adding sppm session object 0x%x to array\n", aSessionId); |
735 LBSLOG2(ELogP1, "CSuplProxyProtocol::RequestSelfLocation() Adding sppm session object 0x%x to array\n", aSessionId); |
725 TInt err = iLbsNetSessions.Append(netSession); |
736 iLbsNetSessions.Append(netSession); |
726 if(KErrNone != err) |
|
727 { |
|
728 LBSLOG(ELogP1, "CSuplProxyProtocol::RequestSelfLocation() - iLbsNetSessions.Append failed!!\n"); |
|
729 delete netSession; |
|
730 return; |
|
731 } |
|
732 } |
737 } |
733 |
738 |
734 //Inform LBS of the start of an MOLR - TB |
739 //Inform LBS of the start of an MOLR - TB |
735 StatusUpdate(MLbsNetworkProtocolObserver2::EServiceSelfLocation, ETrue); |
740 StatusUpdate(MLbsNetworkProtocolObserver2::EServiceSelfLocation, ETrue); |
736 |
741 |
866 Second stage private constructor. |
871 Second stage private constructor. |
867 */ |
872 */ |
868 void CSuplProxyProtocol::ConstructL() |
873 void CSuplProxyProtocol::ConstructL() |
869 { |
874 { |
870 LBSLOG(ELogP1, "CSuplProxyProtocol::ConstructL() Begin\n"); |
875 LBSLOG(ELogP1, "CSuplProxyProtocol::ConstructL() Begin\n"); |
|
876 TInt err = KErrNone; |
871 |
877 |
872 CRepository* cenRep = CRepository::NewLC(KLbsSuplProxyProtocolModuleCenRepUid); |
878 CRepository* cenRep = CRepository::NewLC(KLbsSuplProxyProtocolModuleCenRepUid); |
873 TInt refLocSourceId(KErrNone); |
879 TInt refLocSourceId(KErrNone); |
874 TInt result = cenRep->Get(KLbsRefLocationSource, refLocSourceId); |
880 TInt result = cenRep->Get(KLbsRefLocationSource, refLocSourceId); |
875 if(KErrNone != result) |
881 if(KErrNone != result) |
885 |
891 |
886 iServer = CSuplProxyServer::NewL(*this,*this,refLocSourceId); |
892 iServer = CSuplProxyServer::NewL(*this,*this,refLocSourceId); |
887 |
893 |
888 LBSLOG(ELogP9, "->A CLbsSuplTiApi::NewL() SUPL-FW\n"); |
894 LBSLOG(ELogP9, "->A CLbsSuplTiApi::NewL() SUPL-FW\n"); |
889 LBSLOG2(ELogP9, " > Uid = 0x%08X\n", suplTiPluginImplUid); |
895 LBSLOG2(ELogP9, " > Uid = 0x%08X\n", suplTiPluginImplUid); |
890 iSuplTiApiWrapper = CLbsSuplTiApi::NewL(*this, TUid::Uid(suplTiPluginImplUid)); |
896 TRAP(err, iSuplTiApiWrapper = CLbsSuplTiApi::NewL(*this, TUid::Uid(suplTiPluginImplUid))); |
|
897 if(err != KErrNone) |
|
898 { |
|
899 LBSLOG_ERR2(ELogP1, "Failed to load the Terminal Initiation API Plugin (error: %d)", err); |
|
900 } |
891 |
901 |
892 CLbsAdmin* admin = CLbsAdmin::NewL(); |
902 CLbsAdmin* admin = CLbsAdmin::NewL(); |
893 CleanupStack::PushL(admin); |
903 CleanupStack::PushL(admin); |
894 |
904 |
895 // Read admin setting for maximum number of external locate requests |
905 // Read admin setting for maximum number of external locate requests |
896 TUint maxExternalLocateRequests = KLbsDefaultMaximumExternalLocateRequests; |
906 TUint maxExternalLocateRequests = KLbsDefaultMaximumExternalLocateRequests; |
897 TInt err = admin->Get(KLbsSettingMaximumExternalLocateRequests, maxExternalLocateRequests); |
907 err = admin->Get(KLbsSettingMaximumExternalLocateRequests, maxExternalLocateRequests); |
898 if (err != KErrNone) |
908 if (err != KErrNone) |
899 { |
909 { |
900 LBSLOG_ERR2(ELogP4, "Failed to get KLbsSettingMaximumExternalLocateRequests (err %d)", err); |
910 LBSLOG_ERR2(ELogP4, "Failed to get KLbsSettingMaximumExternalLocateRequests (err %d)", err); |
901 } |
911 } |
902 iMaxSimultaneousActiveRequests = maxExternalLocateRequests; |
912 iMaxSimultaneousActiveRequests = maxExternalLocateRequests; |
978 CLbsNetSession* netSession = new CLbsNetSession(sessionId, MLbsNetworkProtocolObserver::EServiceMobileTerminated); |
988 CLbsNetSession* netSession = new CLbsNetSession(sessionId, MLbsNetworkProtocolObserver::EServiceMobileTerminated); |
979 if(netSession) |
989 if(netSession) |
980 { |
990 { |
981 netSession->SetExtRequestInfo(extReqInfo); |
991 netSession->SetExtRequestInfo(extReqInfo); |
982 LBSLOG2(ELogP1, "CSuplProxyProtocol::ProcessRequest() Adding sppm session object 0x%x to array\n", sessionId); |
992 LBSLOG2(ELogP1, "CSuplProxyProtocol::ProcessRequest() Adding sppm session object 0x%x to array\n", sessionId); |
983 TInt err = iLbsNetSessions.Append(netSession); |
993 iLbsNetSessions.Append(netSession); |
984 if (err != KErrNone) |
|
985 { |
|
986 // A problem occured and the request could not be added to the buffer |
|
987 LBSLOG_WARN2(ELogP1, "CSuplProxyProtocol::ProcessRequest() - iLbsNetSessions.Append failed!! - (%d)\n", err); |
|
988 if (aRequest->IsResponseRequired()) |
|
989 { |
|
990 aRequest->CompleteRequest(err); |
|
991 } |
|
992 delete netSession; |
|
993 delete aRequest; |
|
994 return; |
|
995 } |
|
996 } |
994 } |
997 } |
995 } |
998 } |
996 } |
999 |
997 |
1000 TLbsNetPosRequestPrivacy requestPrivacy; |
998 TLbsNetPosRequestPrivacy requestPrivacy; |
1145 //Store the observer (subsession) for forwarding future requests/updates |
1143 //Store the observer (subsession) for forwarding future requests/updates |
1146 netSession->SetPosProtocolResponseObserver(aObserver); |
1144 netSession->SetPosProtocolResponseObserver(aObserver); |
1147 netSession->SetPosSessionStarted(ETrue); |
1145 netSession->SetPosSessionStarted(ETrue); |
1148 netSession->SetSessionStarted(); |
1146 netSession->SetSessionStarted(); |
1149 LBSLOG2(ELogP1, "CSuplProxyProtocol::NotifySubSessionOpen() Adding sppm session object 0x%x to array\n", sessionId); |
1147 LBSLOG2(ELogP1, "CSuplProxyProtocol::NotifySubSessionOpen() Adding sppm session object 0x%x to array\n", sessionId); |
1150 TInt err = iLbsNetSessions.Append(netSession); |
1148 iLbsNetSessions.Append(netSession); |
1151 if(KErrNone != err) |
|
1152 { |
|
1153 LBSLOG(ELogP1, "CSuplProxyProtocol::NotifySubSessionOpen() - iLbsNetSessions.Append failed!!\n"); |
|
1154 delete netSession; |
|
1155 } |
|
1156 } |
1149 } |
1157 //Update LBS of the currently active services including this new session type |
1150 //Update LBS of the currently active services including this new session type |
1158 StatusUpdate(MLbsNetworkProtocolObserver2::EServiceTriggeredMolr,ETrue); |
1151 StatusUpdate(MLbsNetworkProtocolObserver2::EServiceTriggeredMolr,ETrue); |
1159 } |
1152 } |
1160 else |
1153 else |
1549 */ |
1542 */ |
1550 void CSuplProxyProtocol::RequestComplete(TInt aReason, |
1543 void CSuplProxyProtocol::RequestComplete(TInt aReason, |
1551 const TLbsNetSessionId& aSessionId) |
1544 const TLbsNetSessionId& aSessionId) |
1552 { |
1545 { |
1553 LBSLOG(ELogP1, "CSuplProxyProtocol::RequestComplete() Begin\n"); |
1546 LBSLOG(ELogP1, "CSuplProxyProtocol::RequestComplete() Begin\n"); |
1554 |
1547 |
1555 TInt index = iLbsNetSessions.Find(aSessionId, |
1548 TInt index = iLbsNetSessions.Find(aSessionId, |
1556 CLbsNetSession::IsSessionMatch); |
1549 CLbsNetSession::IsSessionMatch); |
1557 |
1550 |
1558 if (index >= 0) |
1551 if (index >= 0) |
1559 { |
1552 { |