From: Jinkun Jang Date: Fri, 15 Mar 2013 16:17:19 +0000 (+0900) Subject: merge with master X-Git-Tag: 2.1b_release~18 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fframework%2Fnative%2Ftelephony.git;a=commitdiff_plain;h=d9f955cfbdc35f604bbcd72b236b55770ab65d30 merge with master --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bfb286..ffc43d1 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,31 +23,35 @@ INCLUDE_DIRECTORIES( ) SET (${this_target}_SOURCE_FILES - src/FTelCallInfo.cpp - src/FTelCallManager.cpp + src/FTelCallInfo.cpp + src/FTelCallManager.cpp src/FTelNetworkInfo.cpp src/FTelNetworkManager.cpp src/FTelNetworkStatus.cpp src/FTelSimInfo.cpp - src/FTel_SimInfoImpl.cpp + src/FTelSimStateManager.cpp + src/FTel_CallForwardEvent.cpp + src/FTel_CallForwardEventArg.cpp + src/FTel_CallInfoImpl.cpp + src/FTel_CallManagerImpl.cpp + src/FTel_CallManagerEvent.cpp + src/FTel_CallManagerEventArg.cpp src/FTel_NetworkInfoImpl.cpp + src/FTel_NetworkManagerEvent.cpp + src/FTel_NetworkManagerEventArg.cpp src/FTel_NetworkManagerImpl.cpp + src/FTel_NetworkSettingEvent.cpp + src/FTel_NetworkSettingEventArg.cpp src/FTel_NetworkStatusImpl.cpp - src/FTel_TelephonyIpcProxy.cpp + src/FTel_SimInfoImpl.cpp + src/FTel_SimStateManagerImpl.cpp + src/FTel_SimEvent.cpp + src/FTel_SimEventArg.cpp + src/FTel_SimManagerEvent.cpp + src/FTel_SimManagerEventArg.cpp src/FTel_TelephonyIpcMessages.cpp + src/FTel_TelephonyIpcProxy.cpp src/FTel_TelephonyUtility.cpp - src/FTel_CallInfoImpl.cpp - src/FTel_CallManagerImpl.cpp - src/FTel_NetworkManagerEvent.cpp - src/FTel_NetworkManagerEventArg.cpp - src/FTel_NetworkSettingEvent.cpp - src/FTel_NetworkSettingEventArg.cpp - src/FTel_NetworkManagerEvent.cpp - src/FTel_NetworkManagerEventArg.cpp - src/FTel_CallManagerEvent.cpp - src/FTel_CallManagerEventArg.cpp - src/FTel_CallForwardEvent.cpp - src/FTel_CallForwardEventArg.cpp ) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall" ) diff --git a/inc/FTelCallManager.h b/inc/FTelCallManager.h index aa7b61d..58d00cd 100755 --- a/inc/FTelCallManager.h +++ b/inc/FTelCallManager.h @@ -136,13 +136,12 @@ public: result Construct(ITelephonyCallEventListener& listener); /** - * @if VISPARTNER-OPERATOR * Sets the listener that listens to the call forwarding request. * * @since 2.0 * - * @visibility partner-operator - * @privilege %http://tizen.org/privilege/callforward + * @privlevel platform + * @privilege http://tizen.org/privilege/callforward * * @return An error code * @param[in] pListener An ITelephonyCallForwardListener instance @n @@ -150,20 +149,17 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @exception E_SYSTEM A system error has occurred. - * - * @endif */ result SetCallForwardListener(ITelephonyCallForwardListener* pListener); /** - * @if VISPARTNER-OPERATOR * Requests call forwarding with the specified number. @n * This method sends the request to the network, and receives the response asynchronously. * * @since 2.0 * - * @visibility partner-operator - * @privilege %http://tizen.org/privilege/callforward + * @privlevel platform + * @privilege http://tizen.org/privilege/callforward * * @return An error code * @param[in] phoneNumber The phone number for call forwarding @@ -178,42 +174,36 @@ public: * @remarks The call will be forwarded unconditionally. Voice call only. @n * The phone number can start with plus(+) and the remaining part must be number. * @see ITelephonyCallForwardListener::OnTelephonyCallForwardResponseReceived() - * - * @endif */ result RequestCallForward(const Tizen::Base::String& phoneNumber); /** - * @if VISPARTNER-OPERATOR * Stops call forwarding. * * @since 2.0 * - * @visibility partner-operator - * @privilege %http://tizen.org/privilege/callforward + * @privlevel platform + * @privilege http://tizen.org/privilege/callforward * * @return An error code - * @exception E_SUCCESS The method is successful. - @exception E_INVALID_STATE This instance is in an invalid state. - * @exception E_IN_PROGRESS The previous request is in progress. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @exception E_NETWORK_UNAVAILABLE The operation has failed because the device is in the offline mode. - * @exception E_SERVICE_UNAVAILABLE The operation has failed because the device is out of the coverage area or in the emergency mode. - * @exception E_SYSTEM A system error has occurred. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE This instance is in an invalid state. + * @exception E_IN_PROGRESS The previous request is in progress. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_NETWORK_UNAVAILABLE The operation has failed because the device is in the offline mode. + * @exception E_SERVICE_UNAVAILABLE The operation has failed because the device is out of the coverage area or in the emergency mode. + * @exception E_SYSTEM A system error has occurred. * @see ITelephonyCallForwardListener::OnTelephonyCallForwardStopped() - * - * @endif */ result StopCallForward(void); /** - * @if VISPARTNER-OPERATOR * Gets the phone number to which the call must be forwarded. * * @since 2.0 * - * @visibility partner-operator - * @privilege %http://tizen.org/privilege/callforward + * @privlevel platform + * @privilege http://tizen.org/privilege/callforward * * @return An error code * @exception E_SUCCESS The method is successful. @@ -223,8 +213,6 @@ public: * @exception E_SERVICE_UNAVAILABLE The operation has failed because the device is out of the coverage area or in the emergency mode. * @exception E_SYSTEM A system error has occurred. * @see ITelephonyCallForwardListener::OnTelephonyCallForwardNumberReceived - * - * @endif */ result GetCallForwardNumber(void) const; @@ -234,7 +222,7 @@ public: * @since 2.0 * * @return The current call type, @n - * else Telephony::TYPE_UNDEFINED_CALL if the method fails + * else TYPE_UNDEFINED_CALL if the method fails */ CallType GetCurrentCallType(void) const; @@ -244,7 +232,7 @@ public: * @since 2.0 * * @return The current call status, @n - * else Telephony::CALL_STATUS_UNDEFINED if the method fails + * else CALL_STATUS_UNDEFINED if the method fails */ CallStatus GetCurrentCallStatus(void) const; diff --git a/inc/FTelISimStateManagerGetPinLockSettingResultListener.h b/inc/FTelISimStateManagerGetPinLockSettingResultListener.h new file mode 100644 index 0000000..d54c9a5 --- /dev/null +++ b/inc/FTelISimStateManagerGetPinLockSettingResultListener.h @@ -0,0 +1,71 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FTelISimStateManagerGetPinLockSettingResultListener.h + * @brief This is the header file for the %ISimStateManagerGetPinLockSettingResultListener interface. + * + * This header file contains the declarations of the %ISimStateManagerGetPinLockSettingResultListener interface. + * + */ +#ifndef _FTEL_ISIM_STATE_MANAGER_GET_PIN_LOCK_SETTING_RESULT_LISTENER_H_ +#define _FTEL_ISIM_STATE_MANAGER_GET_PIN_LOCK_SETTING_RESULT_LISTENER_H_ + +#include + + +namespace Tizen { namespace Telephony +{ +/** + * @interface ISimStateManagerGetPinLockSettingResultListener + * @brief This interface provides methods to receive the result of the %SimStateManager class asynchronous method. + * + * @since 2.1 + * + * The %ISimStateManagerGetPinLockSettingResultListener interface provides methods to receive the result of the %SimStateManager class asynchronous method. + * + */ +class _OSP_EXPORT_ ISimStateManagerGetPinLockSettingResultListener + : virtual public Tizen::Base::Runtime::IEventListener +{ +public: + /** + * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called. + * + * @since 2.1 + */ + virtual ~ISimStateManagerGetPinLockSettingResultListener(void) {} + +public: + /** + * Called when a response of the PIN lock setting query is received. + * + * @since 2.1 + * + * @param[in] isEnabled PIN lock setting value + * @param[in] r The result of the request. The following exception may be given through this parameter. + * + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE The SIM is in invalid state. + */ + virtual void OnSimStateManagerGetPinLockSettingResultReceived(bool isEnabled, result r) = 0; + +}; // ISimStateManagerGetPinLockSettingResultListener + +} } // Tizen::Telephony + +#endif // _FTEL_ISIM_STATE_MANAGER_GET_PIN_LOCK_SETTING_RESULT_LISTENER_H_ diff --git a/inc/FTelITelephonyCallForwardListener.h b/inc/FTelITelephonyCallForwardListener.h index face22a..7f75574 100755 --- a/inc/FTelITelephonyCallForwardListener.h +++ b/inc/FTelITelephonyCallForwardListener.h @@ -15,15 +15,10 @@ // limitations under the License. // /** - * @if VISPARTNER - * * @file FTelITelephonyCallForwardListener.h * @brief This is the header file for the %ITelephonyCallForwardListener interface. - * @visibility partner * * This header file contains the declarations of the %ITelephonyCallForwardListener interface. - * - * @endif */ #ifndef _FTEL_ITELEPHONY_CALL_FORWARD_LISTENER_H_ #define _FTEL_ITELEPHONY_CALL_FORWARD_LISTENER_H_ @@ -53,66 +48,49 @@ class _OSP_EXPORT_ ITelephonyCallForwardListener { public: /** - * @if VISPARTNER-OPERATOR * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called. * * @since 2.0 - * - * @visibility partner-operator - * - * @endif */ virtual ~ITelephonyCallForwardListener(void) {} /** - * @if VISPARTNER-OPERATOR * Called when a response of the call forwarding request is received. * * @since 2.0 - * - * @visibility partner-operator * * @param[in] phoneNumber The phone number * @param[in] r The result of the call forwarding request * @exception E_SUCCESS The method is successful. * @exception E_NOT_RESPONDING The server on the telephony network is not responding. * @exception E_SYSTEM A system error has occurred. - * @endif */ virtual void OnTelephonyCallForwardResponseReceived(const Tizen::Base::String& phoneNumber, result r) = 0; /** - * @if VISPARTNER-OPERATOR * Called when a response of the call forwarding stop request is received. * * @since 2.0 * - * @visibility partner-operator - * * @param[in] phoneNumber The phone number * @param[in] r The result of the call forwarding request * @exception E_SUCCESS The method is successful. * @exception E_NOT_RESPONDING The server on the telephony network is not responding. * @exception E_SYSTEM A system error has occurred. - * @endif */ virtual void OnTelephonyCallForwardStopped(const Tizen::Base::String& phoneNumber, result r) = 0; /** - * @if VISPARTNER-OPERATOR * Called when a query for the call forwarding number is completed. * * @since 2.0 * - * @visibility partner-operator - * * @param[in] phoneNumber The phone number * @param[in] r The result of the query request * @exception E_SUCCESS The method is successful. * @exception E_NOT_RESPONDING The server on the telephony network is not responding. * @exception E_SERVICE_DEACTIVATED The call forwarding service is not enabled. * @exception E_SYSTEM A system error has occurred. - * @endif */ virtual void OnTelephonyCallForwardNumberReceived(const Tizen::Base::String& phoneNumber, result r) = 0; diff --git a/inc/FTelITelephonyNetworkSettingListener.h b/inc/FTelITelephonyNetworkSettingListener.h index 8c8bc4f..8cb8c86 100755 --- a/inc/FTelITelephonyNetworkSettingListener.h +++ b/inc/FTelITelephonyNetworkSettingListener.h @@ -37,17 +37,12 @@ class IList; namespace Tizen { namespace Telephony { /** -* @if VISPARTNER-MANUFACTURER * @interface ITelephonyNetworkSettingListener * @brief This interface provides result of the network settings. * * @since 2.0 * -* @visibility partner-manufacturer -* * The %ITelephonyNetworkSettingListener interface provides result of the network search and response by selection mode. -* -* @endif */ class _OSP_EXPORT_ ITelephonyNetworkSettingListener : virtual public Tizen::Base::Runtime::IEventListener @@ -61,13 +56,10 @@ public: virtual ~ITelephonyNetworkSettingListener(void) {} /** - * @if VISPARTNER-MANUFACTURER * Called when a response of the network selection mode request is received. * * @since 2.0 * - * @visibility partner-manufacturer - * * @param[in] isManual @c true if the network selection is in manual mode, @n * else @c false * @param[in] r An error code @@ -75,45 +67,33 @@ public: * @exception E_NOT_RESPONDING The server on the telephony network is not responding. * @exception E_SYSTEM The method cannot proceed due to a severe telephony modem error. * @see NetworkManager::GetNetworkSelectionMode() - * - * @endif */ virtual void OnTelephonyNetworkSelectionModeReceived(bool isManual, result r) = 0; /** - * @if VISPARTNER-MANUFACTURER * Called when the network search process is completed. * * @since 2.0 * - * @visibility partner-manufacturer - * * @param[in] pNetworkInfoList The list of NetworkInfo information representing the network discovered by the search * @param[in] r An error code * @exception E_SUCCESS The method is successful. * @exception E_NOT_RESPONDING The server on the telephony network is not responding. * @exception E_SYSTEM The method cannot proceed due to a severe telephony modem error. * @see NetworkManager::SearchNetwork() - * - * @endif */ virtual void OnTelephonyNetworkSearchCompletedN(Tizen::Base::Collection::IList* pNetworkInfoList, result r) = 0; /** - * @if VISPARTNER-MANUFACTURER * Called when a response of the network selection request is completed. * * @since 2.0 * - * @visibility partner-manufacturer - * * @param[in] r An error code * @exception E_SUCCESS The method is successful. * @exception E_NOT_RESPONDING The server on the telephony network is not responding. * @exception E_SYSTEM The method cannot proceed due to a severe telephony modem error. * @see NetworkManager::SelectNetwork() - * - * @endif */ virtual void OnTelephonyNetworkSelectionCompleted(result r) = 0; diff --git a/inc/FTelITelephonySimEventListener.h b/inc/FTelITelephonySimEventListener.h new file mode 100644 index 0000000..63abd36 --- /dev/null +++ b/inc/FTelITelephonySimEventListener.h @@ -0,0 +1,96 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTelITelephonySimEventListener.h + * @brief This is the header file for the %ITelephonySimEventListener interface. + * + * This header file contains the declarations of the %ITelephonySimEventListener interface. + */ +#ifndef _FTEL_ITELEPHONY_SIM_EVENT_LISTENER_H_ +#define _FTEL_ITELEPHONY_SIM_EVENT_LISTENER_H_ + +#include +#include + + +namespace Tizen { namespace Telephony +{ + +/** + * @interface ITelephonySimEventListener + * @brief This interface provides methods to listen to the change in state of the SIM card. + * + * @since 2.1 + * + * The %ITelephonySimEventListener interface checks for the change in state in the SIM card. + * + */ +class _OSP_EXPORT_ ITelephonySimEventListener + : virtual public Tizen::Base::Runtime::IEventListener +{ +public: + /** + * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called. + * + * @since 2.1 + */ + virtual ~ITelephonySimEventListener(void) {} + + /** + * Called when the state of SIM is changed. + * + * @since 2.1 + * + * @param[in] state The new SIM state + */ + virtual void OnTelephonySimStateChanged(SimState state) = 0; + +protected: + // + // This method is for internal use only. Using this method can cause behavioral, security-related, + // and consistency-related issues in the application. + // + // This method is reserved and may change its name at any time without prior notice. + // + // @since 2.1 + // + virtual void ITelephonySimEventListener_Reserved1(void) {}; + + // + // This method is for internal use only. Using this method can cause behavioral, security-related, + // and consistency-related issues in the application. + // + // This method is reserved and may change its name at any time without prior notice. + // + // @since 2.1 + // + virtual void ITelephonySimEventListener_Reserved2(void) {}; + + // + // This method is for internal use only. Using this method can cause behavioral, security-related, + // and consistency-related issues in the application. + // + // This method is reserved and may change its name at any time without prior notice. + // + // @since 2.1 + // + virtual void ITelephonySimEventListener_Reserved3(void) {}; + +}; // ITelephonySimEventListener + +}} // Tizen::Telephony +#endif // _FTEL_ITELEPHONY_SIM_EVENT_LISTENER_H_ diff --git a/inc/FTelNetworkInfo.h b/inc/FTelNetworkInfo.h index 0f67a86..f69106c 100755 --- a/inc/FTelNetworkInfo.h +++ b/inc/FTelNetworkInfo.h @@ -116,7 +116,8 @@ public: * Gets the Mobile Network Code (MNC) of the network. * * @since 2.0 - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return The MNC of the network * @exception E_SUCCESS The method is successful. @@ -129,7 +130,8 @@ public: * Gets the Mobile Country Code (MCC) of the network. * * @since 2.0 - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return The MCC of the network * @exception E_SUCCESS The method is successful. @@ -149,7 +151,8 @@ public: * @compatibility This method has compatibility issues with OSP compatible applications. @n * For more information, see the issue description for @ref CompNetworkInfoGetPlmnPage "here". * @endif - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return The PLMN name * @exception E_SUCCESS The method is successful. @@ -162,7 +165,7 @@ public: /** * @page CompNetworkInfoGetPlmnPage Compatibility for GetPlmn() * @section CompNetworkInfoGetPlmnPageIssueSection Issues - * Implementing this method in OSP compatible applications has the following issues: @n + * Implementation of this method in Tizen API versions prior to 2.1 has the following issue: @n * -# The method returns an alphabetic name of PLMN. * * @section CompNetworkInfoGetPlmnPageSolutionSection Resolutions @@ -174,7 +177,8 @@ public: * Gets the current cell ID. * * @since 2.0 - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return The current cell ID * @exception E_SUCCESS The method is successful. @@ -188,7 +192,8 @@ public: * Gets the current Location Area Code (LAC). * * @since 2.0 - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return The current LAC * @exception E_SUCCESS The method is successful. @@ -202,7 +207,8 @@ public: * Gets the operator name. * * @since 2.0 - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return The operator name * @exception E_SUCCESS The method is successful. @@ -236,7 +242,8 @@ public: * Gets the received signal strength indication of a modem device. * * @since 2.0 - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return The current RSSI @n * The possible RSSI value ranges from @c 0 to @c 100. diff --git a/inc/FTelNetworkManager.h b/inc/FTelNetworkManager.h index 0ad0d2a..8e8b4db 100755 --- a/inc/FTelNetworkManager.h +++ b/inc/FTelNetworkManager.h @@ -128,7 +128,8 @@ public: * Gets the network status. * * @since 2.0 - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return An error code * @param[out] networkStatus The network status @@ -144,7 +145,8 @@ public: * Gets the network information. * * @since 2.0 - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return An error code * @param[out] networkInfo The network information @@ -157,13 +159,12 @@ public: result GetNetworkInfo(NetworkInfo& networkInfo) const; /** - * @if VISPARTNER-MANUFACTURER * Sets the listener for receiving the responses of the search network and the network selection mode. * * @since 2.0 * - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/telephonymanager + * @privlevel platform + * @privilege http://tizen.org/privilege/telephonymanager * * @return An error code * @param[in] pListener An instance of ITelephonyNetworkSettingListener @n @@ -171,19 +172,16 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * - * @endif */ result SetNetworkSettingListener(ITelephonyNetworkSettingListener* pListener); /** - * @if VISPARTNER-MANUFACTURER * Gets the network selection mode. * * @since 2.0 * - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/telephonymanager + * @privlevel platform + * @privilege http://tizen.org/privilege/telephonymanager * * @return An error code * @exception E_SUCCESS The method is successful. @@ -191,19 +189,16 @@ public: * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionModeReceived() - * - * @endif */ result GetNetworkSelectionMode(void); /** - * @if VISPARTNER-MANUFACTURER * Selects the manually searched network. * * @since 2.0 * - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/telephonymanager + * @privlevel platform + * @privilege http://tizen.org/privilege/telephonymanager * * @return An error code * @param[out] networkInfo The network information @@ -212,19 +207,16 @@ public: * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionCompleted() - * - * @endif */ result SelectNetwork(const NetworkInfo& networkInfo); /** - * @if VISPARTNER-MANUFACTURER * Selects the network automatically. * * @since 2.0 * - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/telephonymanager + * @privleve platform + * @privilege http://tizen.org/privilege/telephonymanager * * @return An error code * @exception E_SUCCESS The method is successful. @@ -232,19 +224,16 @@ public: * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSelectionCompleted() - * - * @endif */ result SelectNetwork(void); /** - * @if VISPARTNER-MANUFACTURER * Searches for an available network. * * @since 2.0 * - * @visibility partner-manufacturer - * @privilege %http://tizen.org/privilege/telephonymanager + * @privlevel platform + * @privilege http://tizen.org/privilege/telephonymanager * * @return An error code * @exception E_SUCCESS The method is successful. @@ -252,8 +241,6 @@ public: * @exception E_SYSTEM A system error has occurred. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. * @see ITelephonyNetworkSettingListener::OnTelephonyNetworkSearchCompletedN() - * - * @endif */ result SearchNetwork(void); diff --git a/inc/FTelNetworkStatus.h b/inc/FTelNetworkStatus.h index 8bbae70..47b396f 100755 --- a/inc/FTelNetworkStatus.h +++ b/inc/FTelNetworkStatus.h @@ -95,7 +95,8 @@ public: * * @since 2.0 * - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return @c true if the current network is in roaming status, @n * else @c false @@ -110,7 +111,8 @@ public: * * @since 2.0 * - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return @c true if call service is available, @n * else @c false @@ -125,7 +127,8 @@ public: * * @since 2.0 * - * @privilege %http://tizen.org/privilege/systeminfo + * @privlevel public + * @privilege http://tizen.org/privilege/telephony * * @return @c true if data service is available, @n * else @c false diff --git a/inc/FTelSimInfo.h b/inc/FTelSimInfo.h index 53cbf09..1b6f9ca 100755 --- a/inc/FTelSimInfo.h +++ b/inc/FTelSimInfo.h @@ -25,12 +25,14 @@ #include +#include namespace Tizen { namespace Telephony { class _SimInfoImpl; + /** * @class SimInfo * @brief This class provides information of the currently inserted SIM card. @@ -52,24 +54,31 @@ class _SimInfoImpl; * String spn; * String iccId; * String operatorName; + * SimType simType; + * + * SimStateManager simStateManager; + * SimInfo simInfo; * - * SimInfo* pSimInfo = new SimInfo(); + * result r = simStateManager.Construct(); + * if (IsFailed(r)) + * { + * return r; + * } * - * result r = pSimInfo->Construct(); + * r = simStateManager.GetSimInfo(simInfo); * if (IsFailed(r)) * { - * delete pSimInfo; * return r; * } * - * mnc = pSimInfo->GetMnc(); - * mcc = pSimInfo->GetMcc(); - * spn = pSimInfo->GetSpn(); - * iccId = pSimInfo->GetIccId(); - * operatorName = pSimInfo->GetOperatorName(); - * isAvailable = pSimInfo->IsAvailable(); + * mnc = simInfo.GetMnc(); + * mcc = simInfo.GetMcc(); + * spn = simInfo.GetSpn(); + * iccId = simInfo.GetIccId(); + * operatorName = simInfo.GetOperatorName(); + * isAvailable = simInfo.IsAvailable(); + * simType = simInfo.GetSimType(); * - * delete pSimInfo; * return E_SUCCESS; * } * @@ -80,182 +89,232 @@ class _OSP_EXPORT_ SimInfo { public: /** - * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor. - * - * @since 2.0 - */ + * This is the default constructor for this class. + * + * @since 2.0 + */ SimInfo(void); /** - * This destructor overrides Tizen::Base::Object::~Object(). - * - * @since 2.0 - */ + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %SimInfo + */ + SimInfo(const SimInfo& rhs); + + /** + * This destructor overrides Tizen::Base::Object::~Object(). + * + * @since 2.0 + */ virtual ~SimInfo(void); /** - * Initializes this instance of %SimInfo. - * - * @since 2.0 - * - * @return An error code - * @exception E_SUCCESS The method is successful. - * @exception E_SYSTEM A system error has occurred. - * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. - */ + * Initializes this instance of %SimInfo. + * + * @brief [Deprecated] + * @deprecated This method is deprecated. Instead of using this method, it is recommended to use the SimManager::GetSimInfo() method to get the initialized SimInfo instance. + * + * @since 2.0 + * + * @return An error code + * @exception E_SUCCESS The method is successful. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + */ result Construct(void); /** - * Gets the Mobile Network Code (MNC) of the SIM International Mobile Subscriber Identity (IMSI) information. - * - * @since 2.0 - * - * @privilege %http://tizen.org/privilege/systeminfo - * - * @return The MNC of the SIM card, @n - * else @c -1 if the method fails - * @exception E_SUCCESS The method is successful. - * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @remarks The specific error code can be accessed using the GetLastResult() method. - */ + * Gets the Mobile Network Code (MNC) of the SIM International Mobile Subscriber Identity (IMSI) information. + * + * @since 2.0 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return The MNC of the SIM card, @n + * else @c -1 if the method fails + * @exception E_SUCCESS The method is successful. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ int GetMnc(void) const; /** - * Gets the Mobile Country Code (MCC) of the SIM IMSI information. - * - * @since 2.0 - * - * @privilege %http://tizen.org/privilege/systeminfo - * - * @return The MCC of the SIM card, @n - * else @c -1 if the method fails - * @exception E_SUCCESS The method is successful. - * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @remarks The specific error code can be accessed using the GetLastResult() method. - */ + * Gets the Mobile Country Code (MCC) of the SIM IMSI information. + * + * @since 2.0 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return The MCC of the SIM card, @n + * else @c -1 if the method fails + * @exception E_SUCCESS The method is successful. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ int GetMcc(void) const; /** - * Gets the Service Provider Name (SPN) string of the SIM card. - * - * @since 2.0 - * - * @privilege %http://tizen.org/privilege/systeminfo - * - * @return The SPN of the SIM card, @n - * else an empty string if there is no SIM card in the device, or if an SPN is not assigned to the SIM card - * @exception E_SUCCESS The method is successful. - * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @remarks The specific error code can be accessed using the GetLastResult() method. - */ + * Gets the Service Provider Name (SPN) string of the SIM card. + * + * @since 2.0 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return The SPN of the SIM card, @n + * else an empty string if there is no SIM card in the device, or if an SPN is not assigned to the SIM card + * @exception E_SUCCESS The method is successful. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ Tizen::Base::String GetSpn(void) const; /** - * Gets the Integrated Circuit Card Identifier (ICCID) of the SIM card. @n - * One useful case to detect the change of SIM cards is to store this value and compare it with the most recent value. - * This method provides a unique identification number for the SIM card. - * - * @since 2.0 - * - * @privilege %http://tizen.org/privilege/systeminfo - * - * @return The ICCID of the SIM card, @n - * else an empty string if the method fails - * @exception E_SUCCESS The method is successful. - * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @remarks The specific error code can be accessed using the GetLastResult() method. - */ + * Gets the Integrated Circuit Card Identifier (ICCID) of the SIM card. @n + * One useful case to detect the change of SIM cards is to store this value and compare it with the most recent value. + * This method provides a unique identification number for the SIM card. + * + * @since 2.0 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return The ICCID of the SIM card, @n + * else an empty string if the method fails + * @exception E_SUCCESS The method is successful. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ Tizen::Base::String GetIccId(void) const; /** - * Gets the operator name of Common PCN Handset Specification (CPHS) of the SIM card. - * - * @since 2.0 - * - * @privilege %http://tizen.org/privilege/systeminfo - * - * @return The operator name of the SIM card, @n - * else an empty string if there is no SIM card in the device, or if an operator name is not assigned to the SIM card - * @exception E_SUCCESS The method is successful. - * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @remarks If this method has failed, then this method returns an empty string. - * @remarks The specific error code can be accessed using the GetLastResult() method. - */ + * Gets the operator name of Common PCN Handset Specification (CPHS) of the SIM card. + * + * @since 2.0 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return The operator name of the SIM card, @n + * else an empty string if there is no SIM card in the device, or if an operator name is not assigned to the SIM card + * @exception E_SUCCESS The method is successful. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks If this method has failed, then this method returns an empty string. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ Tizen::Base::String GetOperatorName(void) const; /** - * Gets the phone number of the SIM card. - * - * @since 2.0 - * - * @privilege %http://tizen.org/privilege/systeminfo - * - * @return The phone number of the SIM card, @n - * else an empty string if there is no SIM card in the device, or if a Mobile Station International Subscriber Directory Number - * (MSISDN) is not assigned to the SIM card - * @exception E_SUCCESS The method is successful. - * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @exception E_SYSTEM A system error has occurred. - * @remarks The specific error code can be accessed using the GetLastResult() method. - */ + * Gets the phone number of the SIM card. + * + * @since 2.0 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return The phone number of the SIM card, @n + * else an empty string if there is no SIM card in the device, or if a Mobile Station International Subscriber Directory Number + * (MSISDN) is not assigned to the SIM card + * @exception E_SUCCESS The method is successful. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ Tizen::Base::String GetPhoneNumber(void) const; /** - * @if VISPARTNER - * Gets the International Mobile Subscriber Identity (IMSI) of the SIM card. - * - * @since 2.0 - * - * @visibility partner - * @privilege %http://tizen.org/privilege/useridentity - * - * @return The IMSI of the SIM card, @n - * else an empty string if the method fails - * @exception E_SUCCESS The method is successful. - * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @exception E_SYSTEM The method cannot proceed due to a severe system error. - * @remarks The specific error code can be accessed using the GetLastResult() method. - * @endif - */ + * Gets the International Mobile Subscriber Identity (IMSI) of the SIM card. + * + * @since 2.0 + * + * @privlevel partner + * @privilege http://tizen.org/privilege/useridentity + * + * @return The IMSI of the SIM card, @n + * else an empty string if the method fails + * @exception E_SUCCESS The method is successful. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ Tizen::Base::String GetImsi(void) const; /** - * Checks whether a SIM card is present in the device or not. - * - * @since 2.0 - * - * @privilege %http://tizen.org/privilege/systeminfo - * - * @return @c true if the SIM card is present in the device, @n - * else @c false - * @exception E_SUCCESS The method is successful. - * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @remarks The specific error code can be accessed using the GetLastResult() method. - */ - bool IsAvailable(void) const; + * Gets the type of SIM card. + * + * @since 2.1 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return The type of SIM card + * + * @exception E_SUCCESS The method is successful. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * @remarks The specified error code can be accessed using the GetLastResult() method. + */ + SimType GetSimType(void) const; -private: /** - * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. - * - * @param[in] rhs An instance of %SimInfo - */ - SimInfo(const SimInfo& rhs); + * Checks whether a SIM card is present in the device or not. + * + * @since 2.0 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return @c true if the SIM card is present in the device, @n + * else @c false + * @exception E_SUCCESS The method is successful. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ + bool IsAvailable(void) const; /** - * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. - * - * @param[in] rhs An instance of %SimInfo - */ + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %SimInfo + */ SimInfo& operator =(const SimInfo& rhs); + /** + * Compares the specified instance of %SimInfo with the calling instance. + * + * @since 2.0 + * + * @return @c true if the values match, @n + * else @c false + * @param[in] rhs The other Object to be compared + * @see Object::Equals() + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance. + * + * @since 2.0 + * + * @return The current instance's hash value + */ + virtual int GetHashCode(void) const; + private: _SimInfoImpl* __pSimInfoImpl; @@ -263,4 +322,5 @@ private: }; // SimInfo }} // Tizen::Telephony + #endif // _FTEL_SIM_INFO_H_ diff --git a/inc/FTelSimStateManager.h b/inc/FTelSimStateManager.h new file mode 100644 index 0000000..693aad7 --- /dev/null +++ b/inc/FTelSimStateManager.h @@ -0,0 +1,176 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTelSimStateManager.h + * @brief This is the header file for the %SimStateManager class. + * + * This header file contains the declarations of the %SimStateManager class. + */ +#ifndef _FTEL_SIM_STATE_MANAGER_H_ +#define _FTEL_SIM_STATE_MANAGER_H_ + + +#include +#include +#include +#include +#include + + +namespace Tizen { namespace Telephony +{ +class _SimStateManagerImpl; + +/** + * @class SimStateManager + * @brief This class provides methods to obtain information and events about the SIM card. + * @since 2.1 + * + * The %SimStateManager class provides methods to obtain information and events about the SIM card. + * + */ +class _OSP_EXPORT_ SimStateManager + : public Tizen::Base::Object +{ +public: + /** + * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor. + * + * @since 2.1 + */ + SimStateManager(void); + + /** + * This destructor overrides Tizen::Base::Object::~Object(). + * + * @since 2.1 + */ + virtual ~SimStateManager(void); + + /** + * Initializes a new instance of this class. + * + * @since 2.1 + * + * @return An error code + * + * @exception E_SUCCESS The method is successful. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + */ + result Construct(void); + + /** + * Sets the listener for receiving SIM related events. + * + * @since 2.1 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return An error code + * + * @param[in] pListener An ITelephonySimEventListener instance @n + * The parameter can be set to @c null to remove listener. + * + * @exception E_SUCCESS The method is successful. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, @n + * because the caller thread is a worker thread. + */ + result SetSimEventListener(ITelephonySimEventListener* pListener); + + /** + * Requests the PIN lock setting information. @n + * This method is asynchronous. + * + * @since 2.1 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return An error code + * + * @param[in] pListener An ISimStateManagerGetPinLockSettingResultListener instance + * + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified @c pListener must not be @c null. + * @exception E_IN_PROGRESS The previous request is in progress. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + * @exception E_SYSTEM The method cannot proceed due to a severe system error. + * @see ISimStateManagerGetPinLockSettingResultListener::OnSimStateManagerGetPinLockSettingResultReceived() + */ + result GetPinLockSetting(ISimStateManagerGetPinLockSettingResultListener* pListener); + + /** + * Gets the current state of SIM card. + * + * @since 2.1 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return The state of SIM card, @n + * else SIM_STATE_UNKNOWN if the method fails + * + * @exception E_SUCCESS The method is successful. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + */ + SimState GetSimState(void) const; + + /** + * Gets the SIM card information. + * + * @since 2.1 + * + * @privlevel public + * @privilege http://tizen.org/privilege/telephony + * + * @return An error code + * + * @param[out] simInfo The SIM card information + * + * @exception E_SUCCESS The method is successful. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @exception E_DEVICE_UNAVAILABLE The operation has failed due to a missing SIM card. + */ + result GetSimInfo(SimInfo& simInfo) const; + +private: + // + // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. + // + // @param[in] rhs An instance of %SimStateManager + // + SimStateManager(const SimStateManager& rhs); + + // + // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. + // + // @param[in] rhs An instance of %SimStateManager + // + SimStateManager& operator =(const SimStateManager& rhs); + +private: + _SimStateManagerImpl* __pSimStateManagerImpl; + + friend class _SimStateManagerImpl; +}; // SimStateManager + +}} // Tizen::Telephony + +#endif // _FTEL_SIM_STATE_MANAGER_H_ diff --git a/inc/FTelTypes.h b/inc/FTelTypes.h index 5ccf836..077f78f 100644 --- a/inc/FTelTypes.h +++ b/inc/FTelTypes.h @@ -57,5 +57,40 @@ enum CallStatus CALL_STATUS_HOLDING /**< A call on holding status */ }; +/** + * @enum SimType + * + * Defines the type of the SIM card. + * + * @since 2.1 + */ +enum SimType +{ + SIM_TYPE_UNKNOWN, /**< Unknown card */ + SIM_TYPE_GSM, /**< GSM SIM card */ + SIM_TYPE_USIM, /**< Universal SIM card */ + SIM_TYPE_RUIM, /**< Removable UIM (User Identity Module) */ + SIM_TYPE_ISIM /**< IMS SIM card */ +}; + +/** + * @enum SimState + * + * Defines the current state of SIM card. + * + * @since 2.1 + */ +enum SimState +{ + SIM_STATE_UNKNOWN, /**< Unknown state */ + SIM_STATE_ABSENT, /**< SIM is not present */ + SIM_STATE_INITIALIZING, /**< SIM is on initializing */ + SIM_STATE_READY, /**< SIM is ready*/ + SIM_STATE_PIN_REQUIRED, /**< PIN required */ + SIM_STATE_PUK_REQUIRED, /**< PUK required */ + SIM_STATE_NETWORK_LOCKED, /**< Network locked */ + SIM_STATE_SIM_LOCKED /**< PH-SIM (phone-SIM) locked */ +}; + }} // Tizen::Telephony #endif // _FTEL_ENUM_H_ diff --git a/inc/FTelephony.h b/inc/FTelephony.h index 2d57b16..fb9b358 100644 --- a/inc/FTelephony.h +++ b/inc/FTelephony.h @@ -31,10 +31,13 @@ #include #include #include +#include #include #include #include #include +#include +#include /** diff --git a/packaging/osp-telephony.spec b/packaging/osp-telephony.spec old mode 100644 new mode 100755 index 7a5b60f..fbafff0 --- a/packaging/osp-telephony.spec +++ b/packaging/osp-telephony.spec @@ -3,7 +3,7 @@ Name: osp-telephony Summary: osp telephony library -Version: 1.2.0.0 +Version: 1.2.1.0 Release: 2 Group: System/Libraries License: Apache License, Version 2.0 diff --git a/src/FTelNetworkInfo.cpp b/src/FTelNetworkInfo.cpp index 6551d82..e3a9783 100644 --- a/src/FTelNetworkInfo.cpp +++ b/src/FTelNetworkInfo.cpp @@ -67,7 +67,7 @@ NetworkInfo::GetMnc(void) const ClearLastResult(); int mnc = -1; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, mnc, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -83,7 +83,7 @@ NetworkInfo::GetMcc(void) const ClearLastResult(); int mcc = -1; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, mcc, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -99,7 +99,7 @@ NetworkInfo::GetPlmn(void) const ClearLastResult(); String plmn; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, plmn, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -115,7 +115,7 @@ NetworkInfo::GetCellId(void) const ClearLastResult(); int cellId = -1; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, cellId, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -131,7 +131,7 @@ NetworkInfo::GetLac(void) const ClearLastResult(); int lac = -1; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, lac, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -147,7 +147,7 @@ NetworkInfo::GetOperatorName(void) const ClearLastResult(); String operatorName; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, operatorName, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -187,10 +187,10 @@ NetworkInfo::GetRssi(void) ClearLastResult(); int rssi = -1; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, rssi, E_PRIVILEGE_DENIED, - "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); + "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); rssi = _NetworkInfoImpl::GetRssi(); diff --git a/src/FTelNetworkManager.cpp b/src/FTelNetworkManager.cpp index e7c7c30..09af74e 100644 --- a/src/FTelNetworkManager.cpp +++ b/src/FTelNetworkManager.cpp @@ -71,7 +71,7 @@ NetworkManager::GetNetworkStatus(NetworkStatus& networkStatus) const result r = E_SUCCESS; - r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturnResult(NID_TEL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); r = __pNetworkManagerImpl->GetNetworkStatus(networkStatus); @@ -87,7 +87,7 @@ NetworkManager::GetNetworkInfo(NetworkInfo& networkInfo) const result r = E_SUCCESS; - r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturnResult(NID_TEL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); @@ -116,7 +116,6 @@ NetworkManager::SetNetworkSettingListener(ITelephonyNetworkSettingListener* pLis } return r; - } result diff --git a/src/FTelNetworkStatus.cpp b/src/FTelNetworkStatus.cpp index ce3ad9d..0e223d3 100644 --- a/src/FTelNetworkStatus.cpp +++ b/src/FTelNetworkStatus.cpp @@ -45,7 +45,7 @@ NetworkStatus::IsRoaming(void) const { ClearLastResult(); - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, false, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -61,7 +61,7 @@ NetworkStatus::IsCallServiceAvailable(void) const { ClearLastResult(); - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, false, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -77,7 +77,7 @@ NetworkStatus::IsDataServiceAvailable(void) const { ClearLastResult(); - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, false, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); diff --git a/src/FTelSimInfo.cpp b/src/FTelSimInfo.cpp index 25a619e..ca24fc1 100644 --- a/src/FTelSimInfo.cpp +++ b/src/FTelSimInfo.cpp @@ -34,11 +34,19 @@ SimInfo::SimInfo(void) { } +SimInfo::SimInfo(const SimInfo& rhs) + : __pSimInfoImpl(null) +{ + __pSimInfoImpl = new (std::nothrow)_SimInfoImpl(*rhs.__pSimInfoImpl); + SysTryReturnVoidResult(NID_TEL, __pSimInfoImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); +} + SimInfo::~SimInfo(void) { delete __pSimInfoImpl; } + result SimInfo::Construct(void) { @@ -70,7 +78,7 @@ SimInfo::GetMnc(void) const ClearLastResult(); int mnc = -1; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, mnc, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -92,7 +100,7 @@ SimInfo::GetMcc(void) const ClearLastResult(); int mcc = -1; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, mcc, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -114,7 +122,7 @@ SimInfo::GetSpn(void) const ClearLastResult(); String spn; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, spn, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -136,7 +144,7 @@ SimInfo::GetIccId(void) const ClearLastResult(); String iccId; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, iccId, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -158,7 +166,7 @@ SimInfo::GetOperatorName(void) const ClearLastResult(); String operatorName; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, operatorName, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -180,7 +188,7 @@ SimInfo::GetPhoneNumber(void) const ClearLastResult(); String phoneNumber; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, phoneNumber, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -219,6 +227,20 @@ SimInfo::GetImsi(void) const return imsi; } +SimType +SimInfo::GetSimType(void) const +{ + SysAssertf(__pSimInfoImpl != null, "Not yet constructed. Construct() should be called before use."); + + ClearLastResult(); + + result r = _AccessController::CheckUserPrivilege(_PRV_TELEPHONY); + SysTryReturn(NID_TEL, r == E_SUCCESS, SIM_TYPE_UNKNOWN, E_PRIVILEGE_DENIED, + "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); + + return __pSimInfoImpl->GetSimType(); +} + bool SimInfo::IsAvailable(void) const { @@ -227,7 +249,7 @@ SimInfo::IsAvailable(void) const ClearLastResult(); bool isAvailable = false; - result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO); + result r = _AccessController::CheckUserPrivilege(_PRV_SYSTEMINFO, _PRV_TELEPHONY); SysTryReturn(NID_TEL, r == E_SUCCESS, isAvailable, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED)); @@ -237,4 +259,41 @@ SimInfo::IsAvailable(void) const return isAvailable; } +SimInfo& +SimInfo::operator =(const SimInfo& rhs) +{ + if (this != &rhs) + { + *__pSimInfoImpl = *rhs.__pSimInfoImpl; + } + + return *this; +} + +bool +SimInfo::Equals(const Object& rhs) const +{ + const SimInfo* pRhs = dynamic_cast(&rhs); + + if (pRhs == null) + { + return false; + } + + const _SimInfoImpl* pRhsImpl = _SimInfoImpl::GetInstance(*pRhs); + + if (pRhsImpl == null) + { + return false; + } + + return __pSimInfoImpl->Equals(*pRhsImpl); +} + +int +SimInfo::GetHashCode(void) const +{ + return __pSimInfoImpl->GetHashCode(); +} + } } // Tizen::Telephony diff --git a/src/FTelSimStateManager.cpp b/src/FTelSimStateManager.cpp new file mode 100644 index 0000000..a10c6b5 --- /dev/null +++ b/src/FTelSimStateManager.cpp @@ -0,0 +1,129 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTelSimStateManager.cpp + * @brief This is the implementation file for SimStateManager class. + */ + +#include +#include +#include +#include "FTel_SimStateManagerImpl.h" + + +using namespace Tizen::Base; +using namespace Tizen::Security; + + +namespace Tizen { namespace Telephony +{ +SimStateManager::SimStateManager(void) + : __pSimStateManagerImpl(null) +{ +} + +SimStateManager::~SimStateManager(void) +{ + delete __pSimStateManagerImpl; +} + +result +SimStateManager::Construct(void) +{ + SysAssertf(__pSimStateManagerImpl == null, + "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class."); + + result r = E_SUCCESS; + + __pSimStateManagerImpl = new (std::nothrow)_SimStateManagerImpl(); + SysTryReturnResult(NID_TEL, __pSimStateManagerImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed"); + + r = __pSimStateManagerImpl->Construct(); + + if (r != E_SUCCESS) + { + SysLogException(NID_TEL, r, "[%s] Propagating.", GetErrorMessage(r)); + delete __pSimStateManagerImpl; + __pSimStateManagerImpl = null; + } + + return r; +} + +result +SimStateManager::SetSimEventListener(ITelephonySimEventListener* pListener) +{ + SysAssertf(__pSimStateManagerImpl != null, "Not yet constructed. Construct() should be called before use."); + + result r = E_SUCCESS; + + r = _AccessController::CheckUserPrivilege(_PRV_TELEPHONY); + SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "The application does not have the privilege to call this method."); + + r = __pSimStateManagerImpl->SetSimEventListener(pListener); + SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating."); + + return r; +} + +result +SimStateManager::GetPinLockSetting(ISimStateManagerGetPinLockSettingResultListener* pListener) +{ + SysAssertf(__pSimStateManagerImpl != null, "Not yet constructed. Construct() should be called before use."); + + result r = E_SUCCESS; + + r = _AccessController::CheckUserPrivilege(_PRV_TELEPHONY); + SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "The application does not have the privilege to call this method."); + + r = __pSimStateManagerImpl->GetPinLockSetting(pListener); + SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating."); + + return r; +} + +SimState +SimStateManager::GetSimState(void) const +{ + SysAssertf(__pSimStateManagerImpl != null, "Not yet constructed. Construct() should be called before use."); + + result r = E_SUCCESS; + + r = _AccessController::CheckUserPrivilege(_PRV_TELEPHONY); + SysTryReturn(NID_NET, r == E_SUCCESS, SIM_STATE_UNKNOWN, r, + "[%s] The application does not have the privilege to call this method.", GetErrorMessage(r)); + + return __pSimStateManagerImpl->GetSimState(); +} + +result +SimStateManager::GetSimInfo(SimInfo& simInfo) const +{ + SysAssertf(__pSimStateManagerImpl != null, "Not yet constructed. Construct() should be called before use."); + + result r = E_SUCCESS; + + r = _AccessController::CheckUserPrivilege(_PRV_TELEPHONY); + SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "The application does not have the privilege to call this method."); + + r = __pSimStateManagerImpl->GetSimInfo(simInfo); + SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating."); + + return r; +} + +} } // Tizen::Telephony diff --git a/src/FTel_NetworkManagerEvent.h b/src/FTel_NetworkManagerEvent.h index 7d421ec..2787575 100644 --- a/src/FTel_NetworkManagerEvent.h +++ b/src/FTel_NetworkManagerEvent.h @@ -17,9 +17,9 @@ /** * @file FTel_NetworkManagerEvent.h - * @brief This is the header file for the _WifiDirectDeviceEvent class. + * @brief This is the header file for the _NetworkManagerEvent class. * - * This header file contains declarations of the _WifiDirectDeviceEvent class. + * This header file contains declarations of the _NetworkManagerEvent class. */ #ifndef _FTEL_INTERNAL_NETWORK_MANAGER_EVENT_H_ diff --git a/src/FTel_NetworkManagerEventArg.cpp b/src/FTel_NetworkManagerEventArg.cpp index 13cd0b2..e342936 100644 --- a/src/FTel_NetworkManagerEventArg.cpp +++ b/src/FTel_NetworkManagerEventArg.cpp @@ -16,9 +16,9 @@ // /** * @file FTel_NetworkManagerEventArg.cpp - * @brief This is the implementation file for the %_EmailEventArg class. + * @brief This is the implementation file for the %_NetworkManagerEventArg class. * - * This file contains the implementation of the %_EmailEventArg class. + * This file contains the implementation of the %_NetworkManagerEventArg class. */ #include diff --git a/src/FTel_SimEvent.cpp b/src/FTel_SimEvent.cpp new file mode 100644 index 0000000..15a8379 --- /dev/null +++ b/src/FTel_SimEvent.cpp @@ -0,0 +1,76 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FTel_SimEvent.cpp + * @brief This is the implementation file for the _SimEvent Class. + * + * This header file contains implementation of the _SimEvent Class. + */ + +#include +#include +#include +#include "FTel_SimEvent.h" +#include "FTel_SimEventArg.h" + + +using namespace Tizen::Base::Runtime; + +namespace Tizen { namespace Telephony +{ + +_SimEvent::_SimEvent(void) +{ +} + +_SimEvent::~_SimEvent(void) +{ +} + +result +_SimEvent::Construct(void) +{ + return _Event::Initialize(); +} + +void +_SimEvent::FireImpl(IEventListener& listener, const IEventArg& arg) +{ + const _SimEventArg* pArg = dynamic_cast(&arg); + SysTryReturnVoidResult(NID_TEL, pArg != null, E_INVALID_ARG, + "[%s] Invalid argument used. The arg is a null pointer.", GetErrorMessage(E_INVALID_ARG)); + + ITelephonySimEventListener* pSimEventListener = dynamic_cast(&listener); + SysTryReturnVoidResult(NID_TEL, pSimEventListener != null, E_INVALID_ARG, + "[%s] Invalid argument used. The result of a dynamic_cast operation is null for SIM manager listener", GetErrorMessage(E_INVALID_ARG)); + + _SimEventType eventType = pArg->GetEventType(); + + switch(eventType) + { + case _SIM_EVENT_SIM_STATE_CHANGED: + SysLog(NID_NET, "Calling OnTelephonySimStateChanged()."); + pSimEventListener->OnTelephonySimStateChanged(pArg->GetSimState()); + SysLog(NID_NET, "Called OnTelephonySimStateChanged()."); + break; + default: + break; + } +} + +} } // Tizen::Telephony diff --git a/src/FTel_SimEvent.h b/src/FTel_SimEvent.h new file mode 100644 index 0000000..e1a0aa3 --- /dev/null +++ b/src/FTel_SimEvent.h @@ -0,0 +1,78 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FTel_SimEvent.h + * @brief This is the header file for the _SimEvent class. + * + * This header file contains declarations of the _SimEvent class. + */ + +#ifndef _FTEL_INTERNAL_SIM_EVENT_H_ +#define _FTEL_INTERNAL_SIM_EVENT_H_ + +#include +#include + +namespace Tizen { namespace Base { namespace Runtime +{ +class IEventListener; +class IEventArg; +}}} + +namespace Tizen { namespace Telephony +{ + +/** + * @class _SimEvent + * @brief This class handles SIM events. + * + * When a NetworkManagerEvent event occurs, the _SimEvent object finds a ITelephonySimEventListener object + * which is registered for the SimManager object and calls an appropriate method of the listener. + */ + +class _SimEvent + : public Tizen::Base::Runtime::_Event +{ +public: + _SimEvent(); + virtual ~_SimEvent(void); + + result Construct(void); + +protected: + /** + * Checks the arg and finds out the type of event. After that this method calls appropriate pListener's method. + * + * @return A result code. + * @param[in] listener It is a event listener related to this SIM event. + * @param[in] arg It is an argument-like instance of SIM event retransmitted to the listener's method as an argument. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The argument passed to a method contains an invalid value.@n + */ + void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg); + + +private: + _SimEvent(const _SimEvent& rhs); + _SimEvent& operator =(const _SimEvent& rhs); + +}; // _SimEvent + +}} // Tizen::Telephony + +#endif // _FTEL_INTERNAL_SIM_EVENT_H_ diff --git a/src/FTel_SimEventArg.cpp b/src/FTel_SimEventArg.cpp new file mode 100644 index 0000000..3b6eeb4 --- /dev/null +++ b/src/FTel_SimEventArg.cpp @@ -0,0 +1,55 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTel_SimEventArg.cpp + * @brief This is the implementation file for the %_SimEventArg class. + * + * This file contains the implementation of the %_SimEventArg class. + */ + +#include +//#include "FTel_SimManagerImpl.h" +#include "FTel_SimEventArg.h" + +namespace Tizen { namespace Telephony +{ + +_SimEventArg::_SimEventArg(void) + : __eventType(_SIM_EVENT_NONE) + , __simState(SIM_STATE_UNKNOWN) +{ +} + +_SimEventArg::_SimEventArg(_SimEventType type, SimState state) + : __eventType(type) + , __simState(state) +{ +} + +_SimEventType +_SimEventArg::GetEventType(void) const +{ + return __eventType; +} + +SimState +_SimEventArg::GetSimState(void) const +{ + return __simState; +} + +} } // Tizen::Telephony diff --git a/src/FTel_SimEventArg.h b/src/FTel_SimEventArg.h new file mode 100644 index 0000000..57b22e3 --- /dev/null +++ b/src/FTel_SimEventArg.h @@ -0,0 +1,79 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTel_SimEventArg.h + * @brief This is the header file for _SimEventArg class. + * + * This header file contains the declarations of _SimEventArg class. + */ + + +#ifndef _FTEL_INTERNAL_SIM_EVENT_ARG_H_ +#define _FTEL_INTERNAL_SIM_EVENT_ARG_H_ + +#include +#include +#include +#include + +namespace Tizen { namespace Telephony +{ + +enum _SimEventType +{ + _SIM_EVENT_NONE, + _SIM_EVENT_SIM_STATE_CHANGED +}; + + +/** + * @class _SimEventArg + * @brief This class is used as an argument of methods of the ITelephonySimEventListener class. + * + * This class is used as an argument of ITelephonyNetworkEventListener methods. + * When a SimManager event occurs, the _SimEvent object finds a ITelephonySimEventListener object + * which is registered for the SimManager object and calls an appropriate method of the listener. + */ + +class _SimEventArg + : public Tizen::Base::Object + , public Tizen::Base::Runtime::IEventArg +{ +public: + _SimEventArg(void); + + _SimEventArg(_SimEventType type, SimState state); + + virtual ~_SimEventArg(void) {}; + + _SimEventType GetEventType(void) const; + + SimState GetSimState(void) const; + +private: + _SimEventArg(const _SimEventArg& rhs); + _SimEventArg& operator =(const _SimEventArg& rhs); + +private: + _SimEventType __eventType; + SimState __simState; + +}; // _SimEventArg + +} } // Tizen::Telephony + +#endif // _FTEL_INTERNAL_SIM_EVENT_ARG_H_ diff --git a/src/FTel_SimInfoImpl.cpp b/src/FTel_SimInfoImpl.cpp index add2fe8..b215c6f 100644 --- a/src/FTel_SimInfoImpl.cpp +++ b/src/FTel_SimInfoImpl.cpp @@ -31,6 +31,9 @@ #include "FTel_TelephonyIpcProxy.h" #include "FTel_TelephonyUtility.h" +#include + + using namespace std; using namespace Tizen::App; using namespace Tizen::Base; @@ -40,9 +43,38 @@ namespace Tizen { namespace Telephony _SimInfoImpl::_SimInfoImpl(void) -: __pTelephonyServiceProxy(null) + : __mcc(-1) + , __mnc(-1) + , __simType(SIM_TYPE_UNKNOWN) + , __isAvailable(false) + , __isIccIdValid(false) + , __isMccValid(false) + , __isMncValid(false) + , __isOperatorNameValid(false) + , __isPhoneNumberValid(false) + , __isSpnValid(false) + , __isSimTypeValid(false) { +} +_SimInfoImpl::_SimInfoImpl(const _SimInfoImpl& rhs) + : __mcc(rhs.__mcc) + , __mnc(rhs.__mnc) + , __iccId(rhs.__iccId) + , __imsi(rhs.__imsi) + , __operatorName(rhs.__operatorName) + , __phoneNumber(rhs.__phoneNumber) + , __spn(rhs.__spn) + , __simType(rhs.__simType) + , __isAvailable(rhs.__isAvailable) + , __isIccIdValid(rhs.__isIccIdValid) + , __isMccValid(rhs.__isMccValid) + , __isMncValid(rhs.__isMncValid) + , __isOperatorNameValid(rhs.__isOperatorNameValid) + , __isPhoneNumberValid(rhs.__isPhoneNumberValid) + , __isSpnValid(rhs.__isSpnValid) + , __isSimTypeValid(rhs.__isSimTypeValid) +{ } _SimInfoImpl::~_SimInfoImpl(void) @@ -52,164 +84,233 @@ _SimInfoImpl::~_SimInfoImpl(void) result _SimInfoImpl::Construct(void) { - SysTryReturnResult(NID_TEL, IsAvailable(), E_DEVICE_UNAVAILABLE, "The operation failed due to a missing SIM card."); - - __pTelephonyServiceProxy = _TelephonyIpcProxy::GetInstance(); - - if (__pTelephonyServiceProxy == null) - { - SysLog(NID_TEL, "Creating an IPC instance to connect with the Connectivity service daemon has failed."); - } - - return E_SUCCESS; -} - + TapiHandle* pHandle = null; + int err = SIM_ERROR_NONE; + sim_state_e simState = SIM_STATE_UNAVAILABLE; -int -_SimInfoImpl::GetMnc(void) const -{ int mnc = -1; + int mcc = -1; - SysTryReturn(NID_TEL, IsAvailable(), mnc, E_DEVICE_UNAVAILABLE, - "[%s] The operation failed due to a missing SIM card.", GetErrorMessage(E_DEVICE_UNAVAILABLE)); + String spn; + String iccId; + String operatorName; + String phoneNumber; - int err = SIM_ERROR_NONE; char* pTemp = null; + char* pTempFullName = null; + char* pTempShortName = null; - err = sim_get_mnc(&pTemp); - - SysLog(NID_TEL, "The return value of sim_get_mnc() is 0x%x and the mnc value is %s", err, pTemp); - SysTryReturn(NID_TEL, err == SIM_ERROR_NONE, mnc, E_SYSTEM, "[%s] A system error has occured. Failed to get the Mobile Network Code (MNC).", GetErrorMessage(E_SYSTEM)); - unique_ptr pMnc(pTemp); + // Checking availability + err = sim_get_state(&simState); + SysLog(NID_TEL, "The return value of sim_get_state() is 0x%x and the simState is %d", err, simState); - if(pMnc.get() != null) + if (err == SIM_ERROR_NONE && simState == SIM_STATE_AVAILABLE) { - mnc = atoi(pMnc.get()); + __isAvailable = true; } - return mnc; -} + SysTryReturnResult(NID_TEL, __isAvailable, E_DEVICE_UNAVAILABLE, "The operation failed due to a missing SIM card."); -int -_SimInfoImpl::GetMcc(void) const -{ - int mcc = -1; + // Getting mnc + err = sim_get_mnc(&pTemp); + SysLog(NID_TEL, "The return value of sim_get_mnc() is 0x%x and the mnc value is %s", err, pTemp); - SysTryReturn(NID_TEL, IsAvailable(), mcc, E_DEVICE_UNAVAILABLE, - "[%s] The operation failed due to a missing SIM card.", GetErrorMessage(E_DEVICE_UNAVAILABLE)); + if (err != SIM_ERROR_NONE) + { + SysLog(NID_TEL, "Failed to get the Mobile Network Code (MNC)."); + __isMncValid = false; + } + else + { + unique_ptr pMnc(pTemp); - int err = SIM_ERROR_NONE; - char* pTemp = null; + if(pMnc.get() != null) + { + mnc = atoi(pMnc.get()); + } + __isMncValid = true; + } + __mnc = mnc; + // Getting mcc err = sim_get_mcc(&pTemp); - SysLog(NID_TEL, "The return value of sim_get_mcc() is 0x%x,and the mcc value is %s", err, pTemp); - SysTryReturn(NID_TEL, err == SIM_ERROR_NONE, mcc, E_SYSTEM, "[%s] A system error has occured. Failed to get the Mobile Country Code (MCC).", GetErrorMessage(E_SYSTEM)); - unique_ptr pMcc(pTemp); - if(pMcc.get() != null) + if (err != SIM_ERROR_NONE) { - mcc = atoi(pMcc.get()); + SysLog(NID_TEL, "Failed to get the Mobile Country Code (MCC)."); + __isMccValid = false; } - return mcc; -} - -String -_SimInfoImpl::GetSpn(void) const -{ - String spn; - - SysTryReturn(NID_TEL, IsAvailable(), spn, E_DEVICE_UNAVAILABLE, - "[%s] The operation failed due to a missing SIM card.", GetErrorMessage(E_DEVICE_UNAVAILABLE)); + else + { + unique_ptr pMcc(pTemp); - int err = SIM_ERROR_NONE; - - char* pTemp = null; + if(pMcc.get() != null) + { + mcc = atoi(pMcc.get()); + } + __isMccValid = true; + } + __mcc = mcc; + // Getting spn err = sim_get_spn(&pTemp); SysLog(NID_TEL, "The return value of sim_get_spn() is 0x%x and the spn value is %s", err, pTemp); - SysTryReturn(NID_TEL, err == SIM_ERROR_NONE, spn, E_SYSTEM, "[%s] A system error has occured. Failed to get the Service Provider Name (SPN).", GetErrorMessage(E_SYSTEM)); - unique_ptr pSpn(pTemp); - if(pSpn.get() != null) + if (err != SIM_ERROR_NONE) { - spn = String(pSpn.get()); + SysLog(NID_TEL, "Failed to get the Service Provider Name (SPN)."); + __isSpnValid = false; } - return spn; -} - -String -_SimInfoImpl::GetIccId(void) const -{ - String iccId; + else + { + unique_ptr pSpn(pTemp); - SysTryReturn(NID_TEL, IsAvailable(), iccId, E_DEVICE_UNAVAILABLE, - "[%s] The operation failed due to a missing SIM card.", GetErrorMessage(E_DEVICE_UNAVAILABLE)); + if(pSpn.get() != null) + { + spn = String(pSpn.get()); + } + __isSpnValid = true; + } - int err = SIM_ERROR_NONE; - char* pTemp = null; + __spn = spn; + // Getting icc id err = sim_get_icc_id(&pTemp); - SysLog(NID_TEL, "The return value of sim_get_icc_id() is 0x%x and the iccid valuce is %s", err, pTemp); - SysTryReturn(NID_TEL, err == SIM_ERROR_NONE, iccId, E_SYSTEM, "[%s] A system error has occured. Failed to get the Integrated Circuit Card(ICC) ID.", GetErrorMessage(E_SYSTEM)); + SysLog(NID_TEL, "The return value of sim_get_icc_id() is 0x%x and the iccid value is %s", err, pTemp); - unique_ptr pIccId(pTemp); - - if (pIccId.get() != null) + if (err != SIM_ERROR_NONE) { - iccId = String(pIccId.get()); + SysLog(NID_TEL, "Failed to get the Integrated Circuit Card(ICC) ID."); + __isIccIdValid = false; } + else + { + unique_ptr pIccId(pTemp); - return iccId; -} + if (pIccId.get() != null) + { + iccId = String(pIccId.get()); + } + __isIccIdValid = true; + } + __iccId = iccId; -String -_SimInfoImpl::GetOperatorName(void) const -{ - String operatorName; + // Getting operator name + err = sim_get_cphs_operator_name(&pTempFullName, &pTempShortName); - SysTryReturn(NID_TEL, IsAvailable(), operatorName, E_DEVICE_UNAVAILABLE, - "[%s] The operation failed due to a missing SIM card.", GetErrorMessage(E_DEVICE_UNAVAILABLE)); + SysLog(NID_TEL, "The return value of sim_get_cphs_operator_name() is 0x%x. full[%s] short[%s]", err, pTempFullName, pTempShortName); + if (err != SIM_ERROR_NONE) + { + SysLog(NID_TEL, "Failed to get the operator name."); + __isOperatorNameValid = false; + } + else + { + unique_ptr pFullName(pTempFullName); + unique_ptr pShortName(pTempShortName); - int err = SIM_ERROR_NONE; + operatorName = String((const char*) pFullName.get()); + SysLog(NID_TEL, "The Operator Name is [%ls]", operatorName.GetPointer()); + __isOperatorNameValid = true; + } + __operatorName = operatorName; - char* pTempFullName = null; - char* pTempShortName = null; + // Getting phone number + err = sim_get_subscriber_number(&pTemp); + SysLog(NID_TEL, "The return value of sim_get_subscriber_number() is 0x%x and the phone number is [%s]", err, pTemp); + if (err != SIM_ERROR_NONE) + { + SysLog(NID_TEL, "Failed to get the phone number."); + __isPhoneNumberValid = false; + } + else + { + unique_ptr pPhoneNumber(pTemp); + if (pPhoneNumber.get() != null) + { + phoneNumber = String((const char*) pPhoneNumber.get()); + } + __isPhoneNumberValid = true; + } + __phoneNumber = phoneNumber; - err = sim_get_cphs_operator_name(&pTempFullName, &pTempShortName); + // Getting SIM type + pHandle = tel_init(null); + SysTryReturnResult(NID_TEL, pHandle != null, E_SYSTEM, + "[%s] A system error has occurred. Failed to initialize TApi library.", GetErrorMessage(E_SYSTEM)); - SysLog(NID_TEL, "The return value of sim_get_cphs_operator_name() is 0x%x", err); - SysTryReturn(NID_TEL, err == SIM_ERROR_NONE, operatorName, E_SYSTEM, "[%s] A system error has occured. Failed to get the operator name.", GetErrorMessage(E_SYSTEM)); + TelSimCardType_t simType = TAPI_SIM_CARD_TYPE_UNKNOWN; + err = tel_get_sim_type(pHandle, &simType); + SysLog(NID_TEL, "The return value of tel_get_sim_type() is 0x%x and the SIM type is %d", err, simType); + if (err != SIM_ERROR_NONE) + { + SysLog(NID_TEL, "Failed to get the SIM type."); + __isSimTypeValid = false; + } + else + { + __isSimTypeValid = true; + } - unique_ptr pFullName(pTempFullName); - unique_ptr pShortName(pTempShortName); + switch(simType) + { + case TAPI_SIM_CARD_TYPE_GSM: + __simType = SIM_TYPE_GSM; + break; + case TAPI_SIM_CARD_TYPE_USIM: + __simType = SIM_TYPE_USIM; + break; + case TAPI_SIM_CARD_TYPE_RUIM: + __simType = SIM_TYPE_RUIM; + break; + case TAPI_SIM_CARD_TYPE_IMS: + __simType = SIM_TYPE_ISIM; + break; + case TAPI_SIM_CARD_TYPE_UNKNOWN: // Fall through + default: + __simType = SIM_TYPE_UNKNOWN; + break; + } - operatorName = String((const char*) pFullName.get()); - SysLog(NID_TEL, "The Operator Name is %ls", operatorName.GetPointer()); + tel_deinit(pHandle); - return operatorName; + return E_SUCCESS; +} + +int +_SimInfoImpl::GetMnc(void) const +{ + return __mnc; +} + +int +_SimInfoImpl::GetMcc(void) const +{ + return __mcc; } String -_SimInfoImpl::GetPhoneNumber(void) const +_SimInfoImpl::GetSpn(void) const { - String phoneNumber; + return __spn; +} - SysTryReturn(NID_TEL, IsAvailable(), phoneNumber, E_DEVICE_UNAVAILABLE, - "[%s] The operation failed due to a missing SIM card.", GetErrorMessage(E_DEVICE_UNAVAILABLE)); +String +_SimInfoImpl::GetIccId(void) const +{ + return __iccId; +} - int err = SIM_ERROR_NONE; - char* pTemp = null; +String +_SimInfoImpl::GetOperatorName(void) const +{ + return __operatorName; +} - err = sim_get_subscriber_number(&pTemp); - SysLog(NID_TEL, "The return value of sim_get_subscriber_number() is 0x%x and the phone number is %s", err, pTemp); - SysTryReturn(NID_TEL, err == SIM_ERROR_NONE, phoneNumber, E_SYSTEM, "[%s] A system error has occured. Failed to get the phone number.", GetErrorMessage(E_SYSTEM)); - - unique_ptr pPhoneNumber(pTemp); - if (pPhoneNumber.get() != null) - { - phoneNumber = String((const char*) pPhoneNumber.get()); - } - return phoneNumber; +String +_SimInfoImpl::GetPhoneNumber(void) const +{ + return __phoneNumber; } String @@ -218,33 +319,112 @@ _SimInfoImpl::GetImsi(void) const result r = E_SUCCESS; String imsi; - SysTryReturn(NID_TEL, IsAvailable(), imsi, E_DEVICE_UNAVAILABLE, + SysTryReturn(NID_TEL, __isAvailable, imsi, E_DEVICE_UNAVAILABLE, "[%s] The operation failed due to a missing SIM card.", GetErrorMessage(E_DEVICE_UNAVAILABLE)); - SysTryReturn(NID_TEL, __pTelephonyServiceProxy != null, imsi, E_SYSTEM, "[%s] A system error has occured. IPC instance has not been constructed yet.", GetErrorMessage(E_SYSTEM)); + _TelephonyIpcProxy* pTelephonyServiceProxy = _TelephonyIpcProxy::GetInstance(); + SysTryReturn(NID_TEL, pTelephonyServiceProxy != null, imsi, E_SYSTEM, "[%s] A system error has occured. IPC instance has not been constructed yet.", GetErrorMessage(E_SYSTEM)); - r = __pTelephonyServiceProxy->GetImsi(imsi); + r = pTelephonyServiceProxy->GetImsi(imsi); SysTryReturn(NID_TEL, r == E_SUCCESS, imsi, r, "[%s] Failed to get the imsi.", GetErrorMessage(r)); return imsi; } +SimType +_SimInfoImpl::GetSimType(void) const +{ + return __simType; +} + bool _SimInfoImpl::IsAvailable(void) const { - bool isAvailable = false; - int err = SIM_ERROR_NONE; - sim_state_e simState = SIM_STATE_UNKNOWN; + return __isAvailable; +} - err = sim_get_state(&simState); - SysLog(NID_TEL, "The return value of sim_get_state() is 0x%x and the simState is %d", err, simState); +_SimInfoImpl& +_SimInfoImpl::operator =(const _SimInfoImpl& rhs) +{ + if (this != &rhs) + { + __mcc = rhs.__mcc; + __mnc = rhs.__mnc; + __iccId = rhs.__iccId; + __imsi = rhs.__imsi; + __operatorName = rhs.__operatorName; + __phoneNumber = rhs.__phoneNumber; + __spn = rhs.__spn; + __simType = rhs.__simType; + __isAvailable = rhs.__isAvailable; + __isIccIdValid = rhs.__isIccIdValid; + __isMccValid = rhs.__isMccValid; + __isMncValid = rhs.__isMncValid; + __isOperatorNameValid = rhs.__isOperatorNameValid; + __isPhoneNumberValid = rhs.__isPhoneNumberValid; + __isSpnValid = rhs.__isSpnValid; + __isSimTypeValid = rhs.__isSimTypeValid; + } - if (err == SIM_ERROR_NONE && simState == SIM_STATE_AVAILABLE) + return *this; +} + +bool +_SimInfoImpl::Equals(const Tizen::Base::Object& rhs) const +{ + const _SimInfoImpl* pRhs = dynamic_cast (&rhs); + + if (pRhs == null) + { + return false; + } + + if (__mcc != pRhs->__mcc || + __mnc != pRhs->__mnc || + __iccId != pRhs->__iccId || + __imsi != pRhs->__imsi || + __operatorName != pRhs->__operatorName || + __phoneNumber != pRhs->__phoneNumber || + __spn != pRhs->__spn || + __simType != pRhs->__simType || + __isAvailable != pRhs->__isAvailable || + __isIccIdValid != pRhs->__isIccIdValid || + __isMccValid != pRhs->__isMccValid || + __isMncValid != pRhs->__isMncValid || + __isOperatorNameValid != pRhs->__isOperatorNameValid || + __isPhoneNumberValid != pRhs->__isPhoneNumberValid || + __isSpnValid != pRhs->__isSpnValid || + __isSimTypeValid != pRhs->__isSimTypeValid) { - isAvailable = true; + return false; } - return isAvailable; + return true; +} + +int +_SimInfoImpl::GetHashCode(void) const +{ + int hashCode = _HASH_CODE_INITIAL_VALUE; + + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + __mcc; + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + __mnc; + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + __iccId.GetHashCode(); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + __imsi.GetHashCode(); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + __operatorName.GetHashCode(); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + __phoneNumber.GetHashCode(); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + __spn.GetHashCode(); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + __simType; + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + (__isAvailable ? 0 : 1); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + (__isIccIdValid ? 0 : 1); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + (__isMccValid ? 0 : 1); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + (__isMncValid ? 0 : 1); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + (__isOperatorNameValid ? 0 : 1); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + (__isPhoneNumberValid ? 0 : 1); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + (__isSpnValid ? 0 : 1); + hashCode = _HASH_CODE_COEFFICIENT_VALUE * hashCode + (__isSimTypeValid ? 0 : 1); + + return hashCode; } _SimInfoImpl* diff --git a/src/FTel_SimInfoImpl.h b/src/FTel_SimInfoImpl.h index 529ccb4..5c7f82b 100644 --- a/src/FTel_SimInfoImpl.h +++ b/src/FTel_SimInfoImpl.h @@ -23,7 +23,7 @@ #ifndef _FTEL_INTERNAL_SIM_INFO_IMPL_H_ #define _FTEL_INTERNAL_SIM_INFO_IMPL_H_ - +#include #include @@ -49,6 +49,14 @@ public: _SimInfoImpl(void); /** + * This is the copy constructor for the %_SimInfoImpl class. + * + * @since 2.1 + * @param[in] rhs An instance of the %_SimInfoImpl class + */ + _SimInfoImpl(const _SimInfoImpl& rhs); + + /** * This is the destructor for this class. * * @since 2.1 @@ -96,8 +104,13 @@ public: Tizen::Base::String GetImsi(void) const; /** - * @see SimInfo::IsAvailable() - */ + * @see SimInfo::GetSimType() + */ + SimType GetSimType(void) const; + + /** + * @see SimInfo::IsAvailable() + */ bool IsAvailable(void) const; /** @@ -118,14 +131,6 @@ public: */ static const _SimInfoImpl* GetInstance(const SimInfo& simInfo); -private: - /** - * This is the copy constructor for this class. Do @b not use directly. - * - * @param[in] rhs An instance of %_SimInfoImpl - */ - _SimInfoImpl(const _SimInfoImpl& rhs); - /** * This is the assignment operator for this class. Do @b not use directly. * @@ -133,7 +138,35 @@ private: */ _SimInfoImpl& operator =(const _SimInfoImpl& rhs); - _TelephonyIpcProxy* __pTelephonyServiceProxy; + /** + * @see SimInfo::Equals() + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * @see SimInfo::GetHashCode()1 + */ + virtual int GetHashCode(void) const; + +private: + int __mcc; + int __mnc; + Tizen::Base::String __iccId; + Tizen::Base::String __imsi; + Tizen::Base::String __operatorName; + Tizen::Base::String __phoneNumber; + Tizen::Base::String __spn; + SimType __simType; + bool __isAvailable; + bool __isIccIdValid; + bool __isMccValid; + bool __isMncValid; + bool __isOperatorNameValid; + bool __isPhoneNumberValid; + bool __isSpnValid; + bool __isSimTypeValid; + + friend class _SimStateManagerImpl; }; // _SimInfoImpl diff --git a/src/FTel_SimManagerEvent.cpp b/src/FTel_SimManagerEvent.cpp new file mode 100644 index 0000000..8c48a9f --- /dev/null +++ b/src/FTel_SimManagerEvent.cpp @@ -0,0 +1,82 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FTel_SimManagerEvent.cpp + * @brief This is the implementation file for the _SimManagerEvent Class. + * + * This header file contains implementation of the _SimManagerEvent Class. + */ + +#include +#include +#include +#include +#include + +#include +#include "FTel_SimManagerEvent.h" +#include "FTel_SimManagerEventArg.h" + +using namespace std; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Runtime; + +namespace Tizen { namespace Telephony +{ + +_SimManagerEvent::_SimManagerEvent(void) +{ +} + +_SimManagerEvent::~_SimManagerEvent(void) +{ +} + +result +_SimManagerEvent::Construct(void) +{ + return _Event::Initialize(); +} + + +void +_SimManagerEvent::FireImpl(IEventListener& listener, const IEventArg& arg) +{ + const _SimManagerEventArg* pArg = dynamic_cast(&arg); + SysTryReturnVoidResult(NID_TEL, pArg != null, E_INVALID_ARG, + "[%s] Invalid argument used. The arg is a null pointer.", GetErrorMessage(E_INVALID_ARG)); + + ISimStateManagerGetPinLockSettingResultListener* pSimStateManagerGetPinLockSettingResultListener = dynamic_cast(&listener); + SysTryReturnVoidResult(NID_TEL, pSimStateManagerGetPinLockSettingResultListener != null, E_INVALID_ARG, + "[%s] Invalid argument used. The result of a dynamic_cast operation is null for SIM manager listener", GetErrorMessage(E_INVALID_ARG)); + + _SimManagerEventType eventType = pArg->GetEventType(); + + switch(eventType) + { + case _SIM_MANAGER_EVENT_PIN_LOCK_SETTING_RESULT_RECEIVED: + SysLog(NID_TEL, "Calling OnSimStateManagerGetPinLockSettingResultReceived()."); + pSimStateManagerGetPinLockSettingResultListener->OnSimStateManagerGetPinLockSettingResultReceived(pArg->IsPinLockEnabled(), pArg->GetResult()); + SysLog(NID_TEL, "Called OnSimStateManagerGetPinLockSettingResultReceived()."); + break; + default: + break; + } +} + +} } // Tizen::Telephony diff --git a/src/FTel_SimManagerEvent.h b/src/FTel_SimManagerEvent.h new file mode 100644 index 0000000..7ca8ed5 --- /dev/null +++ b/src/FTel_SimManagerEvent.h @@ -0,0 +1,89 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FTel_SimManagerEvent.h + * @brief This is the header file for the _SimManagerEvent class. + * + * This header file contains declarations of the _SimManagerEvent class. + */ + +#ifndef _FTEL_INTERNAL_SIM_MANAGER_EVENT_H_ +#define _FTEL_INTERNAL_SIM_MANAGER_EVENT_H_ + +#include +#include + +namespace Tizen { namespace Base { namespace Runtime +{ +class IEventListener; +class IEventArg; +}}} + +namespace Tizen { namespace Telephony +{ + +/** + * @class _SimManagerEvent + * @brief This class handles SimManager events related to SIM setting. + * + * When a SimManager event related to SIM setting occurs, the _SimManagerEvent object finds a ITelephonySimManagerListener object + * which is registered for the Todo:Correct[Device] object and calls an appropriate method of the listener. + */ + +class _SimManagerEvent + : public Tizen::Base::Runtime::_Event +{ +public: + /** + * This is the default constructor for this class. + */ + _SimManagerEvent(); + + /** + * This is the class destructor. + */ + virtual ~_SimManagerEvent(void); + + + /** + * Initializes a new instance of the class + * + */ + result Construct(void); + +protected: + /** + * Checks the arg and finds out the type of event. After that this method calls appropriate pListener's method. + * + * @return A result code. + * @param[in] listener It is a event listener related to SIM setting event. + * @param[in] arg It is an argument-like instance of SimManager event retransmitted to the listener's method as an argument. + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The argument passed to a method contains an invalid value.@n + */ + void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg); + + +private: + _SimManagerEvent(const _SimManagerEvent& rhs); + _SimManagerEvent& operator =(const _SimManagerEvent& rhs); + +}; // _SimManagerEvent + +}} // Tizen::Telephony +#endif // _FTEL_INTERNAL_SIM_MANAGER_EVENT_H_ diff --git a/src/FTel_SimManagerEventArg.cpp b/src/FTel_SimManagerEventArg.cpp new file mode 100644 index 0000000..a3e46f7 --- /dev/null +++ b/src/FTel_SimManagerEventArg.cpp @@ -0,0 +1,63 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTel_SimManagerEventArg.cpp + * @brief This is the implementation file for the %_SimManagerEventArg class. + * + * This file contains the implementation of the %_SimManagerEventArg class. + */ + +#include +#include +#include "FTel_SimManagerEventArg.h" + +namespace Tizen { namespace Telephony +{ + +_SimManagerEventArg::_SimManagerEventArg(void) + : __eventType(_SIM_MANAGER_EVENT_NONE) + , __isPinLockEnabled(false) + , __result(E_SUCCESS) +{ +} + +_SimManagerEventArg::_SimManagerEventArg(_SimManagerEventType type, bool isEnabled, result r) + : __eventType(type) + , __isPinLockEnabled(isEnabled) + , __result(r) +{ +} + +_SimManagerEventType +_SimManagerEventArg::GetEventType(void) const +{ + return __eventType; +} + +result +_SimManagerEventArg::GetResult(void) const +{ + return __result; +} + +bool +_SimManagerEventArg::IsPinLockEnabled(void) const +{ + return __isPinLockEnabled; +} + +} } // Tizen::Telephony diff --git a/src/FTel_SimManagerEventArg.h b/src/FTel_SimManagerEventArg.h new file mode 100644 index 0000000..7f1a125 --- /dev/null +++ b/src/FTel_SimManagerEventArg.h @@ -0,0 +1,83 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTel_SimManagerEventArg.h + * @brief This is the header file for _SimManagerEventArg class. + * + * This header file contains the declarations of _SimManagerEventArg class. + */ + + +#ifndef _FTEL_INTERNAL_SIM_MANAGER_EVENT_ARG_H_ +#define _FTEL_INTERNAL_SIM_MANAGER_EVENT_ARG_H_ + +#include +#include +#include +#include + +//namespace Tizen { namespace Base { namespace Collection +//{ +//class IList; +//}}} + +namespace Tizen { namespace Telephony +{ + +enum _SimManagerEventType +{ + _SIM_MANAGER_EVENT_NONE, + _SIM_MANAGER_EVENT_PIN_LOCK_SETTING_RESULT_RECEIVED +}; + + +/** + * @class _SimManagerEventArg + * @brief This class is used as an argument of methods of the ITelephonySimManagerListener class. + * + * This class is used as an argument of ITelephonySimManagerListener methods. + * When a SimManager event occurs, the _SimManagerEvent object finds a ITelephonySimManagerListener object + * which is registered for the SimManager object and calls an appropriate method of the listener. + */ + +class _SimManagerEventArg + : public Tizen::Base::Object + , public Tizen::Base::Runtime::IEventArg +{ +public: + _SimManagerEventArg(void); + _SimManagerEventArg(_SimManagerEventType type, bool isEnabled, result r); + virtual ~_SimManagerEventArg(void) {}; + + _SimManagerEventType GetEventType(void) const; + result GetResult(void) const; + bool IsPinLockEnabled(void) const; + +private: + _SimManagerEventArg(const _SimManagerEventArg& rhs); + _SimManagerEventArg& operator =(const _SimManagerEventArg& rhs); + +private: + _SimManagerEventType __eventType; + bool __isPinLockEnabled; + result __result; + +}; // _SimManagerEventArg + +} } + +#endif // _FTEL_INTERNAL_SIM_MANAGER_EVENT_ARG_H_ diff --git a/src/FTel_SimStateManagerImpl.cpp b/src/FTel_SimStateManagerImpl.cpp new file mode 100644 index 0000000..6c68ff9 --- /dev/null +++ b/src/FTel_SimStateManagerImpl.cpp @@ -0,0 +1,420 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTel_SimStateManagerImpl.cpp + * @brief This is the implementation file for _SimStateManagerImpl class. + */ + +// Todo: Remove unnecessary headers +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "FTel_SimInfoImpl.h" +#include "FTel_SimStateManagerImpl.h" + +#include "FTel_SimEvent.h" +#include "FTel_SimEventArg.h" +#include "FTel_SimManagerEvent.h" +#include "FTel_SimManagerEventArg.h" +#include "FTel_TelephonyIpcProxy.h" +#include "FTel_TelephonyUtility.h" + +using namespace std; +using namespace Tizen::System; +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Utility; +using namespace Tizen::Base::Collection; + + +namespace Tizen { namespace Telephony +{ + +_SimStateManagerImpl::_SimStateManagerImpl(void) + : __pHandle(null) + , __simState(SIM_STATE_UNKNOWN) + , __isInProgress(false) + , __pSimEvent(null) + , __pSimManagerEvent(null) + , __pSimEventListener(null) + , __pSimStateManagerGetPinLockSettingResultListener(null) +{ +} + +_SimStateManagerImpl::~_SimStateManagerImpl(void) +{ + if (__pHandle != null) + { + tel_deregister_noti_event(__pHandle, TAPI_NOTI_SIM_STATUS); + tel_deinit(__pHandle); + } +} + +result +_SimStateManagerImpl::Construct() +{ + result r = E_SUCCESS; + int err = TAPI_API_SUCCESS; + TelSimCardStatus_t initStatus = TAPI_SIM_STATUS_UNKNOWN; + int cardChanged = 0; + + SysAssertf(__pHandle == null, + "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class."); + + __pHandle = tel_init(null); + SysTryReturnResult(NID_TEL, __pHandle != null, E_SYSTEM, + "[%s] A system error has occurred. Failed to initialize TApi library.", GetErrorMessage(E_SYSTEM)); + + err = tel_register_noti_event(__pHandle, TAPI_NOTI_SIM_STATUS, OnSimStateChangedCallback, this); + SysTryCatch(NID_TEL, err == TAPI_API_SUCCESS, r = E_SYSTEM, E_SYSTEM, + "[%s] A system error has occurred. Failed to register the callback function.", GetErrorMessage(E_SYSTEM)); + + err = tel_get_sim_init_info(__pHandle, &initStatus, &cardChanged); + SysLog(NID_TEL, "Initial state of SIM card is [%d:%d]", initStatus, cardChanged); + SysTryCatch(NID_TEL, err == TAPI_API_SUCCESS, r = E_SYSTEM, E_SYSTEM, + "[%s] A system error has occurred. Failed to get initial state of SIM.", GetErrorMessage(E_SYSTEM)); + + switch (initStatus) + { + case TAPI_SIM_STATUS_CARD_NOT_PRESENT: // fall through + case TAPI_SIM_STATUS_CARD_REMOVED: + __simState = SIM_STATE_ABSENT; + break; + + case TAPI_SIM_STATUS_SIM_INITIALIZING: + __simState = SIM_STATE_INITIALIZING; + break; + + case TAPI_SIM_STATUS_SIM_INIT_COMPLETED: + __simState = SIM_STATE_READY; + break; + + case TAPI_SIM_STATUS_SIM_PIN_REQUIRED: + __simState = SIM_STATE_PIN_REQUIRED; + break; + + case TAPI_SIM_STATUS_SIM_PUK_REQUIRED: + __simState = SIM_STATE_PUK_REQUIRED; + break; + + case TAPI_SIM_STATUS_SIM_NCK_REQUIRED: // fall through + case TAPI_SIM_STATUS_SIM_NSCK_REQUIRED: // fall through + case TAPI_SIM_STATUS_SIM_SPCK_REQUIRED: // fall through + case TAPI_SIM_STATUS_SIM_CCK_REQUIRED: + __simState = SIM_STATE_NETWORK_LOCKED; + break; + + case TAPI_SIM_STATUS_SIM_LOCK_REQUIRED: + __simState = SIM_STATE_SIM_LOCKED; + break; + + case TAPI_SIM_STATUS_CARD_ERROR: // fall through + case TAPI_SIM_STATUS_CARD_BLOCKED: // fall through + case TAPI_SIM_STATUS_UNKNOWN: // fall through + default : + __simState = SIM_STATE_UNKNOWN; + break; + } // switch + + return r; + +CATCH: + if (__pHandle != null) + { + tel_deinit(__pHandle); + __pHandle = null; + } + + return r; +} + +void +_SimStateManagerImpl::OnSimStateChangedCallback(TapiHandle* pHandle, const char* pNotiId, void* pData, void* pUserData) +{ + SysLog(NID_TEL, "Enter"); // Todo: Remove temporary log + + TelSimCardStatus_t* status = (TelSimCardStatus_t*)pData; + SysLog(NID_TEL, "TelSimCardStatus: [%d]", *status); + + _SimStateManagerImpl* pSimStateManagerImpl = static_cast<_SimStateManagerImpl*>(pUserData); + + SimState state = SIM_STATE_UNKNOWN; + + switch (*status) + { + case TAPI_SIM_STATUS_CARD_NOT_PRESENT: // fall through + case TAPI_SIM_STATUS_CARD_REMOVED: + state = SIM_STATE_ABSENT; + break; + + case TAPI_SIM_STATUS_SIM_INITIALIZING: + state = SIM_STATE_INITIALIZING; + break; + + case TAPI_SIM_STATUS_SIM_INIT_COMPLETED: + state = SIM_STATE_READY; + break; + + case TAPI_SIM_STATUS_SIM_PIN_REQUIRED: + state = SIM_STATE_PIN_REQUIRED; + break; + + case TAPI_SIM_STATUS_SIM_PUK_REQUIRED: + state = SIM_STATE_PUK_REQUIRED; + break; + + case TAPI_SIM_STATUS_SIM_NCK_REQUIRED: // fall through + case TAPI_SIM_STATUS_SIM_NSCK_REQUIRED: // fall through + case TAPI_SIM_STATUS_SIM_SPCK_REQUIRED: // fall through + case TAPI_SIM_STATUS_SIM_CCK_REQUIRED: + state = SIM_STATE_NETWORK_LOCKED; + break; + + case TAPI_SIM_STATUS_SIM_LOCK_REQUIRED: + state = SIM_STATE_SIM_LOCKED; + break; + + case TAPI_SIM_STATUS_CARD_ERROR: // fall through + case TAPI_SIM_STATUS_CARD_BLOCKED: // fall through + case TAPI_SIM_STATUS_UNKNOWN: // fall through + default : + state = SIM_STATE_UNKNOWN; + break; + } // switch + + if (pSimStateManagerImpl->__simState != state) + { + pSimStateManagerImpl->__simState = state; + + _SimEventArg* pEventArg = new (std::nothrow)_SimEventArg(_SIM_EVENT_SIM_STATE_CHANGED, state); + SysTryReturnVoidResult(NID_TEL, pEventArg != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + + (void)pSimStateManagerImpl->__pSimEvent->Fire(*pEventArg); + } + + SysLog(NID_TEL, "Exit"); // Todo: Remove temporary log +} + +void +_SimStateManagerImpl::OnGetPinLockSettingCallback(TapiHandle* pHandle, int ret, void* pData, void* pUserData) +{ + result r = E_SUCCESS; + bool isEnabled = false; + + TelSimPinOperationResult_t err = (TelSimPinOperationResult_t)ret; + SysLog(NID_TEL, "The result of PIN operation is [%d]", err); + + if (err != TAPI_SIM_PIN_OPERATION_SUCCESS) + { + r = E_INVALID_STATE; + } + else + { + TelSimFacilityInfo_t* pFacilityInfo = (TelSimFacilityInfo_t*)pData; + + TelSimLockType_t lockType = pFacilityInfo->type; + TelSimFacilityStatus_t facilityStatus = pFacilityInfo->f_status; + SysLog(NID_TEL, "Lock type is [%d], and facility status is [%d].", lockType, facilityStatus); + + if (lockType == TAPI_SIM_LOCK_SC && facilityStatus == TAPI_SIM_FACILITY_DISABLED) + { + isEnabled = false; + } + else if (lockType == TAPI_SIM_LOCK_SC && facilityStatus == TAPI_SIM_FACILITY_ENABLED) + { + isEnabled = true; + } + else if (lockType != TAPI_SIM_LOCK_SC || facilityStatus == TAPI_SIM_FACILITY_UNKNOWN) + { + r = E_INVALID_STATE; + isEnabled = false; + } + } + + _SimStateManagerImpl* pSimStateManagerImpl = static_cast<_SimStateManagerImpl*>(pUserData); + pSimStateManagerImpl->__isInProgress = false; + + _SimManagerEventArg* pEventArg = new (std::nothrow)_SimManagerEventArg(_SIM_MANAGER_EVENT_PIN_LOCK_SETTING_RESULT_RECEIVED, isEnabled, r); + SysTryReturnVoidResult(NID_TEL, pEventArg != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + + (void)pSimStateManagerImpl->__pSimManagerEvent->Fire(*pEventArg); + + SysLog(NID_TEL, "Exit"); // Todo: Remove temporary log +} + +result +_SimStateManagerImpl::SetSimEventListener(ITelephonySimEventListener *pListener) +{ + result r = E_SUCCESS; + + if (__pSimEventListener != null) + { + __pSimEvent->RemoveListener(*__pSimEventListener); + __pSimEventListener = null; + } + + if (__pSimEvent == null && pListener != null) + { + std::unique_ptr<_SimEvent> pSimEvent(new (std::nothrow) _SimEvent()); + SysTryReturnResult(NID_TEL, pSimEvent != null, E_OUT_OF_MEMORY, "Memory allocation failed."); + + r = pSimEvent->Construct(); + SysTryReturnResult(NID_TEL, r == E_SUCCESS, r, "Propagating."); + + __pSimEvent = move(pSimEvent); + } + + if (pListener != null) + { + r = __pSimEvent->AddListener(*pListener, true); + + if (r == E_SUCCESS) + { + __pSimEventListener = pListener; + } + } + + if (r != E_SUCCESS) + { + __pSimEvent.reset(null); + SysLogException(NID_TEL, r, "[%s] Propagating.", GetErrorMessage(r)); + } + + return r; +} + +result +_SimStateManagerImpl::SetSimStateManagerGetPinLockSettingResultListener(ISimStateManagerGetPinLockSettingResultListener *pListener) +{ + result r = E_SUCCESS; + + if (__pSimStateManagerGetPinLockSettingResultListener != null) + { + __pSimManagerEvent->RemoveListener(*__pSimStateManagerGetPinLockSettingResultListener); + __pSimStateManagerGetPinLockSettingResultListener = null; + } + + if (__pSimManagerEvent == null && pListener != null) + { + std::unique_ptr<_SimManagerEvent> pSimManagerEvent(new (std::nothrow) _SimManagerEvent()); + SysTryReturnResult(NID_TEL, pSimManagerEvent != null, E_OUT_OF_MEMORY, "Memory allocation failed."); + + r = pSimManagerEvent->Construct(); + SysTryReturnResult(NID_TEL, r == E_SUCCESS, r, "Propagating."); + + __pSimManagerEvent = move(pSimManagerEvent); + } + + if (pListener != null) + { + r = __pSimManagerEvent->AddListener(*pListener, true); + if (r == E_SUCCESS) + { + __pSimStateManagerGetPinLockSettingResultListener = pListener; + } + } + + if (r != E_SUCCESS) + { + __pSimManagerEvent.reset(null); + SysLogException(NID_TEL, r, "[%s] Propagating.", GetErrorMessage(r)); + } + + return r; +} + +SimState +_SimStateManagerImpl::GetSimState(void) const +{ + return __simState; +} + +result +_SimStateManagerImpl::GetPinLockSetting(ISimStateManagerGetPinLockSettingResultListener* pListener) +{ + result r = E_SUCCESS; + int ret; + + SysTryReturnResult(NID_TEL, pListener != null, E_INVALID_ARG, "The specified input parameter is invalid."); + SysTryReturnResult(NID_TEL, !__isInProgress, E_IN_PROGRESS, "The previous request is in progress."); + + r = SetSimStateManagerGetPinLockSettingResultListener(pListener); + SysTryReturnResult(NID_TEL, r == E_SUCCESS, E_SYSTEM, "A system error has occurred. Failed to set listener."); + + ret = tel_get_sim_facility(__pHandle, TAPI_SIM_LOCK_SC, OnGetPinLockSettingCallback, this); + + SysTryReturnResult(NID_TEL, ret != TAPI_API_SIM_NOT_FOUND, E_DEVICE_UNAVAILABLE, + "The operation failed due to a missing SIM card."); + + SysTryReturnResult(NID_TEL, ret == TAPI_API_SUCCESS || ret == TAPI_API_SIM_NOT_FOUND, E_SYSTEM, + "A system error has occurred. Failed to get SIM facility."); + + __isInProgress = true; + + return r; +} + +result +_SimStateManagerImpl::GetSimInfo(SimInfo& simInfo) const +{ + SysAssertf(__pHandle != null, "Not yet constructed. Construct() should be called before use."); + + result r = E_SUCCESS; + + _SimInfoImpl* pSimInfoImpl = _SimInfoImpl::GetInstance(simInfo); + if (pSimInfoImpl == null) + { + r = simInfo.Construct(); + } + else + { + r = pSimInfoImpl->Construct(); + } + + SysTryReturnResult(NID_TEL, r == E_SUCCESS, E_SYSTEM, "A system error has occurred. Failed to construct SimInfo."); + + return r; +} + +_SimStateManagerImpl* +_SimStateManagerImpl::GetInstance(SimStateManager& simStateManager) +{ + return simStateManager.__pSimStateManagerImpl; +} + +const _SimStateManagerImpl* +_SimStateManagerImpl::GetInstance(const SimStateManager& simStateManager) +{ + return simStateManager.__pSimStateManagerImpl; +} + +}} // Tizen::Telephony diff --git a/src/FTel_SimStateManagerImpl.h b/src/FTel_SimStateManagerImpl.h new file mode 100644 index 0000000..87dff6b --- /dev/null +++ b/src/FTel_SimStateManagerImpl.h @@ -0,0 +1,149 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +/** + * @file FTel_SimStateManagerImpl.h + * @brief This is the header file for the %_SimStateManagerImpl class. + * + * This header file contains the declarations of the %_SimStateManagerImpl class. + */ + +#ifndef _FTEL_INTERNAL_SIM_STATE_MANAGER_IMPL_H_ +#define _FTEL_INTERNAL_SIM_STATE_MANAGER_IMPL_H_ + + +#include +#include +#include + +#include +#include +#include +#include + + +namespace Tizen { namespace Base +{ +class String; +} } // Tizen::Base + +namespace Tizen { namespace Telephony +{ +class SimStateManager; +class _SimEvent; +class _SimManagerEvent; +class ITelephonySimEventListener; +class ISimStateManagerGetPinLockSettingResultListener; +//class _TelephonyIpcProxy; + + +class _SimStateManagerImpl + : public Tizen::Base::Object +{ +public: + /** + * This is the default constructor for this class. + * + * @since 2.1 + */ + _SimStateManagerImpl(void); + + /** + * This is the destructor for this class. + * + * @since 2.1 + */ + virtual ~_SimStateManagerImpl(void); + + /** + * @see SimStateManager::Construct() + */ + result Construct(void); + + /** + * @see SimStateManager::SetSimEventListener() + */ + result SetSimEventListener(ITelephonySimEventListener *pListener); + + result SetSimStateManagerGetPinLockSettingResultListener(ISimStateManagerGetPinLockSettingResultListener *pListener); + + /** + * @see SimStateManager::GetSimInfo() + */ + result GetSimInfo(SimInfo& simInfo) const; + + /** + * @see SimStateManager::GetSimState() + */ + SimState GetSimState(void) const; + + /** + * @see SimStateManager::GetPinLockSetting() + */ + result GetPinLockSetting(ISimStateManagerGetPinLockSettingResultListener* pListener); + + /** + * Gets the Impl instance. + * + * @since 2.1 + * @return The pointer to _SimStateManagerImpl + * @param[in] simStateManager An instance of SimStateManager + */ + static _SimStateManagerImpl* GetInstance(SimStateManager& simStateManager); + + /** + * Gets the Impl instance. + * + * @since 2.1 + * @return The pointer to _SimStateManagerImpl + * @param[in] simStateManager An instance of SimStateManager + */ + static const _SimStateManagerImpl* GetInstance(const SimStateManager& simStateManager); + + static void OnSimStateChangedCallback(TapiHandle* pHandle, const char* pNotiId, void* pData, void* pUserData); + static void OnGetPinLockSettingCallback(TapiHandle* pHandle, int ret, void* pData, void* pUserData); + +private: + // + // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. + // + // @param[in] rhs An instance of %_SimStateManagerImpl + // + _SimStateManagerImpl(const _SimStateManagerImpl& rhs); + + // + // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects. + // + // @param[in] rhs An instance of %_SimStateManagerImpl + // + _SimStateManagerImpl& operator =(const _SimStateManagerImpl& rhs); + +private: + TapiHandle* __pHandle; + SimState __simState; + bool __isInProgress; + + std::unique_ptr<_SimEvent> __pSimEvent; + std::unique_ptr<_SimManagerEvent> __pSimManagerEvent; + + ITelephonySimEventListener* __pSimEventListener; + ISimStateManagerGetPinLockSettingResultListener* __pSimStateManagerGetPinLockSettingResultListener; + +}; // _SimStateManagerImpl + +}} // Tizen::Telephony + +#endif // _FTEL_INTERNAL_SIM_STATE_MANAGER_IMPL_H_ diff --git a/src/FTel_TelephonyIpcMessages.cpp b/src/FTel_TelephonyIpcMessages.cpp index e3b8035..88ec8b8 100644 --- a/src/FTel_TelephonyIpcMessages.cpp +++ b/src/FTel_TelephonyIpcMessages.cpp @@ -6,7 +6,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/FTel_TelephonyIpcProxy.h b/src/FTel_TelephonyIpcProxy.h index d5522b7..a7d3249 100644 --- a/src/FTel_TelephonyIpcProxy.h +++ b/src/FTel_TelephonyIpcProxy.h @@ -6,7 +6,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/FTel_TelephonyUtility.h b/src/FTel_TelephonyUtility.h index af67db3..f6a48bc 100644 --- a/src/FTel_TelephonyUtility.h +++ b/src/FTel_TelephonyUtility.h @@ -37,6 +37,9 @@ class String; namespace Tizen { namespace Telephony { +static const int _HASH_CODE_INITIAL_VALUE = 17; +static const int _HASH_CODE_COEFFICIENT_VALUE = 37; + struct _ConnectionDeleter { void operator()(void* pConnection)