1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008 - 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
22 #include <commsdattypesv1_1.h> |
22 #include <commsdattypesv1_1.h> |
23 #include <cdblen.h> |
23 #include <cdblen.h> |
24 #include <commdb.h> |
24 #include <commdb.h> |
25 #include <rconnmon.h> |
25 #include <rconnmon.h> |
26 |
26 |
|
27 #include <CoreApplicationUIsSDKCRKeys.h> |
|
28 #include <etel3rdparty.h> |
|
29 |
27 #include <cmmanager.h> |
30 #include <cmmanager.h> |
28 #include <cmconnectionmethoddef.h> |
31 #include <cmconnectionmethoddef.h> |
29 #include <cmpluginpacketdatadef.h> |
32 #include <cmpluginpacketdatadef.h> |
30 #include <cmpluginwlandef.h> |
33 #include <cmpluginwlandef.h> |
31 #include <cmpluginhscsddef.h> |
34 #include <cmpluginhscsddef.h> |
69 _LIT(KNetworkStatusRoaming, "roaming"); // Roaming |
72 _LIT(KNetworkStatusRoaming, "roaming"); // Roaming |
70 _LIT(KNetworkStatusUnknown, "unknown"); // Unknown operator |
73 _LIT(KNetworkStatusUnknown, "unknown"); // Unknown operator |
71 |
74 |
72 _LIT(KMSISDNSeparator, " "); // separator MSISDN numbers |
75 _LIT(KMSISDNSeparator, " "); // separator MSISDN numbers |
73 |
76 |
|
77 _LIT(KNameNotAvailable, ""); |
|
78 |
74 const TInt KMaxPropertySize = 50; |
79 const TInt KMaxPropertySize = 50; |
75 const TInt KJVMProcessUid = KJavaMidp; |
80 const TInt KJVMProcessUid = KJavaMidp; |
|
81 |
76 |
82 |
77 // --------------------------------------------------------------------------- |
83 // --------------------------------------------------------------------------- |
78 // forward declarations |
84 // forward declarations |
79 // --------------------------------------------------------------------------- |
85 // --------------------------------------------------------------------------- |
80 HBufC* GetProperty(const TInt aProperty, const TUint32 aAppDefaultApn, const TUint32 aAppDefaultApType); |
86 HBufC* GetProperty(const TInt aProperty, const TUint32 aAppDefaultApn, const TUint32 aAppDefaultApType); |
514 break; |
520 break; |
515 } |
521 } |
516 } |
522 } |
517 LOG(ESOCKET, EInfo, "MOBINFO returning property NetworkStatus"); |
523 LOG(ESOCKET, EInfo, "MOBINFO returning property NetworkStatus"); |
518 } |
524 } |
519 else // NETWORK_AVAILABILITY |
525 else if (aProperty == NETWORK_AVAILABILITY) |
520 { |
526 { |
521 // Check NetworkAvailability related Caps |
527 // Check NetworkAvailability related Caps |
522 TUint32 indCaps; |
528 TUint32 indCaps; |
523 TUint32 actionCaps; |
529 TUint32 actionCaps; |
524 LOG(ESOCKET, EInfo, "MOBINFO Checking phone IndicatorCaps"); |
530 LOG(ESOCKET, EInfo, "MOBINFO Checking phone IndicatorCaps"); |
552 telephonyProperty->Des().Append(KNetworkUnavailable); |
558 telephonyProperty->Des().Append(KNetworkUnavailable); |
553 } |
559 } |
554 } |
560 } |
555 } |
561 } |
556 } |
562 } |
|
563 else if (aProperty == OPERATOR_NAME) |
|
564 { |
|
565 // Get Service Provider Name |
|
566 LOG(ESOCKET, EInfo, "MOBINFO Getting Operator Name"); |
|
567 |
|
568 TUint32 networkCaps; |
|
569 User::LeaveIfError(aMobilePhone.GetNetworkCaps(networkCaps)); |
|
570 |
|
571 // If the device is in 'offline' mode, the current network |
|
572 // cannot be queried. Try to check the mode from cenrep. |
|
573 TBool networkConnAllowed (ETrue); |
|
574 CRepository* repository = CRepository::NewL(KCRUidCoreApplicationUIs); |
|
575 // Ignore the return value |
|
576 (void)repository->Get(KCoreAppUIsNetworkConnectionAllowed, networkConnAllowed); |
|
577 delete repository; |
|
578 |
|
579 if ((networkCaps & RMobilePhone::KCapsGetCurrentNetwork) && networkConnAllowed) |
|
580 { |
|
581 RMobilePhone::TMobilePhoneNetworkInfoV2 currInfo; |
|
582 RMobilePhone::TMobilePhoneNetworkInfoV2Pckg currInfoPckg(currInfo); |
|
583 RMobilePhone::TMobilePhoneLocationAreaV1 area; |
|
584 |
|
585 TRequestStatus status; |
|
586 aMobilePhone.GetCurrentNetwork(status, currInfoPckg, area); |
|
587 User::WaitForRequest(status); |
|
588 User::LeaveIfError(status.Int()); |
|
589 |
|
590 if (currInfo.iLongName.Length() > 0) |
|
591 { |
|
592 telephonyProperty = HBufC::NewL(currInfo.iLongName.Length() + 1); |
|
593 telephonyProperty->Des().Append(currInfo.iLongName); |
|
594 } |
|
595 else if (currInfo.iDisplayTag.Length() > 0) |
|
596 { |
|
597 currInfo.iLongName = currInfo.iDisplayTag.Left( currInfo.iLongName.MaxLength() ); |
|
598 telephonyProperty = HBufC::NewL(currInfo.iLongName.Length() + 1); |
|
599 telephonyProperty->Des().Append(currInfo.iLongName); |
|
600 } |
|
601 } |
|
602 } |
|
603 else if (aProperty == SERVICE_PROVIDER_NAME) |
|
604 { |
|
605 // Get Service Provider Name |
|
606 LOG(ESOCKET, EInfo, "MOBINFO Getting Service Provider Name"); |
|
607 |
|
608 RMobilePhone::TMobilePhoneServiceProviderNameV2 serviceProviderName; |
|
609 RMobilePhone::TMobilePhoneServiceProviderNameV2Pckg |
|
610 serviceProviderNamePckg( serviceProviderName ); |
|
611 |
|
612 TRequestStatus status; |
|
613 |
|
614 aMobilePhone.GetServiceProviderName(status, serviceProviderNamePckg); |
|
615 User::WaitForRequest(status); |
|
616 |
|
617 // Operator name, service provider |
|
618 if (serviceProviderName.iSPName.Length() > 0) |
|
619 { |
|
620 telephonyProperty = HBufC::NewL(serviceProviderName.iSPName.Length() + 1); |
|
621 telephonyProperty->Des().Append(serviceProviderName.iSPName); |
|
622 } |
|
623 else |
|
624 { |
|
625 // API call failed or empty service provider name |
|
626 telephonyProperty = HBufC::NewL(KNameNotAvailable().Length() + 1); |
|
627 telephonyProperty->Des().Append(KNameNotAvailable); |
|
628 } |
|
629 } |
|
630 |
557 |
631 |
558 LOG(ESOCKET, EInfo, "MOBINFO - GetNetworkPropertyL()"); |
632 LOG(ESOCKET, EInfo, "MOBINFO - GetNetworkPropertyL()"); |
559 return telephonyProperty; |
633 return telephonyProperty; |
560 } |
634 } |
561 |
635 |