860 //Informs to client about completion of location request, thro' active object |
868 //Informs to client about completion of location request, thro' active object |
861 void COMASuplSession::CompleteSession(TInt aCompletionCode) |
869 void COMASuplSession::CompleteSession(TInt aCompletionCode) |
862 { |
870 { |
863 if(iRunRequestStatus) |
871 if(iRunRequestStatus) |
864 { |
872 { |
865 |
873 TTimeIntervalSeconds timeTaken; |
866 TTime currentTime; |
874 TTime currentTime; |
867 currentTime.HomeTime(); |
875 currentTime.HomeTime(); |
|
876 currentTime.SecondsFrom(iSessionStartTime1,timeTaken); |
|
877 |
|
878 #ifdef PRINT_MESSAGE |
|
879 TBuf<30> bufTime1; |
|
880 _LIT( KFormatDate, "%d%+02d%+02d:%+02d%+02d%+02d.%+06d"); |
|
881 |
|
882 TDateTime datetime = iSessionStartTime1.DateTime(); |
|
883 bufTime1.Format( KFormatDate, datetime.Year(), |
|
884 datetime.Month(), datetime.Day(), |
|
885 datetime.Hour(), datetime.Minute(), |
|
886 datetime.Second(), datetime.MicroSecond()); |
|
887 |
|
888 iLogger.Write(_L("Session started at time : ")); |
|
889 iLogger.Write(bufTime1); |
|
890 |
|
891 TBuf<30> bufTime; |
|
892 |
|
893 TDateTime datetime1 = currentTime.DateTime(); |
|
894 bufTime.Format( KFormatDate, datetime1.Year(), |
|
895 datetime1.Month(), datetime1.Day(), |
|
896 datetime1.Hour(), datetime1.Minute(), |
|
897 datetime1.Second(), datetime1.MicroSecond()); |
|
898 |
|
899 iLogger.Write(_L("Session ended at time : ")); |
|
900 iLogger.Write(bufTime); |
|
901 iLogger.Write(_L("Time taken : ")); |
|
902 //bufTime.Copy(timeTaken); |
|
903 iLogger.Write(bufTime); |
|
904 #endif |
|
905 |
868 iSessionCompletionCode = aCompletionCode; |
906 iSessionCompletionCode = aCompletionCode; |
869 |
907 |
870 TBuf<64> errorCode; |
908 TBuf<64> errorCode; |
871 errorCode.Append(_L("Completing Session with error code : ")); |
909 errorCode.Append(_L("Completing Session with error code : ")); |
872 errorCode.AppendNum(aCompletionCode); |
910 errorCode.AppendNum(aCompletionCode); |
2034 // (other items were commented in a header). |
2072 // (other items were commented in a header). |
2035 // ----------------------------------------------------------------------------- |
2073 // ----------------------------------------------------------------------------- |
2036 // |
2074 // |
2037 void COMASuplSession::HandleOMASuplMessageL(COMASuplAsnMessageBase* aDecodedAsnMessage,TRequestStatus& aStatus,TInt aSessionIdSeed,TInt aErrorCode) |
2075 void COMASuplSession::HandleOMASuplMessageL(COMASuplAsnMessageBase* aDecodedAsnMessage,TRequestStatus& aStatus,TInt aSessionIdSeed,TInt aErrorCode) |
2038 { |
2076 { |
2039 delete iSuplState; |
2077 delete iSuplState; |
2040 iSuplState = NULL; |
2078 iSuplState = NULL; |
2041 |
2079 |
2042 iSETSessionUniqueId = aSessionIdSeed; |
2080 iSETSessionUniqueId = aSessionIdSeed; |
2043 iRunRequestStatus = & aStatus; |
2081 iRunRequestStatus = & aStatus; |
2044 *iRunRequestStatus = KRequestPending; |
2082 *iRunRequestStatus = KRequestPending; |
2045 |
2083 |
2046 TInt networkMode = 1; |
2084 TInt networkMode = 1; |
2047 networkMode = GetNetworkModeL(); |
2085 networkMode = GetNetworkModeL(); |
2048 |
2086 |
2049 TBuf<64> msg; |
2087 TBuf<64> msg; |
2050 if ( networkMode == ECoreAppUIsNetworkConnectionNotAllowed ) |
2088 if ( networkMode == ECoreAppUIsNetworkConnectionNotAllowed ) |
2051 { |
2089 { |
2052 msg.Copy(_L("The device is in OFFLINE mode.")); |
2090 msg.Copy(_L("The device is in OFFLINE mode.")); |
2053 iTrace->Trace(msg,KTraceFileName, __LINE__); |
2091 iTrace->Trace(msg,KTraceFileName, __LINE__); |
2054 iSessionObserver.TerminateSession(this, KErrGeneral); |
2092 iSessionObserver.TerminateSession(this, KErrGeneral); |
2055 return; |
2093 return; |
2056 } |
2094 } |
2057 else |
2095 else |
2058 { |
2096 { |
2059 msg.Copy(_L("The device is in ON LINE mode.")); |
2097 msg.Copy(_L("The device is in ON LINE mode.")); |
2060 iTrace->Trace(msg,KTraceFileName, __LINE__); |
2098 iTrace->Trace(msg,KTraceFileName, __LINE__); |
2061 } |
2099 } |
2062 |
2100 |
2063 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
2101 /*CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
2064 |
2102 |
2065 if (usage == CSuplSettings::ESuplUsageDisabled) |
2103 if (usage == CSuplSettings::ESuplUsageDisabled) |
2066 { |
2104 { |
2067 msg.Copy(_L("SUPL Usage is disabled")); |
2105 msg.Copy(_L("SUPL Usage is disabled")); |
2068 iTrace->Trace(msg,KTraceFileName, __LINE__); |
2106 iTrace->Trace(msg,KTraceFileName, __LINE__); |
2069 iSessionObserver.TerminateSession(this, KErrGeneral); |
2107 iSessionObserver.TerminateSession(this, KErrGeneral); |
2070 return; |
2108 return; |
2071 } |
2109 }*/ |
2072 |
2110 |
2073 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsnMessage->MessageType(); |
2111 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsnMessage->MessageType(); |
2074 |
2112 |
2075 if(messageType == COMASuplAsnMessageBase::ESUPL_INIT && aErrorCode == KErrNone) |
2113 if(messageType == COMASuplAsnMessageBase::ESUPL_INIT && aErrorCode == KErrNone) |
2076 { |
|
2077 HandleOMASuplMessageL(aDecodedAsnMessage); |
|
2078 } |
|
2079 else //Other messages than SUPL_INIT.... Send End |
|
2080 { |
|
2081 CreateCloneMessageL(aDecodedAsnMessage); |
|
2082 UpdateSuplSessionIDL(); |
|
2083 |
|
2084 if (iRequestType == ESUPL_NETWORK && messageType == COMASuplAsnMessageBase::ESUPL_INIT) |
|
2085 { |
2114 { |
2086 ServerAddressCheckForSuplInitL(); |
2115 HandleOMASuplMessageL(aDecodedAsnMessage); |
2087 } |
2116 } |
2088 |
2117 else //Other messages than SUPL_INIT.... Send End |
2089 iSuplSessionState = ESUPL_INITIALIZED; |
2118 { |
2090 iSuplMsgType = ESUPL_END; |
2119 CreateCloneMessageL(aDecodedAsnMessage); |
2091 |
2120 UpdateSuplSessionIDL(); |
2092 if((aErrorCode == KErrCompletion && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
2121 if (iRequestType == ESUPL_NETWORK && messageType == COMASuplAsnMessageBase::ESUPL_INIT) |
2093 (aErrorCode == KErrOMASuplOutOfRangeParameter && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
2122 { |
2094 (aErrorCode == KErrOMASuplMessageLengthMismatch && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
2123 ServerAddressCheckForSuplInitL(); |
2095 (aErrorCode == KErrOMASuplShortFrame && messageType == COMASuplAsnMessageBase::ESUPL_INIT)) |
2124 } |
2096 { |
2125 iSuplSessionState = ESUPL_INITIALIZED; |
2097 iErrorStatusCode = COMASuplEnd::EUnexpectedDataValue; |
2126 iSuplMsgType = ESUPL_END; |
2098 if(aErrorCode == KErrOMASuplMessageLengthMismatch) |
2127 |
2099 { |
2128 if((aErrorCode == KErrCompletion && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
2100 iErrorStatusCode = COMASuplEnd::EProtocolError; |
2129 (aErrorCode == KErrOMASuplOutOfRangeParameter && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
2101 } |
2130 (aErrorCode == KErrOMASuplMessageLengthMismatch && messageType == COMASuplAsnMessageBase::ESUPL_INIT) || |
2102 if(aErrorCode == KErrOMASuplShortFrame) |
2131 (aErrorCode == KErrOMASuplShortFrame && messageType == COMASuplAsnMessageBase::ESUPL_INIT)) |
2103 { |
2132 { |
2104 iErrorStatusCode = COMASuplEnd::EDataMissing; |
2133 iErrorStatusCode = COMASuplEnd::EUnexpectedDataValue; |
2105 } |
2134 if(aErrorCode == KErrOMASuplMessageLengthMismatch) |
2106 TInt len = iHSLPAddress.Length(); |
2135 { |
2107 HBufC8 *hslpAdress = NULL; |
2136 iErrorStatusCode = COMASuplEnd::EProtocolError; |
2108 if(len > 0) |
2137 } |
2109 { |
2138 if(aErrorCode == KErrOMASuplShortFrame) |
2110 hslpAdress = HBufC8::NewL(iHSLPAddress.Length()); |
2139 { |
2111 hslpAdress->Des().Copy(iHSLPAddress); |
2140 iErrorStatusCode = COMASuplEnd::EDataMissing; |
2112 } |
2141 } |
2113 else if(len ==0) |
2142 TInt len = iHSLPAddress.Length(); |
2114 { |
2143 HBufC8 *hslpAdress = NULL; |
2115 CServerParams* serverParams = CServerParams::NewL(); |
2144 if(len > 0) |
2116 CleanupStack::PushL(serverParams); |
2145 { |
2117 |
2146 hslpAdress = HBufC8::NewL(iHSLPAddress.Length()); |
2118 if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound ) |
2147 hslpAdress->Des().Copy(iHSLPAddress); |
2119 { |
2148 } |
2120 iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
|
2121 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
|
2122 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
|
2123 } |
|
2124 else |
|
2125 { |
|
2126 iTrace->Trace(_L("Sending End with ver for Default HSLP"), KTraceFileName, __LINE__); |
|
2127 TInt64 slpId; |
|
2128 TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable; |
|
2129 HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen); |
|
2130 HBufC* iapName = HBufC::NewL(KMaxIAPLen); |
|
2131 CleanupStack::PushL(serverAddr); |
|
2132 CleanupStack::PushL(iapName); |
|
2133 serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable); |
|
2134 hslpAdress = HBufC8::NewL(serverAddr->Length()); |
|
2135 hslpAdress->Des().Copy(*serverAddr); |
|
2136 |
2149 |
2137 CleanupStack::PopAndDestroy(iapName); |
2150 else if(len ==0) |
2138 CleanupStack::PopAndDestroy(serverAddr); |
2151 { |
2139 |
2152 CServerParams* serverParams = CServerParams::NewL(); |
2140 } |
2153 CleanupStack::PushL(serverParams); |
2141 CleanupStack::PopAndDestroy(serverParams); |
2154 |
2142 } |
2155 if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound ) |
2143 delete iSuplState; |
2156 { |
2144 iSuplState = NULL; |
2157 iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
2145 CleanupStack::PushL(hslpAdress); |
2158 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
2146 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
2159 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
2147 CleanupStack::PopAndDestroy(hslpAdress); |
2160 } |
2148 } |
2161 else |
2149 else |
2162 { |
2150 { |
2163 iTrace->Trace(_L("Sending End with ver for Default HSLP"), KTraceFileName, __LINE__); |
2151 iErrorStatusCode = COMASuplEnd::EUnexpectedMessage; |
2164 TInt64 slpId; |
2152 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl); |
2165 TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable; |
2153 } |
2166 HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen); |
|
2167 HBufC* iapName = HBufC::NewL(KMaxIAPLen); |
|
2168 CleanupStack::PushL(serverAddr); |
|
2169 CleanupStack::PushL(iapName); |
|
2170 serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable); |
|
2171 hslpAdress = HBufC8::NewL(serverAddr->Length()); |
|
2172 hslpAdress->Des().Copy(*serverAddr); |
|
2173 |
|
2174 CleanupStack::PopAndDestroy(iapName); |
|
2175 CleanupStack::PopAndDestroy(serverAddr); |
|
2176 } |
|
2177 CleanupStack::PopAndDestroy(serverParams); |
|
2178 } |
|
2179 delete iSuplState; |
|
2180 iSuplState = NULL; |
|
2181 CleanupStack::PushL(hslpAdress); |
|
2182 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
|
2183 CleanupStack::PopAndDestroy(hslpAdress); |
|
2184 } |
|
2185 else |
|
2186 { |
|
2187 iErrorStatusCode = COMASuplEnd::EUnexpectedMessage; |
|
2188 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl); |
|
2189 } |
2154 |
2190 |
2155 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
2191 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
2156 iSuplState->SetMsgStateObserver(this); |
2192 iSuplState->SetMsgStateObserver(this); |
2157 //SMP Changes |
2193 //SMP Changes |
2158 iSuplState->GenerateMessageL(); //Has to be here because initialisation has to be done for NI case in decode failed scenario. |
2194 iSuplState->GenerateMessageL(); //Has to be here because initialisation has to be done for NI case in decode failed scenario. |
2159 iSuplSessionState = ESUPL_GENERATE; |
2195 iSuplSessionState = ESUPL_GENERATE; |
2160 } |
2196 } |
2161 } |
2197 } |
2162 |
2198 |
2163 // ----------------------------------------------------------------------------- |
2199 // ----------------------------------------------------------------------------- |
2164 // COMASuplSession::HandleOMASuplMessage |
2200 // COMASuplSession::HandleOMASuplMessage |
2165 // Handles OMA Supl messages & starts processing according to state of session. |
2201 // Handles OMA Supl messages & starts processing according to state of session. |
2166 // (other items were commented in a header). |
2202 // (other items were commented in a header). |
2167 // ----------------------------------------------------------------------------- |
2203 // ----------------------------------------------------------------------------- |
2168 // |
2204 // |
2169 void COMASuplSession::HandleOMASuplMessageL(COMASuplAsnMessageBase* aDecodedAsnMessage) |
2205 void COMASuplSession::HandleOMASuplMessageL(COMASuplAsnMessageBase* aDecodedAsnMessage) |
2170 { |
2206 { |
2171 CreateCloneMessageL(aDecodedAsnMessage); |
2207 CreateCloneMessageL(aDecodedAsnMessage); |
2172 if(CheckProtocolVersionL(aDecodedAsnMessage)) //Checks version with supported version |
2208 if(CheckProtocolVersionL(aDecodedAsnMessage)) //Checks version with supported version |
2173 { |
2209 { |
2174 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsnMessage->MessageType(); |
2210 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsnMessage->MessageType(); |
2175 |
|
2176 if(messageType != COMASuplAsnMessageBase::ESUPL_POS) |
2211 if(messageType != COMASuplAsnMessageBase::ESUPL_POS) |
2177 { |
2212 { |
2178 iCompleteSelfRequestor->CompleteSelf(); //This will result in call of RequestCompleted() |
2213 iCompleteSelfRequestor->CompleteSelf(); //This will result in call of RequestCompleted() |
2179 } |
2214 } |
2180 else |
2215 else |
3370 hslpAdress->Des().Copy(iHSLPAddress); |
3407 hslpAdress->Des().Copy(iHSLPAddress); |
3371 } |
3408 } |
3372 |
3409 |
3373 else if(len ==0) |
3410 else if(len ==0) |
3374 { |
3411 { |
3375 CServerParams* serverParams = CServerParams::NewL(); |
3412 CServerParams* serverParams = CServerParams::NewL(); |
3376 CleanupStack::PushL(serverParams); |
3413 CleanupStack::PushL(serverParams); |
3377 |
3414 |
3378 if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound ) |
3415 if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound ) |
3379 { |
3416 { |
3380 iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
3417 iTrace->Trace(_L("HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
3381 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
3418 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
3382 CleanupStack::PushL(hslpAdress); |
3419 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
3383 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
3420 } |
3384 CleanupStack::Pop(hslpAdress); |
3421 else |
3385 } |
3422 { |
3386 else |
3423 iTrace->Trace(_L("Default HSLP"), KTraceFileName, __LINE__); |
3387 { |
3424 TInt64 slpId; |
3388 iTrace->Trace(_L("Default HSLP"), KTraceFileName, __LINE__); |
3425 TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable; |
3389 TInt64 slpId; |
3426 HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen); |
3390 TBool aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable; |
3427 HBufC* iapName = HBufC::NewL(KMaxIAPLen); |
3391 HBufC* serverAddr = HBufC::NewL(KMaxHSLPAddrLen); |
3428 CleanupStack::PushL(serverAddr); |
3392 HBufC* iapName = HBufC::NewL(KMaxIAPLen); |
3429 CleanupStack::PushL(iapName); |
3393 CleanupStack::PushL(serverAddr); |
3430 serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable); |
3394 CleanupStack::PushL(iapName); |
3431 hslpAdress = HBufC8::NewL(serverAddr->Length()); |
3395 serverParams->Get(slpId,serverAddr->Des(),iapName->Des(),aServerEnabled, aSimChangeRemove, aUsageInHomeNw, aEditable); |
3432 hslpAdress->Des().Copy(*serverAddr); |
3396 hslpAdress = HBufC8::NewL(serverAddr->Length()); |
3433 |
3397 hslpAdress->Des().Copy(*serverAddr); |
3434 CleanupStack::PopAndDestroy(iapName); |
3398 |
3435 CleanupStack::PopAndDestroy(serverAddr); |
3399 CleanupStack::PopAndDestroy(iapName); |
3436 } |
3400 CleanupStack::PopAndDestroy(serverAddr); |
3437 CleanupStack::PopAndDestroy(serverParams); |
3401 |
3438 } |
3402 } |
3439 |
3403 CleanupStack::PopAndDestroy(serverParams); |
3440 delete iSuplState; |
3404 |
3441 iSuplState = NULL; |
3405 } |
3442 CleanupStack::PushL(hslpAdress); |
3406 delete iSuplState; |
3443 if(setStatusCode) |
3407 iSuplState = NULL; |
3444 { |
3408 CleanupStack::PushL(hslpAdress); |
3445 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
3409 if(setStatusCode) |
3446 } |
3410 { |
3447 else |
3411 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
3448 { |
3412 } |
3449 iSuplState = COMASuplEndState::NewL(iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress ); |
3413 else |
3450 } |
3414 { |
|
3415 iSuplState = COMASuplEndState::NewL(iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress ); |
|
3416 } |
|
3417 |
3451 |
3418 CleanupStack::PopAndDestroy(hslpAdress); |
3452 CleanupStack::PopAndDestroy(hslpAdress); |
3419 |
3453 |
3420 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError Send SUPL_END for SUPL_INIT"), KTraceFileName, __LINE__); |
3454 iTrace->Trace(_L("COMASuplSession::HandleSuplInitError Send SUPL_END for SUPL_INIT"), KTraceFileName, __LINE__); |
3421 |
3455 |
3865 // COMASuplSession::CheckProtocolVersion |
3899 // COMASuplSession::CheckProtocolVersion |
3866 // Returns true if its matching else false |
3900 // Returns true if its matching else false |
3867 // ----------------------------------------------------------------------------- |
3901 // ----------------------------------------------------------------------------- |
3868 TBool COMASuplSession::CheckProtocolVersionL(COMASuplAsnMessageBase* aDecodedAsn) |
3902 TBool COMASuplSession::CheckProtocolVersionL(COMASuplAsnMessageBase* aDecodedAsn) |
3869 { |
3903 { |
3870 TOMASuplVersion version; |
3904 TOMASuplVersion version; |
3871 COMASuplSessionID* SessionID = NULL; |
3905 COMASuplSessionID* SessionID = NULL; |
3872 aDecodedAsn->MessageBase(version,SessionID); |
3906 aDecodedAsn->MessageBase(version,SessionID); |
3873 |
3907 |
3874 TInt recMajor,recMinor,recServInd; |
3908 TInt recMajor,recMinor,recServInd; |
3875 version.SuplVersion(recMajor,recMinor,recServInd); |
3909 version.SuplVersion(recMajor,recMinor,recServInd); |
3876 |
3910 |
3877 if(recMajor == KSuplMajorVersion ) |
3911 if(recMajor == KSuplMajorVersion ) |
3878 { |
3912 { |
3879 return ETrue; |
3913 return ETrue; |
3880 } |
3914 } |
3881 else |
3915 else |
3882 { |
3916 { |
3883 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsn->MessageType(); |
3917 COMASuplAsnMessageBase::TSuplMessageType messageType = aDecodedAsn->MessageType(); |
3884 if(messageType == COMASuplAsnMessageBase::ESUPL_END) |
3918 if(messageType == COMASuplAsnMessageBase::ESUPL_END) |
3885 { |
3919 { |
3886 iTrace->Trace(_L("Received message is SUPL_END...with wrong Version.Terminating session"), KTraceFileName, __LINE__); |
3920 iTrace->Trace(_L("Received message is SUPL_END...with wrong Version.Terminating session"), KTraceFileName, __LINE__); |
3887 iSessionObserver.TerminateSession(this, KErrCompletion); |
3921 iSessionObserver.TerminateSession(this, KErrCompletion); |
3888 } |
3922 } |
3889 else |
3923 else |
3890 { |
3924 { |
3891 iTrace->Trace(_L("Received message with wrong version."), KTraceFileName, __LINE__); |
3925 iTrace->Trace(_L("Received message with wrong version."), KTraceFileName, __LINE__); |
3892 |
3926 |
3893 delete iSuplState; |
3927 if (iSuplState) |
3894 iSuplMsgType = ESUPL_END; |
3928 { |
3895 iErrorStatusCode = COMASuplEnd::EVersionNotSupported; |
3929 delete iSuplState; |
3896 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
3930 iSuplState = NULL; |
3897 |
3931 } |
3898 if(iRequestType == ESUPL_NETWORK ) |
3932 iSuplMsgType = ESUPL_END; |
3899 { |
3933 iErrorStatusCode = COMASuplEnd::EVersionNotSupported; |
|
3934 SetPOSMsgPluginState(COMASuplPosSessionBase::EOMASuplCreating); |
|
3935 |
|
3936 if(iRequestType == ESUPL_NETWORK ) |
|
3937 { |
3900 if (messageType == COMASuplAsnMessageBase::ESUPL_INIT) |
3938 if (messageType == COMASuplAsnMessageBase::ESUPL_INIT) |
3901 { |
3939 { |
3902 iSuplSessionState = ESUPL_INITIALIZED; |
3940 |
3903 TInt len = iHSLPAddress.Length(); |
3941 iSuplSessionState = ESUPL_INITIALIZED; |
3904 HBufC8 *hslpAdress = NULL; |
3942 TInt len = iHSLPAddress.Length(); |
3905 if(len > 0) |
3943 HBufC8 *hslpAdress = NULL; |
3906 { |
3944 if(len > 0) |
3907 hslpAdress = HBufC8::NewL(iHSLPAddress.Length()); |
3945 { |
3908 hslpAdress->Des().Copy(iHSLPAddress); |
3946 hslpAdress = HBufC8::NewL(iHSLPAddress.Length()); |
3909 } |
3947 hslpAdress->Des().Copy(iHSLPAddress); |
3910 else if(len ==0) |
3948 } |
3911 { |
3949 else if(len ==0) |
|
3950 { |
3912 CServerParams* serverParams = CServerParams::NewL(); |
3951 CServerParams* serverParams = CServerParams::NewL(); |
3913 CleanupStack::PushL(serverParams); |
3952 CleanupStack::PushL(serverParams); |
3914 |
3953 |
3915 if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound ) |
3954 if (iSuplStorageSettings->GetDefaultServer(serverParams) == KErrNotFound ) |
3916 { |
3955 { |
3917 iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
3956 iTrace->Trace(_L("Length of HSLP Address is = 0, passing the HSLP generated frm IMSI"), KTraceFileName, __LINE__); |
3918 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
3957 hslpAdress = HBufC8::NewL(iSuplSettings->SLPAddressfromImsi().Length()); |
3919 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
3958 hslpAdress->Des().Copy(iSuplSettings->SLPAddressfromImsi()); |
3920 } |
3959 } |
3921 else |
3960 else |
3922 { |
3961 { |
3923 iTrace->Trace(_L("Sending End with ver for Default HSLP"), KTraceFileName, __LINE__); |
3962 iTrace->Trace(_L("Sending End with ver for Default HSLP"), KTraceFileName, __LINE__); |
3924 TInt64 slpId; |
3963 TInt64 slpId; |
3931 hslpAdress = HBufC8::NewL(serverAddr->Length()); |
3970 hslpAdress = HBufC8::NewL(serverAddr->Length()); |
3932 hslpAdress->Des().Copy(*serverAddr); |
3971 hslpAdress->Des().Copy(*serverAddr); |
3933 |
3972 |
3934 CleanupStack::PopAndDestroy(iapName); |
3973 CleanupStack::PopAndDestroy(iapName); |
3935 CleanupStack::PopAndDestroy(serverAddr); |
3974 CleanupStack::PopAndDestroy(serverAddr); |
3936 } |
3975 } |
3937 CleanupStack::PopAndDestroy(serverParams); |
3976 CleanupStack::PopAndDestroy(serverParams); |
3938 } |
3977 } |
3939 if(iSuplState) |
3978 |
3940 { |
3979 if(iSuplState) |
3941 delete iSuplState; |
3980 { |
3942 iSuplState = NULL; |
3981 delete iSuplState; |
3943 } |
3982 iSuplState = NULL; |
3944 CleanupStack::PushL(hslpAdress); |
3983 } |
3945 ServerAddressCheckForSuplInitL(); |
3984 |
3946 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
3985 CleanupStack::PushL(hslpAdress); |
3947 CleanupStack::PopAndDestroy(hslpAdress); |
3986 ServerAddressCheckForSuplInitL(); |
3948 |
3987 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl,iEncodedSuplInit,hslpAdress); |
3949 // Set the SessionId. |
3988 CleanupStack::PopAndDestroy(hslpAdress); |
3950 iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SLP Session ID"), KTraceFileName, __LINE__); |
3989 |
3951 UpdateSLPSessionIDL(SessionID); |
3990 // Set the SessionId. |
3952 |
3991 iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SLP Session ID"), KTraceFileName, __LINE__); |
3953 iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SET Session ID"), KTraceFileName, __LINE__); |
3992 UpdateSLPSessionIDL(SessionID); |
3954 UpdateSETSessionIDL(SessionID); |
3993 |
3955 iSuplState->SetMsgStateObserver(this); |
3994 iTrace->Trace(_L("COMASuplSession::CheckProtocolVersionL Update SET Session ID"), KTraceFileName, __LINE__); |
3956 iSuplState->GenerateMessageL(); |
3995 UpdateSETSessionIDL(SessionID); |
3957 iSuplSessionState = ESUPL_GENERATE; |
3996 iSuplState->SetMsgStateObserver(this); |
|
3997 iSuplState->GenerateMessageL(); |
|
3998 iSuplSessionState = ESUPL_GENERATE; |
3958 } |
3999 } |
3959 else |
4000 else |
3960 { |
4001 { |
3961 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl); |
4002 iSuplState = COMASuplEndState::NewL(iErrorStatusCode,iOMASuplAsnHandlerBaseImpl); |
3962 UpdateSLPSessionIDL(SessionID); |
4003 UpdateSLPSessionIDL(SessionID); |
4179 msg.AppendNum(aError); |
4222 msg.AppendNum(aError); |
4180 iTrace->Trace(msg,KTraceFileName, __LINE__); |
4223 iTrace->Trace(msg,KTraceFileName, __LINE__); |
4181 iSessionObserver.TerminateSession(this, KErrGeneral); |
4224 iSessionObserver.TerminateSession(this, KErrGeneral); |
4182 return; |
4225 return; |
4183 } |
4226 } |
4184 } |
4227 }*/ |
4185 |
4228 |
4186 // ----------------------------------------------------------------------------- |
4229 // ----------------------------------------------------------------------------- |
4187 // COMASuplSession::CheckForSuplUsageL |
4230 // COMASuplSession::CheckForSuplUsageL |
4188 // |
4231 // |
4189 // ----------------------------------------------------------------------------- |
4232 // ----------------------------------------------------------------------------- |
4190 void COMASuplSession::CheckForSuplUsageL() |
4233 void COMASuplSession::CheckForSuplUsageL() |
4191 { |
4234 { |
4192 |
4235 |
4193 if (iSuplUsage >= 1) |
4236 /*if (iSuplUsage >= 1) |
4194 { |
4237 { |
4195 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
4238 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
4196 if (usage == CSuplSettings::ESuplUsageDisabled) |
4239 if (usage == CSuplSettings::ESuplUsageDisabled) |
4197 { |
4240 { |
4198 iSessionObserver.TerminateSession(this, KErrGeneral); |
4241 iSessionObserver.TerminateSession(this, KErrGeneral); |
4199 } |
4242 } |
4200 else if (usage == CSuplSettings::ESuplUsageAutomatic) |
4243 else if (usage == CSuplSettings::ESuplUsageAutomatic) |
4201 { |
4244 { */ |
4202 if (iNwInitError) |
4245 if (iNwInitError) |
4203 { |
4246 { |
4204 iNwInitError = EFalse; |
4247 iNwInitError = EFalse; |
4205 HandleSuplInitErrorL(iNwInitCompletionCode); |
4248 HandleSuplInitErrorL(iNwInitCompletionCode); |
4206 } |
4249 } |
4207 else |
4250 else |
4208 InitializeL(iRequestID); |
4251 { |
4209 } |
4252 if (iRoaming) |
|
4253 HandleRoamingCheckCompleteL(KErrNone, EFalse); |
|
4254 else |
|
4255 { |
|
4256 iEtelRoamingCheck = ETrue; |
|
4257 iProtocolManager.CheckForRoaming(); |
|
4258 } |
|
4259 //InitializeL(iRequestID); |
|
4260 } |
|
4261 /*} |
4210 |
4262 |
4211 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic || usage == CSuplSettings::ESuplUsageAlwaysAsk) |
4263 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic || usage == CSuplSettings::ESuplUsageAlwaysAsk) |
4212 { |
4264 { |
4213 if (iRoaming) |
4265 if (iRoaming) |
4214 HandleRoamingCheckCompleteL(KErrNone, EFalse); |
4266 HandleRoamingCheckCompleteL(KErrNone, EFalse); |
4301 iEtelRoamingCheck = EFalse; |
4353 iEtelRoamingCheck = EFalse; |
4302 if (aErrorCode == KErrNone) |
4354 if (aErrorCode == KErrNone) |
4303 { |
4355 { |
4304 iUsageHomeNW = aHomeNw; |
4356 iUsageHomeNW = aHomeNw; |
4305 iConnRequestor->UpdateSLPListForHomeUsage(iUsageHomeNW); |
4357 iConnRequestor->UpdateSLPListForHomeUsage(iUsageHomeNW); |
4306 CSuplSettings::TSuplSettingsUsage usage = iSuplSettings->SUPLUsage(); |
|
4307 |
|
4308 if (usage == CSuplSettings::ESuplUsageAlwaysAsk || iStaleLocIdPrompt) |
|
4309 { |
|
4310 TInt err; |
|
4311 if (!iSuplSettings->IsUIActive() ) |
|
4312 { |
|
4313 if (!aHomeNw) |
|
4314 { |
|
4315 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
4316 iIhaveLaunchedUsagedialog = ETrue; |
|
4317 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
4318 } |
|
4319 else |
|
4320 { |
|
4321 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is not roaming"), KTraceFileName, __LINE__); |
|
4322 iIhaveLaunchedUsagedialog = ETrue; |
|
4323 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, EFalse); |
|
4324 } |
|
4325 } |
|
4326 else |
|
4327 err = KErrInUse; |
|
4328 |
|
4329 if(KErrNone != err && KErrInUse == err) |
|
4330 { |
|
4331 iTrace->Trace(_L("Dialog in use, setting flag"), KTraceFileName, __LINE__); |
|
4332 SetSuplUsageFlag(); |
|
4333 } |
|
4334 if( KErrNone == err && iRequestType == ESUPL_NETWORK ) |
|
4335 { |
|
4336 iTrace->Trace(_L("Network Session , starting timer"), KTraceFileName, __LINE__); |
|
4337 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
|
4338 TOMASuplQop qop; |
|
4339 TInt retVal = suplInit->Qop(qop); |
|
4340 TInt delay; |
|
4341 qop.Delay(delay); |
|
4342 //if delay is > 7, it is not valid |
|
4343 if (delay > 7) |
|
4344 delay = 0; |
|
4345 if(retVal == KErrNone && delay > 0) |
|
4346 { |
|
4347 TReal delayReal; |
|
4348 Math::Pow(delayReal, 2, (TReal)delay); |
|
4349 delay = (TInt) delayReal; |
|
4350 TBuf<128> msg(_L("Delay present in message, value is = ")); |
|
4351 msg.AppendNum(delay); |
|
4352 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4353 isTimeoutDialogTimerStarted = ETrue; |
|
4354 iDialogTimer->StartTimer(delay); |
|
4355 } |
|
4356 else |
|
4357 { |
|
4358 if (iSuplInitTimeOut > 0) |
|
4359 { |
|
4360 TBuf<256> msg(_L("Delay value in CR is")); |
|
4361 msg.AppendNum(iSuplInitTimeOut); |
|
4362 iTrace->Trace(msg, KTraceFileName, __LINE__); |
|
4363 iDialogTimer->StartTimer(iSuplInitTimeOut * KSecond); |
|
4364 isTimeoutDialogTimerStarted = ETrue; |
|
4365 } |
|
4366 else |
|
4367 iTrace->Trace(_L("Timeout is <= 0"), KTraceFileName, __LINE__); |
|
4368 } |
|
4369 iDlgStartTime.HomeTime(); |
|
4370 } |
|
4371 else if (KErrNone != err) |
|
4372 { |
|
4373 iTrace->Trace(_L("Invoking HandleSuplErrorL"), KTraceFileName, __LINE__); |
|
4374 HandleSuplErrorL(err); |
|
4375 } |
|
4376 |
|
4377 } |
|
4378 else if (usage == CSuplSettings::ESuplUsageHomeAutomatic) |
|
4379 { |
|
4380 if (!aHomeNw) |
|
4381 { |
|
4382 TInt err; |
|
4383 //if (!iSuplSettings->IsUIActive() ) |
|
4384 { |
|
4385 iTrace->Trace(_L("Invoking LaunchSuplUsageSettingsUI, user is roaming"), KTraceFileName, __LINE__); |
|
4386 err = iProtocolManager.LaunchSuplUsageSettingsUI(this, ETrue); |
|
4387 |
4358 |
4388 if(iSuplMsgType == ESUPL_INIT) |
4359 if(iSuplMsgType == ESUPL_INIT) |
4389 { |
4360 { |
4390 iTrace->Trace(_L("Dialog timer started"), KTraceFileName, __LINE__); |
4361 iTrace->Trace(_L("Dialog timer started"), KTraceFileName, __LINE__); |
4391 |
|
4392 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
4362 COMASuplInit* suplInit = static_cast <COMASuplInit*> (iDecodedAsnMessage); |
4393 TOMASuplQop qop; |
4363 TOMASuplQop qop; |
4394 TInt retVal = suplInit->Qop(qop); |
4364 TInt retVal = suplInit->Qop(qop); |
4395 TInt delay; |
4365 TInt delay; |
4396 qop.Delay(delay); |
4366 qop.Delay(delay); |
4688 TBool COMASuplSession::IsEtelRoamingSet() |
4646 TBool COMASuplSession::IsEtelRoamingSet() |
4689 { |
4647 { |
4690 iTrace->Trace(_L("COMASuplSession::IsEtelRoamingSet"), KTraceFileName, __LINE__); |
4648 iTrace->Trace(_L("COMASuplSession::IsEtelRoamingSet"), KTraceFileName, __LINE__); |
4691 return iEtelRoamingCheck; |
4649 return iEtelRoamingCheck; |
4692 } |
4650 } |
4693 |
|
4694 TBool COMASuplSession::HasMeLaunchedUsageDialog() |
|
4695 { |
|
4696 return iIhaveLaunchedUsagedialog; |
|
4697 } |
|
4698 |
|
4699 |
4651 |
4700 // ----------------------------------------------------------------------------- |
4652 // ----------------------------------------------------------------------------- |
4701 // COMASuplSession::DialogTimerExpiredL |
4653 // COMASuplSession::DialogTimerExpiredL |
4702 // Checks whether UI is displayed or not previously |
4654 // Checks whether UI is displayed or not previously |
4703 // |
4655 // |
4704 // ----------------------------------------------------------------------------- |
4656 // ----------------------------------------------------------------------------- |
4705 void COMASuplSession::DialogTimerExpiredL() |
4657 void COMASuplSession::DialogTimerExpiredL() |
4706 { |
4658 { |
4707 iTrace->Trace(_L("Timer Expired for SUPL Dialog"), KTraceFileName, __LINE__); |
4659 iTrace->Trace(_L("Timer Expired for SUPL Dialog"), KTraceFileName, __LINE__); |
4708 |
4660 |
4709 if (!iIapDialogShown) |
4661 //if (!iIapDialogShown) |
4710 iProtocolManager.LaunchSuplDialogTimeoutUI(this); |
4662 // iProtocolManager.LaunchSuplDialogTimeoutUI(this); |
4711 else |
4663 // else |
4712 iIapDlgTimerExpired = ETrue; |
4664 // iIapDlgTimerExpired = ETrue; |
4713 |
4665 |
4714 return; |
4666 return; |
4715 } |
4667 } |
4716 |
4668 |
4717 // ----------------------------------------------------------------------------- |
4669 // ----------------------------------------------------------------------------- |
4718 // COMASuplSession::SettingsTimeOutUICompletedL |
4670 // COMASuplSession::SettingsTimeOutUICompletedL |
4719 // |
4671 // |
4720 // ----------------------------------------------------------------------------- |
4672 // ----------------------------------------------------------------------------- |
4721 void COMASuplSession::SettingsTimeOutUICompletedL(TInt aError) |
4673 void COMASuplSession::SettingsTimeOutUICompletedL(TInt /*aError*/) |
4722 { |
4674 { |
4723 |
4675 |
4724 TBuf<64> msg; |
4676 // TBuf<64> msg; |
4725 msg.Copy(_L("SUPL Timeout UI completed with ... ")); |
4677 // msg.Copy(_L("SUPL Timeout UI completed with ... ")); |
4726 msg.AppendNum(aError); |
4678 // msg.AppendNum(aError); |
4727 iTrace->Trace(msg,KTraceFileName, __LINE__); |
4679 // iTrace->Trace(msg,KTraceFileName, __LINE__); |
4728 iSessionObserver.TerminateSession(this, KErrGeneral); |
4680 // iSessionObserver.TerminateSession(this, KErrGeneral); |
4729 return; |
4681 return; |
4730 |
4682 |
4731 } |
4683 } |
4732 |
4684 |
4733 // ----------------------------------------------------------------------------- |
4685 // ----------------------------------------------------------------------------- |