882 { |
882 { |
883 // cancelling the periodic callback |
883 // cancelling the periodic callback |
884 iClientPoll->Cancel(); |
884 iClientPoll->Cancel(); |
885 } |
885 } |
886 |
886 |
887 case ECsPreferencesChanged: // fall-through |
|
888 { |
|
889 // restoring default connection |
|
890 TCmDefConnValue defConn; |
|
891 TInt error = KErrNone; |
|
892 |
|
893 LOG_WRITE( "reading default connection" ); |
|
894 TRAP( error, iCmMgr.ReadDefConnL( defConn ) ); |
|
895 if ( error ) |
|
896 { |
|
897 // Ignore possible failure and continue the cleanup |
|
898 LOG_WRITEF( "ReadDefConnL returned error %d", error ); |
|
899 } |
|
900 |
|
901 if ( error == KErrNone && defConn == iCurrentDefConn ) |
|
902 { |
|
903 // nobody has overwritten our setting so it's our duty to |
|
904 // restore the original value |
|
905 LOG_WRITE( "restoring default connection" ); |
|
906 TRAP( error, iCmMgr.WriteDefConnL( iOriginalDefConn ) ); |
|
907 if ( error ) |
|
908 { |
|
909 // Ignore possible failure and continue the cleanup |
|
910 LOG_WRITEF( "WriteDefConnL returned error %d", error ); |
|
911 } |
|
912 } |
|
913 } |
|
914 |
|
915 case ECsConnectionCreated: // fall-through |
887 case ECsConnectionCreated: // fall-through |
916 { |
888 { |
917 |
889 |
918 } |
890 } |
919 |
891 |
920 case ECsSocketOpened: // fall-through |
892 case ECsSocketOpened: // fall-through |
921 { |
893 { |
922 // closing the connection handle |
894 // closing the connection handle |
|
895 LOG_WRITE( "closing the connection handle" ); |
923 iConnection.Close(); |
896 iConnection.Close(); |
924 iSocketServ.Close(); |
897 iSocketServ.Close(); |
925 } |
898 } |
926 |
899 |
927 case ECsNotConnected: // fall-through |
900 case ECsNotConnected: // fall-through |
1046 |
1019 |
1047 case ECsConnectionCreated: |
1020 case ECsConnectionCreated: |
1048 { |
1021 { |
1049 LOG_WRITE( "<EConnectionCreated>" ); |
1022 LOG_WRITE( "<EConnectionCreated>" ); |
1050 |
1023 |
1051 // changing connection preferences |
|
1052 // start monitoring the iap |
1024 // start monitoring the iap |
1053 MonitorAccessPoint( iConnIap ); |
1025 MonitorAccessPoint( iConnIap ); |
1054 |
|
1055 TInt error = KErrNone; |
|
1056 |
|
1057 // store previous default connection value |
|
1058 TRAP( error, iCmMgr.ReadDefConnL( iOriginalDefConn ) ); |
|
1059 if ( error ) |
|
1060 { |
|
1061 // Ignore possible failure and continue |
|
1062 LOG_WRITEF( "RunL ReadDefConnL returned error %d", error ); |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 LOG_WRITEF( "original default connection type/id = %d/%d", |
|
1067 iOriginalDefConn.iType, |
|
1068 iOriginalDefConn.iId ); |
|
1069 |
|
1070 // set the new connection as default |
|
1071 iCurrentDefConn.iType = ECmDefConnConnectionMethod; |
|
1072 iCurrentDefConn.iId = iConnIap; |
|
1073 |
|
1074 TRAP( error, iCmMgr.WriteDefConnL( iCurrentDefConn ) ); |
|
1075 if ( error ) |
|
1076 { |
|
1077 // Ignore possible failure and continue |
|
1078 LOG_WRITEF( "RunL WriteDefConnL returned error %d", error ); |
|
1079 } |
|
1080 |
|
1081 LOG_WRITEF( "current default connection set to type/id = %d/%d", |
|
1082 iCurrentDefConn.iType, |
|
1083 iCurrentDefConn.iId ); |
|
1084 } |
|
1085 |
|
1086 iConnectingState = ECsPreferencesChanged; |
|
1087 SetActive(); |
|
1088 TRequestStatus* status = &iStatus; |
|
1089 User::RequestComplete( status, KErrNone ); |
|
1090 break; |
|
1091 } |
|
1092 |
|
1093 case ECsPreferencesChanged: |
|
1094 { |
|
1095 LOG_WRITE( "<EPreferencesChanged>" ); |
|
1096 |
1026 |
1097 // reset inactivity time |
1027 // reset inactivity time |
1098 iInactivityStart.UniversalTime(); |
1028 iInactivityStart.UniversalTime(); |
1099 iAutoDisconnect = EFalse; |
1029 iAutoDisconnect = EFalse; |
1100 |
1030 |