SET(maintainer "Wootak Jung<wootak.jung@samsung.com>")
SET(description "Telephony Core API")
SET(service "telephony")
-SET(dependents "dlog tapi glib-2.0 capi-base-common capi-system-info")
+SET(dependents "dlog tapi glib-2.0 capi-base-common openssl capi-system-info")
SET(pc_dependents "capi-base-common tapi")
SET(Services
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(ADDITIONAL_CFLAGS "-Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wcast-qual")
+SET(ADDITIONAL_CFLAGS "-Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-but-set-parameter -Wno-unused-but-set-variable")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ADDITIONAL_CFLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
*/
/**
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
*/
/**
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
*/
/**
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
*/
/**
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
*/
#endif /* __TIZEN_TELEPHONY_INFORMATION_DOC_H__ */
*/
/**
+ * @brief The call handle.
+ * @since_tizen 2.4
+ */
+typedef struct telephony_call_info_s *telephony_call_h;
+
+/**
+ * @deprecated Deprecated Since 2.4. Use #telephony_call_status_e instead.
+ *
* @brief Enumeration for the call state.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
-typedef enum
-{
- TELEPHONY_CALL_STATE_IDLE, /**< There exists no calls. */
- TELEPHONY_CALL_STATE_CONNECTING, /**< There exists at least one call that is dialing, alerting or incoming */
- TELEPHONY_CALL_STATE_CONNECTED, /**< There exist active or held calls, and no calls are dialing, alerting or incoming*/
+typedef enum {
+ TELEPHONY_CALL_STATE_IDLE, /**< There exists no calls. */
+ TELEPHONY_CALL_STATE_CONNECTING, /**< There exists at least one call that is dialing, alerting or incoming */
+ TELEPHONY_CALL_STATE_CONNECTED, /**< There exist active or held calls, and no calls are dialing, alerting or incoming */
} telephony_call_state_e;
/**
+ * @brief Enumeration for the call status.
+ * @since_tizen 2.4
+ */
+typedef enum {
+ TELEPHONY_CALL_STATUS_IDLE, /**< Idle status */
+ TELEPHONY_CALL_STATUS_ACTIVE, /**< Active status */
+ TELEPHONY_CALL_STATUS_HELD, /**< Held status */
+ TELEPHONY_CALL_STATUS_DIALING, /**< Dialing status */
+ TELEPHONY_CALL_STATUS_ALERTING, /**< Alerting status */
+ TELEPHONY_CALL_STATUS_INCOMING, /**< Incoming status */
+} telephony_call_status_e;
+
+/**
+ * @brief Enumeration for the preferred voice call subscription.
+ * @since_tizen 2.4
+ */
+typedef enum {
+ TELEPHONY_CALL_PREFERRED_VOICE_SUBS_UNKNOWN = -1, /**< Unknown status */
+ TELEPHONY_CALL_PREFERRED_VOICE_SUBS_CURRENT_NETWORK = 0, /**< Current network */
+ TELEPHONY_CALL_PREFERRED_VOICE_SUBS_ASK_ALWAYS, /**< ASK Always */
+ TELEPHONY_CALL_PREFERRED_VOICE_SUBS_SIM1, /**< SIM 1 */
+ TELEPHONY_CALL_PREFERRED_VOICE_SUBS_SIM2, /**< SIM 2 */
+} telephony_call_preferred_voice_subs_e;
+
+/**
+ * @brief Enumeration for the call type.
+ * @since_tizen 2.4
+ */
+typedef enum {
+ TELEPHONY_CALL_TYPE_VOICE, /**< Voice call */
+ TELEPHONY_CALL_TYPE_VIDEO, /**< Video call */
+ TELEPHONY_CALL_TYPE_E911, /**< Emergency call */
+} telephony_call_type_e;
+
+/**
+ * @brief Enumeration for the call direction.
+ * @since_tizen 2.4
+ */
+typedef enum {
+ TELEPHONY_CALL_DIRECTION_MO, /**< MO(Mobile Originated) call */
+ TELEPHONY_CALL_DIRECTION_MT, /**< MT(Mobile Terminated) call */
+} telephony_call_direction_e;
+
+/**
+ * @deprecated Deprecated Since 2.4. Use #telephony_call_get_status instead.
+ *
* @brief Gets the voice call state of the telephony service.
* @details Determines if the voice call is connecting, connected, or idle.
*
int telephony_call_get_voice_call_state(telephony_h handle, telephony_call_state_e *call_state);
/**
+ * @deprecated Deprecated Since 2.4. Use #telephony_call_get_status instead.
+ *
* @brief Gets the video call state of the telephony service.
* @details Determines if the video call is connecting, connected, or idle.
*
int telephony_call_get_video_call_state(telephony_h handle, telephony_call_state_e *call_state);
/**
+ * @brief Gets the current value for the preferred voice call subscription.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] call_sub The currently set preferred call subscription value. (telephony_call_preferred_voice_subs_e)
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ */
+int telephony_call_get_preferred_voice_subscription(telephony_h handle, telephony_call_preferred_voice_subs_e *call_sub);
+
+/**
+ * @brief Gets the list of the current call.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @remarks You must release @c call_list using telephony_call_release_call_list().
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] count Count of the existing calls.
+ * @param[out] call_list List of call information for existing calls.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ */
+int telephony_call_get_call_list(telephony_h handle,
+ unsigned int *count, telephony_call_h **call_list);
+
+/**
+ * @brief Releases the list allocated from #telephony_call_get_call_list()
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] count The count of the calls from #telephony_call_get_call_list()
+ * @param[in] call_list The handle from #telephony_call_get_call_list()
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The call list should be validated from #telephony_call_get_call_list()
+ */
+int telephony_call_release_call_list(unsigned int count, telephony_call_h **call_list);
+
+/**
+ * @brief Gets the call handle ID.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] call_handle The handle from #telephony_call_get_call_list()
+ * @param[out] handle_id The id of the call handle
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The call handle should be obtained from #telephony_call_get_call_list()
+ * @post The call list should be released by using #telephony_call_release_call_list()
+ */
+int telephony_call_get_handle_id(telephony_call_h call_handle, unsigned int *handle_id);
+
+/**
+ * @brief Gets the call number.
+ *
+ * @since_tizen 2.4
+ *
+ * @remarks You must release @c number using free().
+ *
+ * @param[in] call_handle The handle from #telephony_call_get_call_list()
+ * @param[out] number The number of the call
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The call handle should be obtained from #telephony_call_get_call_list()
+ * @post The call list should be released by using #telephony_call_release_call_list()
+ */
+int telephony_call_get_number(telephony_call_h call_handle, char **number);
+
+/**
+ * @brief Gets the call type.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] call_handle The handle from #telephony_call_get_call_list()
+ * @param[out] type The type of the call (#telephony_call_type_e)
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The call handle should be obtained from #telephony_call_get_call_list()
+ * @post The call list should be released by using #telephony_call_release_call_list()
+ */
+int telephony_call_get_type(telephony_call_h call_handle, telephony_call_type_e *type);
+
+/**
+ * @brief Gets the call status.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] call_handle The handle from #telephony_call_get_call_list()
+ * @param[out] status The status of the call (#telephony_call_status_e)
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The call handle should be obtained from #telephony_call_get_call_list()
+ * @post The call list should be released by using #telephony_call_release_call_list()
+ */
+int telephony_call_get_status(telephony_call_h call_handle, telephony_call_status_e *status);
+
+/**
+ * @brief Gets whether the call is MO(Mobile Originated) call or MT(Mobile Terminated).
+ * @since_tizen 2.4
+ *
+ * @param[in] call_handle The handle from #telephony_call_get_call_list()
+ * @param[out] direction The direction of the call (#telephony_call_direction_e)
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The call handle should be obtained from #telephony_call_get_call_list()
+ * @post The call list should be released by using #telephony_call_release_call_list()
+ */
+int telephony_call_get_direction(telephony_call_h call_handle, telephony_call_direction_e *direction);
+
+/**
+ * @brief Gets whether the call is conference call or not.
+ * @since_tizen 2.4
+ *
+ * @param[in] call_handle The handle from #telephony_call_get_call_list()
+ * @param[out] conference_status The value whether the call is conference call or not.
+ * (true: Conference call, false: Single call)
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The call handle should be obtained from #telephony_call_get_call_list()
+ * @post The call list should be released by using #telephony_call_release_call_list()
+ */
+int telephony_call_get_conference_status(telephony_call_h call_handle, bool *conference_status);
+
+/**
* @}
*/
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum {
- TELEPHONY_NOTI_SIM_STATUS = 0x10, /**< Notification to be invoked when the SIM card state changes */
+ TELEPHONY_NOTI_SIM_STATUS = 0x10, /**< Notification to be invoked when the SIM card state changes, '#telephony_sim_state_e' will be delivered in notification data */
- TELEPHONY_NOTI_NETWORK_SERVICE_STATE = 0x20, /**< Notification to be invoked when the network service state changes */
- TELEPHONY_NOTI_NETWORK_CELLID, /**< Notification to be invoked when the cell ID changes */
- TELEPHONY_NOTI_NETWORK_ROAMING_STATUS, /**< Notification to be invoked when the roaming status changes */
- TELEPHONY_NOTI_NETWORK_SIGNALSTRENGTH_LEVEL, /**< Notification to be invoked when the signal strength changes */
+ TELEPHONY_NOTI_NETWORK_SERVICE_STATE = 0x20, /**< Notification to be invoked when the network service state changes, '#telephony_network_service_state_e' will be delivered in notification data */
+ TELEPHONY_NOTI_NETWORK_CELLID, /**< Notification to be invoked when the cell ID changes, 'cell_id(int)' will be delivered in notification data */
+ TELEPHONY_NOTI_NETWORK_ROAMING_STATUS, /**< Notification to be invoked when the roaming status changes, 'roaming_status(bool)' will be delivered in notification data */
+ TELEPHONY_NOTI_NETWORK_SIGNALSTRENGTH_LEVEL, /**< Notification to be invoked when the signal strength changes, '#telephony_network_rssi_e' will be delivered in notification data */
+ TELEPHONY_NOTI_NETWORK_NETWORK_NAME, /**< Notification to be invoked when the network name changes, 'network_name(char *)' wil be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_NETWORK_PS_TYPE, /**< Notification to be invoked when the ps type changes, '#telephony_network_ps_type_e' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION, /**< Notification to be invoked when the default data subscription changes, '#telephony_network_default_data_subs_e' wil be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_NETWORK_DEFAULT_SUBSCRIPTION, /**< Notification to be invoked when the default subscription changes, '#telephony_network_default_subs_e' will be delivered in notification data (@b Since: 2.4) */
- TELEPHONY_NOTI_VOICE_CALL_STATE = 0x30, /**< Notification to be invoked when the voice call state changes */
- TELEPHONY_NOTI_VIDEO_CALL_STATE /**< Notification to be invoked when the video call state changes */
+ TELEPHONY_NOTI_VOICE_CALL_STATE = 0x30, /**< Notification to be invoked when the voice call state changes, '#telephony_call_state_e' will be delivered in notification data (Deprecated Since 2.4. Use #TELEPHONY_NOTI_VOICE_CALL_STATUS_XXX instead.) */
+ TELEPHONY_NOTI_VIDEO_CALL_STATE, /**< Notification to be invoked when the video call state changes, '#telephony_call_state_e' will be delivered in notification data (Deprecated Since 2.4. Use #TELEPHONY_NOTI_VIDEO_CALL_STATUS_XXX instead.) */
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_IDLE, /**< Notification to be invoked when a voice call is in idle status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_ACTIVE, /**< Notification to be invoked when a voice call is in active status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_HELD, /**< Notification to be invoked when a voice call is in held status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_DIALING, /**< Notification to be invoked when a voice call is in dialing status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_ALERTING, /**< Notification to be invoked when a voice call is in alerting status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_INCOMING, /**< Notification to be invoked when a voice call is in incoming status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VIDEO_CALL_STATUS_IDLE, /**< Notification to be invoked when a video call is in idle status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VIDEO_CALL_STATUS_ACTIVE, /**< Notification to be invoked when a video call is in active status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VIDEO_CALL_STATUS_DIALING, /**< Notification to be invoked when a video call is in dialing status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VIDEO_CALL_STATUS_ALERTING, /**< Notification to be invoked when a video call is in alerting status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_VIDEO_CALL_STATUS_INCOMING, /**< Notification to be invoked when a video call is in incoming status, 'handle_id(unsigned int)' will be delivered in notification data (@b Since: 2.4) */
+ TELEPHONY_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION /**< Notification to be invoked when the preferred voice subscription changes, '#telephony_call_preferred_voice_subs_e' will be delivered in notification data (@b Since: 2.4) */
} telephony_noti_e;
/**
int telephony_deinit(telephony_handle_list_s *list);
/**
+ * @brief Enumeration for the telephony state.
+ * @since_tizen 2.4
+ */
+typedef enum {
+ TELEPHONY_STATE_NOT_READY, /**< Telephony state is not ready */
+ TELEPHONY_STATE_READY, /**< Telephony state is ready */
+} telephony_state_e;
+
+/**
+ * @brief Called for the telephony state changes.
+ * @since_tizen 2.4
+ */
+typedef void (*telephony_state_changed_cb)(telephony_state_e state, void *user_data);
+
+/**
+ * @brief Acquires the telephony state value
+ *
+ * @since_tizen 2.4
+ *
+ * @param[out] state The state value of telephony.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see telephony_set_state_changed_cb()
+ * @see telephony_unset_state_changed_cb()
+ */
+int telephony_get_state(telephony_state_e *state);
+
+/**
+ * @brief Sets a callback function to be invoked when the telephony state changes.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] callback The callback to be invoked when the telephony state changes
+ * @param[in] user_data The user data passed to the callback function
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post telephony_state_changed_cb() will be invoked.
+ *
+ * @see telephony_unset_state_changed_cb()
+ */
+int telephony_set_state_changed_cb(telephony_state_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unsets a telephony state callback function.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] callback The callback to unset when the telephony state changes
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see telephony_set_state_changed_cb()
+ */
+int telephony_unset_state_changed_cb(telephony_state_changed_cb callback);
+
+/**
* @}
*/
*/
/**
+ * @brief Enumeration for Modem Power Status.
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+ TELEPHONY_MODEM_POWER_STATUS_UNKNOWN = -1, /**< Unknown*/
+ TELEPHONY_MODEM_POWER_STATUS_ON, /**< Modem power ON */
+ TELEPHONY_MODEM_POWER_STATUS_OFF, /**< Modem power OFF */
+ TELEPHONY_MODEM_POWER_STATUS_RESET, /**< Modem power RESET */
+ TELEPHONY_MODEM_POWER_STATUS_LOW, /**< Modem power LOW */
+} telephony_modem_power_status_e;
+
+/**
* @brief Gets the IMEI (International Mobile Station Equipment Identity) of a mobile phone.
* @details The IMEI number is used by a GSM network to identify valid devices
* and therefore can be used for stopping a stolen phone from accessing that network.
int telephony_modem_get_imei(telephony_h handle, char **imei);
/**
+ * @brief Gets the power status of the modem
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] status The Modem power status (0=on,1=off,2=reset,3=low)
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ */
+int telephony_modem_get_power_status(telephony_h handle,
+ telephony_modem_power_status_e *status);
+
+/**
* @}
*/
TELEPHONY_NETWORK_TYPE_LTE, /**< LTE network type */
} telephony_network_type_e;
+/**
+ * @brief Enumeration for PS Type.
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+ TELEPHONY_NETWORK_PS_TYPE_UNKNOWN, /**< Unknown */
+ TELEPHONY_NETWORK_PS_TYPE_HSDPA, /**< HSDPA ps type */
+ TELEPHONY_NETWORK_PS_TYPE_HSUPA, /**< HSUPA ps type */
+ TELEPHONY_NETWORK_PS_TYPE_HSPA, /**< HSPA ps type */
+ TELEPHONY_NETWORK_PS_TYPE_HSPAP, /**< HSPAP ps type */
+} telephony_network_ps_type_e;
/**
* @brief Enumeration for Network Service State.
} telephony_network_service_state_e;
/**
+ * @brief Enumeration for Network Name Priority.
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+ TELEPHONY_NETWORK_NAME_OPTION_UNKNOWN, /**< Unknown */
+ TELEPHONY_NETWORK_NAME_OPTION_SPN, /**< Network name displayed by SPN */
+ TELEPHONY_NETWORK_NAME_OPTION_NETWORK, /**< Network name displayed by Network */
+ TELEPHONY_NETWORK_NAME_OPTION_ANY, /**< Network name displayed by SPN or Network */
+} telephony_network_name_option_e;
+
+/**
+ * @brief Enumeration for the possible 'default' Data Subscriptions for Packet Switched(PS).
+ * @since_tizen 2.4
+ */
+typedef enum {
+ TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_UNKNOWN = -1, /**< Unknown status */
+ TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_SIM1 = 0, /**< SIM 1 */
+ TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_SIM2 /**< SIM 2 */
+} telephony_network_default_data_subs_e;
+
+/**
+ * @brief Enumeration defines possible 'default' Subscriptions for Circuit Switched(CS).
+ * @since_tizen 2.4
+ */
+typedef enum {
+ TELEPHONY_NETWORK_DEFAULT_SUBS_UNKNOWN = -1, /**< Unknown status **/
+ TELEPHONY_NETWORK_DEFAULT_SUBS_SIM1 = 0, /**< SIM 1 network **/
+ TELEPHONY_NETWORK_DEFAULT_SUBS_SIM2 /**< SIM 2 network **/
+} telephony_network_default_subs_e;
+
+/**
* @brief Gets the LAC (Location Area Code) of the current network.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
telephony_network_type_e *network_type);
/**
+ * @brief Gets the packet service type of the current registered network.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] ps_type The type of packet service
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @pre The Network service state must be #TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE.
+ *
+ * @see telephony_network_get_service_state()
+ */
+int telephony_network_get_ps_type(telephony_h handle, telephony_network_ps_type_e *ps_type);
+
+/**
+ * @brief Gets the network name option of the current registered network.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] network_name_option The network name display option
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @pre The Network service state must be #TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE.
+ *
+ * @see telephony_network_get_service_state()
+ */
+int telephony_network_get_network_name_option(telephony_h handle,
+ telephony_network_name_option_e *network_name_option);
+
+/**
* @brief Gets the current network state of the telephony service.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
telephony_network_service_state_e *network_service_state);
/**
+ * @brief Gets the current default subscription for data service (Packet Switched).
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] default_sub The current default data subscription
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ */
+int telephony_network_get_default_data_subscription(telephony_h handle,
+ telephony_network_default_data_subs_e *default_sub);
+
+/**
+ * @brief Gets the current default subscription for voice service (Circuit Switched).
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] default_sub The current default voice subscription
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ */
+int telephony_network_get_default_subscription(telephony_h handle,
+ telephony_network_default_subs_e *default_sub);
+
+/**
* @}
*/
#include <glib.h>
#include <system_info.h>
#include "telephony_common.h"
+#include "telephony_call.h"
#define TELEPHONY_FEATURE "http://tizen.org/feature/network.telephony"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CAPI_TELEPHONY"
+
+#define CHECK_INPUT_PARAMETER(arg) \
+ if (arg == NULL) { \
+ LOGE("INVALID_PARAMETER"); \
+ return TELEPHONY_ERROR_INVALID_PARAMETER; \
+ }
+
#define CHECK_TELEPHONY_SUPPORTED(feature_name) { \
bool telephony_supported = FALSE; \
if (!system_info_get_platform_bool(feature_name, &telephony_supported)) { \
} \
}
+/**
+ * @brief Definition for the max length of call number
+ * @since_tizen 2.4
+ */
+#define TELEPHONY_CALL_NUMBER_LEN_MAX 82
+
typedef struct {
GSList *evt_list;
struct tapi_handle *tapi_h;
guint prop_callback_evt_id;
};
+/**
+ * @brief The structure type for the call information.
+ * @since_tizen 2.4
+ */
+typedef struct {
+ unsigned int id; /**< The handle of the call */
+ char number[TELEPHONY_CALL_NUMBER_LEN_MAX + 1]; /**< Calling number */
+ telephony_call_type_e type; /**< Type of call (voice, video, emergency) */
+ telephony_call_status_e status; /**< Call Status */
+ telephony_call_direction_e direction; /**< Call direction (MO, MT) */
+ bool conference_status; /**< true: Conference call, false: Single call */
+} telephony_call_info_s;
+
#endif /* __CAPI_TELEPHONY_PRIVATE_H__ */
TELEPHONY_SIM_STATE_UNKNOWN, /**< SIM is in transition between states */
} telephony_sim_state_e;
+
+/**
+ * @brief Enumeration for the type of SIM card .
+ * @since_tizen 2.4
+ */
+typedef enum {
+ TELEPHONY_SIM_APP_TYPE_SIM = 0x01, /**< SIM(GSM) Application */
+ TELEPHONY_SIM_APP_TYPE_USIM = 0x02, /**< USIM Application */
+ TELEPHONY_SIM_APP_TYPE_CSIM = 0x04, /**< CDMA Application */
+ TELEPHONY_SIM_APP_TYPE_ISIM = 0x08, /**< ISIM Application */
+} telephony_sim_application_type_e;
+
+
/**
* @brief Gets the Integrated Circuit Card IDentification (ICC-ID).
* @details The Integrated Circuit Card Identification number internationally identifies SIM cards.
* otherwise a negative error value
*
* @retval #TELEPHONY_ERROR_NONE Successful
- * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
* @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
- * @retval #TELEPHONY_ERROR_OPERATION_FAILED Invalid parameter
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
* @retval #TELEPHONY_ERROR_SIM_NOT_AVAILABLE SIM is not available
*
* @pre The SIM state must be #TELEPHONY_SIM_STATE_AVAILABLE.
* otherwise a negative error value
*
* @retval #TELEPHONY_ERROR_NONE Successful
- * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
* @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
- * @retval #TELEPHONY_ERROR_OPERATION_FAILED Invalid parameter
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
* @retval #TELEPHONY_ERROR_SIM_NOT_AVAILABLE SIM is not available
*
* @pre The SIM state must be #TELEPHONY_SIM_STATE_AVAILABLE.
* otherwise a negative error value
*
* @retval #TELEPHONY_ERROR_NONE Successful
- * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
* @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
- * @retval #TELEPHONY_ERROR_OPERATION_FAILED Invalid parameter
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
* @retval #TELEPHONY_ERROR_SIM_NOT_AVAILABLE SIM is not available
*
* @pre The SIM state must be #TELEPHONY_SIM_STATE_AVAILABLE.
/**
* @brief Gets the Service Provider Name (SPN) of the SIM card.
* @details This function gets Service Provider Name embedded in the SIM card.
- * If this value is not stored in SIM card, @c NULL will be returned.
+ * If this value is not stored in SIM card,
+ * negative error returned and @c NULL will be stored in @c spn.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* otherwise a negative error value
*
* @retval #TELEPHONY_ERROR_NONE Successful
- * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
* @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
- * @retval #TELEPHONY_ERROR_OPERATION_FAILED Invalid parameter
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
* @retval #TELEPHONY_ERROR_SIM_NOT_AVAILABLE SIM is not available
*
* @pre The SIM state must be #TELEPHONY_SIM_STATE_AVAILABLE.
* otherwise a negative error value
*
* @retval #TELEPHONY_ERROR_NONE Successful
- * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
* @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
- * @retval #TELEPHONY_ERROR_OPERATION_FAILED Invalid parameter
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
* @retval #TELEPHONY_ERROR_SIM_NOT_AVAILABLE SIM is not available
*
* @pre The SIM state must be #TELEPHONY_SIM_STATE_AVAILABLE.
* otherwise a negative error value
*
* @retval #TELEPHONY_ERROR_NONE Successful
- * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
* @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
- * @retval #TELEPHONY_ERROR_OPERATION_FAILED Invalid parameter
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
*/
int telephony_sim_get_state(telephony_h handle, telephony_sim_state_e *sim_state);
/**
+ * @brief Gets the list of application on UICC.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] app_list The masking value for below values
+ * #TELEPHONY_SIM_APP_TYPE_SIM 0x01 GSM Application
+ * #TELEPHONY_SIM_APP_TYPE_USIM 0x02 USIM Application
+ * #TELEPHONY_SIM_APP_TYPE_CSIM 0x04 CSIM Application
+ * #TELEPHONY_SIM_APP_TYPE_ISIM 0x08 ISIM Application
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ */
+int telephony_sim_get_application_list(telephony_h handle, unsigned int *app_list);
+
+/**
* @brief Gets the SIM card subscriber number.
* @details This function gets subscriber number embedded in the SIM card.
* This value contains MSISDN related to the subscriber.
- * If this value is not stored in SIM card, @c NULL will be returned.
+ * If this value is not stored in SIM card,
+ * negative error returned and @c NULL will be stored in @c subscriber_number.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* otherwise a negative error value
*
* @retval #TELEPHONY_ERROR_NONE Successful
- * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Out of memory
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
* @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
- * @retval #TELEPHONY_ERROR_OPERATION_FAILED Invalid parameter
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
* @retval #TELEPHONY_ERROR_SIM_NOT_AVAILABLE SIM is not available
*
* @pre The SIM state must be #TELEPHONY_SIM_STATE_AVAILABLE.
int telephony_sim_get_subscriber_number(telephony_h handle, char **subscriber_number);
/**
+ * @brief Gets the Subscriber ID.
+ * @details This function gets subscriber ID encoded.
+ *
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/telephony
+ *
+ * @remarks You must release @c subscriber_id using free().
+ *
+ * @param[in] handle The handle from telephony_init()
+ * @param[out] subscriber_id The subscriber ID
+ *
+ * @retval #TELEPHONY_ERROR_NONE Successful
+ * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
+ * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
+ * @retval #TELEPHONY_ERROR_SIM_NOT_AVAILABLE SIM is not available
+ *
+ * @pre The SIM state must be #TELEPHONY_SIM_STATE_AVAILABLE.
+ *
+ * @see telephony_sim_get_state()
+ */
+int telephony_sim_get_subscriber_id(telephony_h handle, char **subscriber_id);
+
+/**
* @}
*/
Name: capi-telephony
Summary: Telephony Core API
-Version: 0.1.32
+Version: 0.1.53
Release: 1
Group: System/Libraries
License: Apache-2.0
BuildRequires: pkgconfig(tapi)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(capi-system-info)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%{_includedir}/telephony/telephony_modem.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-telephony.so
-
-
#include "telephony_call.h"
#include "telephony_private.h"
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "CAPI_TELEPHONY"
-
-#define CHECK_INPUT_PARAMETER(arg) \
- if (arg == NULL) { \
- LOGE("INVALID_PARAMETER"); \
- return TELEPHONY_ERROR_INVALID_PARAMETER; \
- }
-
static void _mapping_call_state(TelCallStates_t tapi_call_state, telephony_call_state_e *call_state)
{
switch (tapi_call_state) {
}
}
+static void _mapping_call_status(TelCallStates_t tapi_call_state,
+ telephony_call_status_e *status)
+{
+ switch (tapi_call_state) {
+ case TAPI_CALL_STATE_IDLE:
+ *status = TELEPHONY_CALL_STATUS_IDLE;
+ break;
+ case TAPI_CALL_STATE_ACTIVE:
+ *status = TELEPHONY_CALL_STATUS_ACTIVE;
+ break;
+ case TAPI_CALL_STATE_HELD:
+ *status = TELEPHONY_CALL_STATUS_HELD;
+ break;
+ case TAPI_CALL_STATE_DIALING:
+ *status = TELEPHONY_CALL_STATUS_DIALING;
+ break;
+ case TAPI_CALL_STATE_ALERT:
+ *status = TELEPHONY_CALL_STATUS_ALERTING;
+ break;
+ case TAPI_CALL_STATE_INCOMING:
+ case TAPI_CALL_STATE_WAITING:
+ *status = TELEPHONY_CALL_STATUS_INCOMING;
+ break;
+ default:
+ LOGE("Not handled call state: [%d]", tapi_call_state);
+ break;
+ }
+}
+
static void _voice_call_get_state_cb(TelCallStatus_t *tapi_status, void *user_data)
{
telephony_call_state_e *call_state = user_data;
_mapping_call_state(tapi_status->CallState, call_state);
}
+static void _get_call_status_cb(TelCallStatus_t *status, void *user_data)
+{
+ GSList **list = user_data;
+ telephony_call_info_s *call_info;
+
+ call_info = g_malloc0(sizeof(telephony_call_info_s));
+ if (!call_info)
+ return;
+ call_info->id = status->CallHandle;
+ call_info->type = status->CallType;
+ call_info->direction = status->bMoCall ? TELEPHONY_CALL_DIRECTION_MO : TELEPHONY_CALL_DIRECTION_MT;
+ call_info->conference_status = status->bConferenceState;
+ _mapping_call_status(status->CallState, &call_info->status);
+ strncpy(call_info->number, status->pNumber, TELEPHONY_CALL_NUMBER_LEN_MAX);
+
+ LOGI("id[%d] number[%s] type[%s] status[%s] direction[%s] conference_status[%s]",
+ call_info->id, call_info->number,
+ call_info->type == TELEPHONY_CALL_TYPE_VOICE ? "VOICE" :
+ call_info->type == TELEPHONY_CALL_TYPE_VIDEO ? "VIDEO" : "E911",
+ call_info->status == TELEPHONY_CALL_STATUS_IDLE ? "IDLE" :
+ call_info->status == TELEPHONY_CALL_STATUS_ACTIVE ? "ACTVIE" :
+ call_info->status == TELEPHONY_CALL_STATUS_HELD ? "HELD" :
+ call_info->status == TELEPHONY_CALL_STATUS_DIALING ? "DIALING" :
+ call_info->status == TELEPHONY_CALL_STATUS_ALERTING ? "ALERTING" :
+ call_info->status == TELEPHONY_CALL_STATUS_INCOMING ? "INCOMING" : "UNKNOWN",
+ call_info->direction == TELEPHONY_CALL_DIRECTION_MO ? "MO" : "MT",
+ call_info->conference_status ? "TRUE" : "FALSE");
+ *list = g_slist_append(*list, call_info);
+}
+
int telephony_call_get_voice_call_state(telephony_h handle, telephony_call_state_e *call_state)
{
int ret;
return TELEPHONY_ERROR_NONE;
}
+
+int telephony_call_get_preferred_voice_subscription(telephony_h handle, telephony_call_preferred_voice_subs_e *call_sub)
+{
+ int ret;
+ TapiHandle *tapi_h;
+ TelCallPreferredVoiceSubs_t preferred_sub = TAPI_CALL_PREFERRED_VOICE_SUBS_UNKNOWN;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(call_sub);
+
+ ret = tel_get_call_preferred_voice_subscription(tapi_h, &preferred_sub);
+ if (ret == TAPI_API_ACCESS_DENIED) {
+ LOGE("PERMISSION_DENIED");
+ return TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else if (ret != TAPI_API_SUCCESS) {
+ LOGE("OPERATION_FAILED");
+ return TELEPHONY_ERROR_OPERATION_FAILED;
+ } else {
+ switch (preferred_sub) {
+ case TAPI_CALL_PREFERRED_VOICE_SUBS_CURRENT_NETWORK:
+ *call_sub = TELEPHONY_CALL_PREFERRED_VOICE_SUBS_CURRENT_NETWORK;
+ break;
+ case TAPI_CALL_PREFERRED_VOICE_SUBS_ASK_ALWAYS:
+ *call_sub = TELEPHONY_CALL_PREFERRED_VOICE_SUBS_ASK_ALWAYS;
+ break;
+ case TAPI_CALL_PREFERRED_VOICE_SUBS_SIM1:
+ *call_sub = TELEPHONY_CALL_PREFERRED_VOICE_SUBS_SIM1;
+ break;
+ case TAPI_CALL_PREFERRED_VOICE_SUBS_SIM2:
+ *call_sub = TELEPHONY_CALL_PREFERRED_VOICE_SUBS_SIM2;
+ break;
+ case TAPI_CALL_PREFERRED_VOICE_SUBS_UNKNOWN:
+ default:
+ *call_sub = TELEPHONY_CALL_PREFERRED_VOICE_SUBS_UNKNOWN;
+ break;
+ }
+ }
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_call_get_call_list(telephony_h handle,
+ unsigned int *count, telephony_call_h **call_list)
+{
+ int ret;
+ TapiHandle *tapi_h;
+ GSList *list = NULL, *tmp;
+ unsigned int call_index = 0;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(call_list);
+ CHECK_INPUT_PARAMETER(count);
+
+ ret = tel_get_call_status_all(tapi_h, _get_call_status_cb, &list);
+ if (ret == TAPI_API_ACCESS_DENIED) {
+ LOGE("PERMISSION_DENIED");
+ return TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else if (ret != TAPI_API_SUCCESS) {
+ LOGE("OPERATION_FAILED");
+ return TELEPHONY_ERROR_OPERATION_FAILED;
+ }
+
+ if (g_slist_length(list)) {
+ *count = g_slist_length(list);
+ *call_list = g_malloc0(*count * sizeof(telephony_call_h));
+
+ tmp = list;
+ while (tmp) {
+ telephony_call_info_s *call_info = tmp->data;
+ (*call_list)[call_index] = g_malloc0(sizeof(telephony_call_info_s));
+ memcpy((*call_list)[call_index], call_info, sizeof(telephony_call_info_s));
+ tmp = g_slist_next(tmp);
+ call_index++;
+ }
+ g_slist_free(list);
+ } else {
+ *count = 0;
+ *call_list = NULL;
+ }
+
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_call_release_call_list(unsigned int count, telephony_call_h **call_list)
+{
+ int i;
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(call_list);
+
+ if (count > 0) {
+ for (i = 0; i < count; i++)
+ g_free((telephony_call_info_s *)(*call_list)[i]);
+ g_free(*call_list);
+ }
+
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_call_get_handle_id(telephony_call_h call_handle, unsigned int *handle_id)
+{
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(call_handle);
+ CHECK_INPUT_PARAMETER(handle_id);
+
+ *handle_id = ((telephony_call_info_s *)call_handle)->id;
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_call_get_number(telephony_call_h call_handle, char **number)
+{
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(call_handle);
+ CHECK_INPUT_PARAMETER(number);
+
+ *number = g_strdup(((telephony_call_info_s *)call_handle)->number);
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_call_get_type(telephony_call_h call_handle,
+ telephony_call_type_e *type)
+{
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(call_handle);
+ CHECK_INPUT_PARAMETER(type);
+
+ *type = ((telephony_call_info_s *)call_handle)->type;
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_call_get_status(telephony_call_h call_handle,
+ telephony_call_status_e *status)
+{
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(call_handle);
+ CHECK_INPUT_PARAMETER(status);
+
+ *status = ((telephony_call_info_s *)call_handle)->status;
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_call_get_direction(telephony_call_h call_handle,
+ telephony_call_direction_e *direction)
+{
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(call_handle);
+ CHECK_INPUT_PARAMETER(direction);
+
+ *direction = ((telephony_call_info_s *)call_handle)->direction;
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_call_get_conference_status(telephony_call_h call_handle, bool *conference_status)
+{
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(call_handle);
+ CHECK_INPUT_PARAMETER(conference_status);
+
+ *conference_status = ((telephony_call_info_s *)call_handle)->conference_status;
+ return TELEPHONY_ERROR_NONE;
+}
#include <dlog.h>
#include <tapi_common.h>
+#include <TelCall.h>
#include <TelSim.h>
#include <TelNetwork.h>
#include <TapiUtility.h>
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "CAPI_TELEPHONY"
-
#define CALLBACK_CALL(data) \
if (evt_cb_data->cb) { \
evt_cb_data->cb(evt_cb_data->handle, \
evt_cb_data->noti_id, data, evt_cb_data->user_data); \
}
-#define CHECK_INPUT_PARAMETER(arg) \
- if (arg == NULL) { \
- LOGE("INVALID_PARAMETER"); \
- return TELEPHONY_ERROR_INVALID_PARAMETER; \
+/* Handle deprecated noti_id for backward compatibility */
+#define CALLBACK_CALL_FOR_DEPRECATED_NOTI(evt_cb_data) \
+ if (evt_cb_data->noti_id == TELEPHONY_NOTI_VOICE_CALL_STATE) { \
+ telephony_call_state_e call_state; \
+ telephony_call_get_voice_call_state(evt_cb_data->handle, &call_state); \
+ CALLBACK_CALL(&call_state); \
+ return; \
+ } else if (evt_cb_data->noti_id == TELEPHONY_NOTI_VIDEO_CALL_STATE) { \
+ telephony_call_state_e call_state; \
+ telephony_call_get_video_call_state(evt_cb_data->handle, &call_state); \
+ CALLBACK_CALL(&call_state); \
+ return; \
}
typedef struct {
return TAPI_PROP_NETWORK_ROAMING_STATUS;
case TELEPHONY_NOTI_NETWORK_SIGNALSTRENGTH_LEVEL:
return TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL;
+ case TELEPHONY_NOTI_NETWORK_NETWORK_NAME:
+ return TAPI_PROP_NETWORK_NETWORK_NAME;
+ case TELEPHONY_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION:
+ return TAPI_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION;
+ case TELEPHONY_NOTI_NETWORK_PS_TYPE:
+ return TAPI_PROP_NETWORK_PS_TYPE;
+ case TELEPHONY_NOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION:
+ return TAPI_NOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION;
+ case TELEPHONY_NOTI_NETWORK_DEFAULT_SUBSCRIPTION:
+ return TAPI_NOTI_NETWORK_DEFAULT_SUBSCRIPTION;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_IDLE:
+ return TAPI_NOTI_VOICE_CALL_STATUS_IDLE;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_ACTIVE:
+ return TAPI_NOTI_VOICE_CALL_STATUS_ACTIVE;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_HELD:
+ return TAPI_NOTI_VOICE_CALL_STATUS_HELD;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_DIALING:
+ return TAPI_NOTI_VOICE_CALL_STATUS_DIALING;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_ALERTING:
+ return TAPI_NOTI_VOICE_CALL_STATUS_ALERT;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_INCOMING:
+ return TAPI_NOTI_VOICE_CALL_STATUS_INCOMING;
+ case TELEPHONY_NOTI_VIDEO_CALL_STATUS_IDLE:
+ return TAPI_NOTI_VIDEO_CALL_STATUS_IDLE;
+ case TELEPHONY_NOTI_VIDEO_CALL_STATUS_ACTIVE:
+ return TAPI_NOTI_VIDEO_CALL_STATUS_ACTIVE;
+ case TELEPHONY_NOTI_VIDEO_CALL_STATUS_DIALING:
+ return TAPI_NOTI_VIDEO_CALL_STATUS_DIALING;
+ case TELEPHONY_NOTI_VIDEO_CALL_STATUS_ALERTING:
+ return TAPI_NOTI_VIDEO_CALL_STATUS_ALERT;
+ case TELEPHONY_NOTI_VIDEO_CALL_STATUS_INCOMING:
+ return TAPI_NOTI_VIDEO_CALL_STATUS_INCOMING;
default:
return NULL;
}
int count = sizeof(voice_call_state_tbl) / sizeof(char *);
for (i = 0; i < count; i++) {
ret = tel_deregister_noti_event(tapi_h, voice_call_state_tbl[i]);
- if (ret != TAPI_API_SUCCESS) {
+ if (ret != TAPI_API_SUCCESS)
LOGE("Noti [%s] deregistration failed", voice_call_state_tbl[i]);
- }
}
} else if (noti_id == TELEPHONY_NOTI_VIDEO_CALL_STATE) {
int count = sizeof(video_call_state_tbl) / sizeof(char *);
for (i = 0; i < count; i++) {
ret = tel_deregister_noti_event(tapi_h, video_call_state_tbl[i]);
- if (ret != TAPI_API_SUCCESS) {
+ if (ret != TAPI_API_SUCCESS)
LOGE("Noti [%s] deregistration failed", video_call_state_tbl[i]);
- }
}
} else {
/* Deregister other notifications */
ret = tel_deregister_noti_event(tapi_h, tapi_noti);
- if (ret != TAPI_API_SUCCESS) {
+ if (ret != TAPI_API_SUCCESS)
LOGE("Noti [%s] deregistration failed", tapi_noti);
- }
}
return TELEPHONY_ERROR_NONE;
} else if (!g_strcmp0(evt_id, TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL)) {
int rssi = *(int *)data;
CALLBACK_CALL(&rssi);
+ } else if (!g_strcmp0(evt_id, TAPI_PROP_NETWORK_NETWORK_NAME)) {
+ char *network_name = data;
+ CALLBACK_CALL(network_name);
+ } else if (!g_strcmp0(evt_id, TAPI_PROP_NETWORK_PS_TYPE)) {
+ int ps_type = *(int *)data;
+ CALLBACK_CALL(&ps_type);
+ } else if (!g_strcmp0(evt_id, TAPI_NOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION)) {
+ int default_data_sub = *(int *)data;
+ CALLBACK_CALL(&default_data_sub);
+ } else if (!g_strcmp0(evt_id, TAPI_NOTI_NETWORK_DEFAULT_SUBSCRIPTION)) {
+ int default_sub = *(int *)data;
+ CALLBACK_CALL(&default_sub);
} else if (!g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_IDLE)
- || !g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_ACTIVE)
- || !g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_HELD)
- || !g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_DIALING)
- || !g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_ALERT)
- || !g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_INCOMING)) {
- telephony_call_state_e call_state;
- telephony_call_get_voice_call_state(evt_cb_data->handle, &call_state);
- CALLBACK_CALL(&call_state);
- } else if (!g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_IDLE)
- || !g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_ACTIVE)
- || !g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_DIALING)
- || !g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_ALERT)
+ || !g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_IDLE)) {
+ TelCallStatusIdleNoti_t *noti = data;
+ unsigned int handle_id = noti->id;
+ CALLBACK_CALL_FOR_DEPRECATED_NOTI(evt_cb_data);
+ CALLBACK_CALL(&handle_id);
+ } else if (!g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_ACTIVE)
+ || !g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_ACTIVE)) {
+ TelCallStatusActiveNoti_t *noti = data;
+ unsigned int handle_id = noti->id;
+ CALLBACK_CALL_FOR_DEPRECATED_NOTI(evt_cb_data);
+ CALLBACK_CALL(&handle_id);
+ } else if (!g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_HELD)) {
+ TelCallStatusHeldNoti_t *noti = data;
+ unsigned int handle_id = noti->id;
+ CALLBACK_CALL_FOR_DEPRECATED_NOTI(evt_cb_data);
+ CALLBACK_CALL(&handle_id);
+ } else if (!g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_DIALING)
+ || !g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_DIALING)) {
+ TelCallStatusDialingNoti_t *noti = data;
+ unsigned int handle_id = noti->id;
+ CALLBACK_CALL_FOR_DEPRECATED_NOTI(evt_cb_data);
+ CALLBACK_CALL(&handle_id);
+ } else if (!g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_ALERT)
+ || !g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_ALERT)) {
+ TelCallStatusAlertNoti_t *noti = data;
+ unsigned int handle_id = noti->id;
+ CALLBACK_CALL_FOR_DEPRECATED_NOTI(evt_cb_data);
+ CALLBACK_CALL(&handle_id);
+ } else if (!g_strcmp0(evt_id, TAPI_NOTI_VOICE_CALL_STATUS_INCOMING)
|| !g_strcmp0(evt_id, TAPI_NOTI_VIDEO_CALL_STATUS_INCOMING)) {
- telephony_call_state_e call_state;
- telephony_call_get_video_call_state(evt_cb_data->handle, &call_state);
- CALLBACK_CALL(&call_state);
+ TelCallIncomingCallInfo_t *noti = data;
+ unsigned int handle_id = noti->CallHandle;
+ CALLBACK_CALL_FOR_DEPRECATED_NOTI(evt_cb_data);
+ CALLBACK_CALL(&handle_id);
+ } else if (!g_strcmp0(evt_id, TAPI_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION)) {
+ int call_pref_voice_sub = *(int *)data;
+ CALLBACK_CALL(&call_pref_voice_sub);
} else {
LOGE("Unhandled noti: [%s]", evt_id);
}
CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
CHECK_INPUT_PARAMETER(list);
-#if !GLIB_CHECK_VERSION(2,35,0)
+#if !GLIB_CHECK_VERSION(2, 35, 0)
/* Need g_type_init() to use tel_get_cp_name_list() */
g_type_init();
#endif
cp_list = tel_get_cp_name_list();
if (cp_list == NULL) {
LOGE("cp_list is NULL");
+ list->count = 0;
return TELEPHONY_ERROR_OPERATION_FAILED;
}
- while (cp_list[cp_count]) {
+ while (cp_list[cp_count])
cp_count++;
- }
list->count = cp_count;
list->handle = g_malloc(cp_count * sizeof(telephony_h));
return TELEPHONY_ERROR_NONE;
}
+
+int telephony_get_state(telephony_state_e *state)
+{
+ int res = 0;
+ int value = 0;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(state);
+
+ res = tel_get_ready_state(&value);
+ if (res != TAPI_API_SUCCESS)
+ return TELEPHONY_ERROR_OPERATION_FAILED;
+
+ *state = value;
+
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_set_state_changed_cb(telephony_state_changed_cb callback, void *user_data)
+{
+ int res = 0;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(callback);
+
+ res = tel_register_ready_state_cb((tapi_state_cb)callback, user_data);
+ if (res != TAPI_API_SUCCESS)
+ return TELEPHONY_ERROR_OPERATION_FAILED;
+
+ return TELEPHONY_ERROR_NONE;
+}
+
+int telephony_unset_state_changed_cb(telephony_state_changed_cb callback)
+{
+ int res = 0;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(callback);
+
+ res = tel_deregister_ready_state_cb((tapi_state_cb)callback);
+ if (res != TAPI_API_SUCCESS)
+ return TELEPHONY_ERROR_OPERATION_FAILED;
+
+ return TELEPHONY_ERROR_NONE;
+}
#include "telephony_modem.h"
#include "telephony_private.h"
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "CAPI_TELEPHONY"
-
-#define CHECK_INPUT_PARAMETER(arg) \
- if (arg == NULL) { \
- LOGE("INVALID_PARAMETER"); \
- return TELEPHONY_ERROR_INVALID_PARAMETER; \
- }
-
int telephony_modem_get_imei(telephony_h handle, char **imei)
{
GVariant *gv = NULL;
return error;
}
+
+int telephony_modem_get_power_status(telephony_h handle,
+ telephony_modem_power_status_e *status)
+{
+ TapiHandle *tapi_h;
+ int ret;
+ tapi_power_phone_power_status_t modem_status = TAPI_PHONE_POWER_STATUS_UNKNOWN;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(status);
+
+ ret = tel_check_modem_power_status(tapi_h, &modem_status);
+ if (ret == TAPI_API_ACCESS_DENIED) {
+ LOGE("PERMISSION_DENIED");
+ return TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else if (ret != TAPI_API_SUCCESS) {
+ LOGE("OPERATION_FAILED");
+ return TELEPHONY_ERROR_OPERATION_FAILED;
+ } else {
+ switch (modem_status) {
+ case TAPI_PHONE_POWER_STATUS_ON:
+ *status = TELEPHONY_MODEM_POWER_STATUS_ON;
+ break;
+ case TAPI_PHONE_POWER_STATUS_OFF:
+ *status = TELEPHONY_MODEM_POWER_STATUS_OFF;
+ break;
+ case TAPI_PHONE_POWER_STATUS_RESET:
+ *status = TELEPHONY_MODEM_POWER_STATUS_RESET;
+ break;
+ case TAPI_PHONE_POWER_STATUS_LOW:
+ *status = TELEPHONY_MODEM_POWER_STATUS_LOW;
+ break;
+ case TAPI_PHONE_POWER_STATUS_UNKNOWN:
+ case TAPI_PHONE_POWER_STATUS_ERROR:
+ default:
+ *status = TELEPHONY_MODEM_POWER_STATUS_UNKNOWN;
+ break;
+ }
+ }
+
+ LOGI("modem_power_status = %d (0=on,1=off,2=rst,3=low)", *status);
+
+ return TELEPHONY_ERROR_NONE;
+
+}
#include <glib.h>
#include <dlog.h>
#include <tapi_common.h>
+#include <ITapiNetwork.h>
#include <TapiUtility.h>
#include <TelNetwork.h>
#include "telephony_network.h"
#include <sys/types.h>
#include <unistd.h>
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "CAPI_TELEPHONY"
-
-#define CHECK_INPUT_PARAMETER(arg) \
- if (arg == NULL) { \
- LOGE("INVALID_PARAMETER"); \
- return TELEPHONY_ERROR_INVALID_PARAMETER; \
- }
-
int telephony_network_get_lac(telephony_h handle, int *lac)
{
int ret;
ret = tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_PLMN, &plmn_str);
if (ret == TAPI_API_SUCCESS) {
- *mcc = malloc (sizeof(char) * (mcc_length + 1));
+ *mcc = malloc(sizeof(char) * (mcc_length + 1));
if (*mcc == NULL) {
LOGE("OUT_OF_MEMORY");
ret = TELEPHONY_ERROR_OUT_OF_MEMORY;
} else {
- memset (*mcc, 0x00, mcc_length + 1);
- strncpy (*mcc, plmn_str, mcc_length);
- free (plmn_str);
+ memset(*mcc, 0x00, mcc_length + 1);
+ strncpy(*mcc, plmn_str, mcc_length);
+ free(plmn_str);
LOGI("mcc:[%s]", *mcc);
ret = TELEPHONY_ERROR_NONE;
plmn_length = strlen(plmn_str);
LOGI("plmn:[%s], length:[%d]", plmn_str, plmn_length);
- *mnc = malloc (sizeof(char) * (plmn_length -3 + 1));
+ *mnc = malloc(sizeof(char) * (plmn_length -3 + 1));
if (*mnc == NULL) {
LOGE("OUT_OF_MEMORY");
ret = TELEPHONY_ERROR_OUT_OF_MEMORY;
} else {
- memset (*mnc, 0x00, (plmn_length -3 + 1));
- strncpy (*mnc, plmn_str + 3, (plmn_length -3 + 1));
- free (plmn_str);
+ memset(*mnc, 0x00, (plmn_length -3 + 1));
+ strncpy(*mnc, plmn_str + 3, (plmn_length -3 + 1));
+ free(plmn_str);
LOGI("mnc:[%s]", *mnc);
ret = TELEPHONY_ERROR_NONE;
return ret;
}
+int telephony_network_get_network_name_option(telephony_h handle, telephony_network_name_option_e *network_name_option)
+{
+ int ret;
+ int name_option = 0;
+ TapiHandle *tapi_h;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(network_name_option);
+
+ ret = tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_NAME_OPTION, &name_option);
+ if (ret == TAPI_API_SUCCESS) {
+ switch (name_option) {
+ case TAPI_NETWORK_NAME_OPTION_SPN:
+ *network_name_option = TELEPHONY_NETWORK_NAME_OPTION_SPN;
+ break;
+ case TAPI_NETWORK_NAME_OPTION_OPERATOR:
+ *network_name_option = TELEPHONY_NETWORK_NAME_OPTION_NETWORK;
+ break;
+ case TAPI_NETWORK_NAME_OPTION_ANY:
+ *network_name_option = TELEPHONY_NETWORK_NAME_OPTION_ANY;
+ break;
+ default:
+ *network_name_option = TELEPHONY_NETWORK_NAME_OPTION_UNKNOWN;
+ break;
+ }
+
+ LOGI("network_name_option:[%d]", *network_name_option);
+ ret = TELEPHONY_ERROR_NONE;
+ } else if (ret == TAPI_API_ACCESS_DENIED) {
+ LOGE("PERMISSION_DENIED");
+ ret = TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else {
+ LOGE("OPERATION_FAILED");
+ ret = TELEPHONY_ERROR_OPERATION_FAILED;
+ }
+
+ return ret;
+}
+
int telephony_network_get_type(telephony_h handle, telephony_network_type_e *network_type)
{
int ret;
return ret;
}
+int telephony_network_get_ps_type(telephony_h handle, telephony_network_ps_type_e *ps_type)
+{
+ int ret;
+ int service_type = 0;
+ TapiHandle *tapi_h;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(ps_type);
+
+ ret = tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_PS_TYPE, &service_type);
+ if (ret == TAPI_API_SUCCESS) {
+ switch (service_type) {
+ case TAPI_NETWORK_PS_TYPE_HSDPA:
+ *ps_type = TELEPHONY_NETWORK_PS_TYPE_HSDPA;
+ break;
+ case TAPI_NETWORK_PS_TYPE_HSUPA:
+ *ps_type = TELEPHONY_NETWORK_PS_TYPE_HSUPA;
+ break;
+ case TAPI_NETWORK_PS_TYPE_HSPA:
+ *ps_type = TELEPHONY_NETWORK_PS_TYPE_HSPA;
+ break;
+ case TAPI_NETWORK_PS_TYPE_HSPAP:
+ *ps_type = TELEPHONY_NETWORK_PS_TYPE_HSPAP;
+ break;
+ default:
+ *ps_type = TELEPHONY_NETWORK_PS_TYPE_UNKNOWN;
+ break;
+ }
+
+ LOGI("ps_type:[%d]", *ps_type);
+ ret = TELEPHONY_ERROR_NONE;
+ } else if (ret == TAPI_API_ACCESS_DENIED) {
+ LOGE("PERMISSION_DENIED");
+ ret = TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else {
+ LOGE("OPERATION_FAILED");
+ ret = TELEPHONY_ERROR_OPERATION_FAILED;
+ }
+
+ return ret;
+}
+
int telephony_network_get_service_state(telephony_h handle, telephony_network_service_state_e *network_service_state)
{
int ret;
return ret;
}
+
+int telephony_network_get_default_data_subscription(telephony_h handle,
+ telephony_network_default_data_subs_e *default_data_sub)
+{
+ TapiHandle *tapi_h;
+ int ret;
+ TelNetworkDefaultDataSubs_t default_data_subscription = TAPI_NETWORK_DEFAULT_DATA_SUBS_UNKNOWN;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(default_data_sub);
+
+ ret = tel_get_network_default_data_subscription(tapi_h, &default_data_subscription);
+ if (ret == TAPI_API_SUCCESS) {
+ switch (default_data_subscription) {
+ case TAPI_NETWORK_DEFAULT_DATA_SUBS_SIM1:
+ *default_data_sub = TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_SIM1;
+ break;
+ case TAPI_NETWORK_DEFAULT_DATA_SUBS_SIM2:
+ *default_data_sub = TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_SIM2;
+ break;
+ case TAPI_NETWORK_DEFAULT_DATA_SUBS_UNKNOWN:
+ default:
+ *default_data_sub = TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_UNKNOWN;
+ break;
+ }
+ LOGI("default data subscription: [%d]", *default_data_sub);
+ ret = TELEPHONY_ERROR_NONE;
+ } else if (ret == TAPI_API_ACCESS_DENIED) {
+ LOGE("PERMISSION_DENIED");
+ ret = TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else {
+ LOGE("OPERATION_FAILED");
+ ret = TELEPHONY_ERROR_OPERATION_FAILED;
+ }
+
+ return ret;
+}
+
+int telephony_network_get_default_subscription(telephony_h handle,
+ telephony_network_default_subs_e *default_sub)
+{
+ TapiHandle *tapi_h;
+ int ret;
+ TelNetworkDefaultSubs_t default_subscription = TAPI_NETWORK_DEFAULT_SUBS_UNKNOWN;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(default_sub);
+
+ ret = tel_get_network_default_subscription(tapi_h, &default_subscription);
+ if (ret == TAPI_API_SUCCESS) {
+ switch (default_subscription) {
+ case TAPI_NETWORK_DEFAULT_SUBS_SIM1:
+ *default_sub = TELEPHONY_NETWORK_DEFAULT_SUBS_SIM1;
+ break;
+ case TAPI_NETWORK_DEFAULT_SUBS_SIM2:
+ *default_sub = TELEPHONY_NETWORK_DEFAULT_SUBS_SIM2;
+ break;
+ case TAPI_NETWORK_DEFAULT_SUBS_UNKNOWN:
+ default:
+ *default_sub = TELEPHONY_NETWORK_DEFAULT_SUBS_UNKNOWN;
+ break;
+ }
+ LOGI("default subscription: [%d]", *default_sub);
+ ret = TELEPHONY_ERROR_NONE;
+ } else if (ret == TAPI_API_ACCESS_DENIED) {
+ LOGE("PERMISSION_DENIED");
+ ret = TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else {
+ LOGE("OPERATION_FAILED");
+ ret = TELEPHONY_ERROR_OPERATION_FAILED;
+ }
+
+ return ret;
+}
+
#include <glib.h>
#include <gio/gio.h>
#include <dlog.h>
+#include <openssl/sha.h>
#include <tapi_common.h>
#include <TapiUtility.h>
#include "telephony_sim.h"
#include "telephony_private.h"
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "CAPI_TELEPHONY"
-
#define DBUS_SIM_STATUS_ERROR "SIM STATUS ERROR"
#define DBUS_SIM_NOT_FOUND "SIM NOT FOUND"
#define DBUS_SIM_PERM_BLOCKED "SIM PERM BLOCKED"
#define DBUS_SIM_RESPONSE_DATA_ERROR "SIM RESPONSE DATA ERROR"
#define DBUS_SIM_ACCESS_DENIED "No access rights"
-#define CHECK_INPUT_PARAMETER(arg) \
- if (arg == NULL) { \
- LOGE("INVALID_PARAMETER"); \
- return TELEPHONY_ERROR_INVALID_PARAMETER; \
- }
-
#define GET_SIM_STATUS(tapi_h, sim_card_state) { \
int card_changed = 0; \
int ret = tel_get_sim_init_info(tapi_h, &sim_card_state, &card_changed); \
if (sync_gv) {
g_variant_get(sync_gv, "(is)", &result, &iccid);
if (result == TAPI_SIM_ACCESS_SUCCESS) {
- if (iccid != NULL && strlen(iccid) != 0) {
+ if (iccid != NULL && strlen(iccid) != 0)
*icc_id = g_strdup_printf("%s", iccid);
- } else {
+ else
*icc_id = g_strdup_printf("%s", "");
- }
} else {
error_code = TELEPHONY_ERROR_OPERATION_FAILED;
}
return error_code;
}
+int telephony_sim_get_application_list(telephony_h handle, unsigned int *app_list)
+{
+ TapiHandle *tapi_h;
+ unsigned char tapi_app_list;
+ int ret;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(app_list);
+
+ ret = tel_get_sim_application_list(tapi_h, &tapi_app_list);
+ if (ret == TAPI_API_ACCESS_DENIED) {
+ LOGE("PERMISSION_DENIED");
+ return TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else if (ret != TAPI_API_SUCCESS) {
+ LOGE("OPERATION_FAILED");
+ return TELEPHONY_ERROR_OPERATION_FAILED;
+ }
+
+ *app_list = (unsigned int)tapi_app_list;
+ LOGI("SIM Application List: [0x%x]", *app_list);
+ return TELEPHONY_ERROR_NONE;
+}
+
int telephony_sim_get_subscriber_number(telephony_h handle, char **subscriber_number)
{
int error_code = TELEPHONY_ERROR_NONE;
while (g_variant_iter_loop(iter_row, "{sv}", &key, &value)) {
if (!g_strcmp0(key, "number")) {
str_value = g_variant_get_string(value, NULL);
- if (str_value != NULL && strlen(str_value) != 0) {
+ if (str_value != NULL && strlen(str_value) != 0)
*subscriber_number = g_strdup_printf("%s", str_value);
- }
}
}
g_variant_iter_free(iter_row);
return error_code;
}
+
+int telephony_sim_get_subscriber_id(telephony_h handle, char **subscriber_id)
+{
+ int error_code = TELEPHONY_ERROR_NONE;
+ TelSimCardStatus_t sim_card_state = TAPI_SIM_STATUS_UNKNOWN;
+ TapiHandle *tapi_h;
+
+ CHECK_TELEPHONY_SUPPORTED(TELEPHONY_FEATURE);
+ CHECK_INPUT_PARAMETER(handle);
+ tapi_h = ((telephony_data *)handle)->tapi_h;
+ CHECK_INPUT_PARAMETER(tapi_h);
+ CHECK_INPUT_PARAMETER(subscriber_id);
+ GET_SIM_STATUS(tapi_h, sim_card_state);
+
+ *subscriber_id = NULL;
+ if (sim_card_state != TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
+ error_code = TELEPHONY_ERROR_SIM_NOT_AVAILABLE;
+ } else {
+ TelSimImsiInfo_t imsi_info;
+ error_code = tel_get_sim_imsi(tapi_h, &imsi_info);
+ if (error_code == TAPI_API_SUCCESS) {
+ SHA256_CTX ctx;
+ char *imsi;
+ unsigned char md[SHA256_DIGEST_LENGTH];
+ int i;
+
+ imsi = g_strdup_printf("%s%s%s",
+ imsi_info.szMcc, imsi_info.szMnc, imsi_info.szMsin);
+
+ SHA256_Init(&ctx);
+ SHA256_Update(&ctx, imsi, strlen(imsi));
+ SHA256_Final(md, &ctx);
+
+ *subscriber_id = g_malloc0(SHA256_DIGEST_LENGTH * 2 + 1);
+ for (i = 0; i < SHA256_DIGEST_LENGTH; i++)
+ snprintf(*subscriber_id + (i * 2), 3, "%02x", md[i]);
+ LOGI("Subscriber ID: [%s]", *subscriber_id);
+ g_free(imsi);
+ } else if (error_code == TAPI_API_ACCESS_DENIED) {
+ LOGE("get_subscriber_id: PERMISSION_DENIED");
+ error_code = TELEPHONY_ERROR_PERMISSION_DENIED;
+ } else {
+ LOGE("get_subscriber_id: OPERATION_FAILED");
+ error_code = TELEPHONY_ERROR_OPERATION_FAILED;
+ }
+ }
+
+ return error_code;
+}
#define LOG_TAG "CAPI_TELEPHONY_TEST"
static GMainLoop *event_loop;
+static telephony_handle_list_s handle_list;
static int network_noti_tbl[] = {
TELEPHONY_NOTI_NETWORK_SERVICE_STATE,
TELEPHONY_NOTI_NETWORK_CELLID,
TELEPHONY_NOTI_NETWORK_ROAMING_STATUS,
- TELEPHONY_NOTI_NETWORK_SIGNALSTRENGTH_LEVEL
+ TELEPHONY_NOTI_NETWORK_SIGNALSTRENGTH_LEVEL,
+ TELEPHONY_NOTI_NETWORK_NETWORK_NAME,
+ TELEPHONY_NOTI_NETWORK_PS_TYPE,
+ TELEPHONY_NOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION,
+ TELEPHONY_NOTI_NETWORK_DEFAULT_SUBSCRIPTION
};
static int call_noti_tbl[] = {
- TELEPHONY_NOTI_VOICE_CALL_STATE,
- TELEPHONY_NOTI_VIDEO_CALL_STATE
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_IDLE,
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_ACTIVE,
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_HELD,
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_DIALING,
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_ALERTING,
+ TELEPHONY_NOTI_VOICE_CALL_STATUS_INCOMING,
+ TELEPHONY_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION
};
static const char *_mapping_sim_state(telephony_sim_state_e sim_state)
static void sim_noti_cb(telephony_h handle, telephony_noti_e noti_id, void *data, void *user_data)
{
LOGI("Noti!! SIM status: [%d]", *(int *)data);
-
-// g_main_loop_quit(event_loop);
}
-
static const char *_mapping_service_state(telephony_network_service_state_e service_state)
{
switch (service_state) {
}
}
+static const char *_mapping_name_option(telephony_network_name_option_e option)
+{
+ switch (option) {
+ case TELEPHONY_NETWORK_NAME_OPTION_NETWORK:
+ return "By network";
+ case TELEPHONY_NETWORK_NAME_OPTION_SPN:
+ return "By SPN";
+ case TELEPHONY_NETWORK_NAME_OPTION_ANY:
+ return "By both";
+ default:
+ return "Unknown priority";
+ }
+}
+
+static const char *_mapping_ps_type(telephony_network_ps_type_e ps_type)
+{
+ switch (ps_type) {
+ case TELEPHONY_NETWORK_PS_TYPE_HSDPA:
+ return "HSDPA";
+ case TELEPHONY_NETWORK_PS_TYPE_HSUPA:
+ return "HSUPA";
+ case TELEPHONY_NETWORK_PS_TYPE_HSPA:
+ return "HSPA";
+ case TELEPHONY_NETWORK_PS_TYPE_HSPAP:
+ return "HSPAP";
+ default:
+ return "Unknown";
+ }
+}
+
+static const char *_mapping_default_data_sub(telephony_network_default_data_subs_e default_data_sub)
+{
+ switch (default_data_sub) {
+ case TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_SIM1:
+ return "SIM1";
+ case TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_SIM2:
+ return "SIM2";
+ case TELEPHONY_NETWORK_DEFAULT_DATA_SUBS_UNKNOWN:
+ return "Unknown";
+ default:
+ return "Unavailable";
+ }
+}
+
+static const char *_mapping_default_sub(telephony_network_default_subs_e default_sub)
+{
+ switch (default_sub) {
+ case TELEPHONY_NETWORK_DEFAULT_SUBS_SIM1:
+ return "SIM1";
+ case TELEPHONY_NETWORK_DEFAULT_SUBS_SIM2:
+ return "SIM2";
+ case TELEPHONY_NETWORK_DEFAULT_SUBS_UNKNOWN:
+ return "Unknown";
+ default:
+ return "Unavailable";
+ }
+}
+
static const char *_mapping_network_type(telephony_network_type_e network_type)
{
switch (network_type) {
case TELEPHONY_NOTI_NETWORK_SIGNALSTRENGTH_LEVEL:
LOGI("Noti!!! Signal strength: [%d]", *(int *)data);
break;
+ case TELEPHONY_NOTI_NETWORK_NETWORK_NAME:
+ LOGI("Noti!!! Network Name: [%s]", *(int *)data);
+ break;
+ case TELEPHONY_NOTI_NETWORK_PS_TYPE:
+ LOGI("Noti!!! PS Type: [%s]", _mapping_ps_type(*(int *)data));
+ break;
+ case TELEPHONY_NOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION:
+ LOGI("Noti!!! Default Data Subscription: [%d]", *(int *)data);
+ break;
+ case TELEPHONY_NOTI_NETWORK_DEFAULT_SUBSCRIPTION:
+ LOGI("Noti!!! Default Subscription: [%d]", *(int *)data);
+ break;
default:
LOGE("Unknown noti");
break;
}
-// g_main_loop_quit(event_loop);
}
static const char *_mapping_call_state(telephony_call_state_e call_state)
}
}
+static const char *_mapping_preferred_voice_sub(telephony_call_preferred_voice_subs_e call_sub)
+{
+ switch (call_sub) {
+ case TELEPHONY_CALL_PREFERRED_VOICE_SUBS_CURRENT_NETWORK:
+ return "CURRENT_NETWORK";
+ case TELEPHONY_CALL_PREFERRED_VOICE_SUBS_ASK_ALWAYS:
+ return "ASK_ALWAYS";
+ case TELEPHONY_CALL_PREFERRED_VOICE_SUBS_SIM1:
+ return "SIM1";
+ case TELEPHONY_CALL_PREFERRED_VOICE_SUBS_SIM2:
+ return "SIM2";
+ case TELEPHONY_CALL_PREFERRED_VOICE_SUBS_UNKNOWN:
+ default:
+ return "Unknown";
+ }
+}
+
static void call_noti_cb(telephony_h handle, telephony_noti_e noti_id, void *data, void *user_data)
{
+ int ret_value;
+ telephony_call_h *call_list;
+ unsigned int count = 0;
+
+ if (noti_id == TELEPHONY_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION) {
+ LOGI("Noti!!! Preferred Voice Subscription: [%d]", *(int *)data);
+ return;
+ }
+
switch (noti_id) {
- case TELEPHONY_NOTI_VOICE_CALL_STATE:
- LOGI("Noti!!! Voice Call state: [%s]", _mapping_call_state(*(int *)data));
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_IDLE:
+ LOGI("Noti!!! Voice Call Status Idle!!! [%d]", *(int *)data);
+ break;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_ACTIVE:
+ LOGI("Noti!!! Voice Call Status Active!!! [%d]", *(int *)data);
+ break;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_HELD:
+ LOGI("Noti!!! Voice Call Status Held!!! [%d]", *(int *)data);
+ break;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_DIALING:
+ LOGI("Noti!!! Voice Call Status Dialing!!! [%d]", *(int *)data);
+ break;
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_ALERTING:
+ LOGI("Noti!!! Voice Call Status Alerting!!! [%d]", *(int *)data);
break;
- case TELEPHONY_NOTI_VIDEO_CALL_STATE:
- LOGI("Noti!!! Video Call state: [%s]", _mapping_call_state(*(int *)data));
+ case TELEPHONY_NOTI_VOICE_CALL_STATUS_INCOMING:
+ LOGI("Noti!!! Voice Call Status Incoming!!! [%d]", *(int *)data);
break;
default:
LOGE("Unknown noti");
break;
}
-// g_main_loop_quit(event_loop);
+ ret_value = telephony_call_get_call_list(handle_list.handle[0], &count, &call_list);
+ if (ret_value != TELEPHONY_ERROR_NONE) {
+ LOGE("telephony_call_get_call_list() failed!!!zz [0x%x]", ret_value);
+ } else {
+ int i;
+ unsigned int handle_id = 0;
+ char *number = NULL;
+ telephony_call_type_e type = 0;
+ telephony_call_status_e status = 0;
+ telephony_call_direction_e direction = 0;
+ bool conf_status = 0;
+
+ for (i = 0; i < count; i++) {
+ telephony_call_get_handle_id(call_list[i], &handle_id);
+ telephony_call_get_number(call_list[i], &number);
+ telephony_call_get_type(call_list[i], &type);
+ telephony_call_get_status(call_list[i], &status);
+ telephony_call_get_direction(call_list[i], &direction);
+ telephony_call_get_conference_status(call_list[i], &conf_status);
+ LOGI("id[%d] number[%s] type[%s] status[%s] direction[%s] conference_status[%s]",
+ handle_id, number,
+ type == TELEPHONY_CALL_TYPE_VOICE ? "VOICE" :
+ type == TELEPHONY_CALL_TYPE_VIDEO ? "VIDEO" : "E911",
+ status == TELEPHONY_CALL_STATUS_IDLE ? "IDLE" :
+ status == TELEPHONY_CALL_STATUS_ACTIVE ? "ACTVIE" :
+ status == TELEPHONY_CALL_STATUS_HELD ? "HELD" :
+ status == TELEPHONY_CALL_STATUS_DIALING ? "DIALING" :
+ status == TELEPHONY_CALL_STATUS_ALERTING ? "ALERTING" :
+ status == TELEPHONY_CALL_STATUS_INCOMING ? "INCOMING" : "UNKNOWN",
+ direction == TELEPHONY_CALL_DIRECTION_MO ? "MO" : "MT",
+ conf_status ? "TRUE" : "FALSE");
+ free(number);
+ number = NULL;
+ }
+ telephony_call_release_call_list(count, &call_list);
+ }
+
+}
+
+static void on_telephony_state_changed_cb(telephony_state_e state, void *user_data)
+{
+ LOGI("telephony state value : [%d]", state);
}
int main()
{
- telephony_handle_list_s handle_list;
int ret_value, i;
/* SIM value */
char *msin = NULL;
char *spn = NULL;
telephony_sim_state_e sim_state = 0;
+ unsigned int app_list = 0;
char *subscriber_number = NULL;
+ char *subscriber_id = NULL;
+ bool is_changed = FALSE;
/* Network value */
int cell_id = 0;
telephony_network_rssi_e rssi = 0;
telephony_network_service_state_e service_state = 0;
telephony_network_type_e network_type = 0;
+ telephony_network_default_data_subs_e default_data_sub = 0;
+ telephony_network_default_subs_e default_sub = 0;
+ telephony_network_name_option_e network_name_option = 0;
+ telephony_network_ps_type_e ps_type = 0;
/* Call value */
telephony_call_state_e call_state = 0;
+ telephony_call_preferred_voice_subs_e call_sub = 0;
+ telephony_call_h *call_list;
+ unsigned int count = 0;
/* Modem value */
char *imei = NULL;
+ telephony_modem_power_status_e power_status = 0;
+
+ /* Ready */
+ telephony_state_e ready_state = 0;
/* Initialize handle */
ret_value = telephony_init(&handle_list);
LOGI("handle count: [%d]", handle_list.count);
/* SIM API */
+ ret_value = telephony_sim_is_changed(handle_list.handle[0], &is_changed);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGE("telephony_sim_is_changed() failed!!! [%d]", ret_value);
+ else
+ LOGI("SIM is [%s]", is_changed ? "Changed" : "Not changed");
+
ret_value = telephony_sim_get_operator(handle_list.handle[0], &operator);
if (ret_value != TELEPHONY_ERROR_NONE) {
LOGE("telephony_sim_get_operator() failed!!! [%d]", ret_value);
}
ret_value = telephony_sim_get_state(handle_list.handle[0], &sim_state);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_sim_get_state() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("SIM state is [%s]", _mapping_sim_state(sim_state));
+
+ ret_value = telephony_sim_get_application_list(handle_list.handle[0], &app_list);
+ if (ret_value != TELEPHONY_ERROR_NONE) {
+ LOGE("telephony_sim_get_type() failed!!! [%d]", ret_value);
+ } else {
+ if (app_list & TELEPHONY_SIM_APP_TYPE_SIM)
+ LOGI("Sim type [SIM]");
+ if (app_list & TELEPHONY_SIM_APP_TYPE_USIM)
+ LOGI("Sim type [USIM]");
+ if (app_list & TELEPHONY_SIM_APP_TYPE_CSIM)
+ LOGI("Sim type [CSIM]");
}
ret_value = telephony_sim_get_subscriber_number(handle_list.handle[0], &subscriber_number);
free(subscriber_number);
}
+ ret_value = telephony_sim_get_subscriber_id(handle_list.handle[0], &subscriber_id);
+ if (ret_value != TELEPHONY_ERROR_NONE) {
+ LOGE("telephony_sim_get_subscriber_id() failed!!! [%d]", ret_value);
+ } else {
+ LOGI("Subscriber ID is [%s]", subscriber_id);
+ free(subscriber_id);
+ }
+
/* Network API */
ret_value = telephony_network_get_cell_id(handle_list.handle[0], &cell_id);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_network_get_cell_id() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("Cell ID is [%d]", cell_id);
- }
ret_value = telephony_network_get_lac(handle_list.handle[0], &lac);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_network_get_lac() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("Location Area Code is [%d]", lac);
- }
ret_value = telephony_network_get_mcc(handle_list.handle[0], &mcc);
if (ret_value != TELEPHONY_ERROR_NONE) {
free(network_name);
}
+ ret_value = telephony_network_get_network_name_option(handle_list.handle[0], &network_name_option);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGE("telephony_network_get_network_name_option() failed!!! [%d]", ret_value);
+ else
+ LOGI("Network_name_option name is [%s]", _mapping_name_option(network_name_option));
+
ret_value = telephony_network_get_roaming_status(handle_list.handle[0], &roaming_status);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_network_get_roaming_status() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("Network Roaming: [%s]", roaming_status ? "ON" : "OFF");
- }
ret_value = telephony_network_get_rssi(handle_list.handle[0], &rssi);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_network_get_rssi() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("Received Signal Strength Indicator is [%d]", rssi);
- }
ret_value = telephony_network_get_service_state(handle_list.handle[0], &service_state);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_network_get_service_state() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("Network service state is [%s]", _mapping_service_state(service_state));
- }
ret_value = telephony_network_get_type(handle_list.handle[0], &network_type);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_network_get_type() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("Network type is [%s]", _mapping_network_type(network_type));
- }
+
+ ret_value = telephony_network_get_ps_type(handle_list.handle[0], &ps_type);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGE("telephony_network_get_ps_type() failed!!! [%d]", ret_value);
+ else
+ LOGI("PS type is [%s]", _mapping_ps_type(ps_type));
+
+ ret_value = telephony_network_get_default_data_subscription(handle_list.handle[0], &default_data_sub);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGE("telephony_network_get_default_data_subscription() failed!!! [%d]", ret_value);
+ else
+ LOGI("Default data subscription is [%s]", _mapping_default_data_sub(default_data_sub));
+
+ ret_value = telephony_network_get_default_subscription(handle_list.handle[0], &default_sub);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGE("telephony_network_get_default_subscription() failed!!! [%d]", ret_value);
+ else
+ LOGI("Default subscription is [%s]", _mapping_default_sub(default_sub));
/* Call API */
ret_value = telephony_call_get_voice_call_state(handle_list.handle[0], &call_state);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_call_get_voice_call_state() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("Voice Call state is [%s]", _mapping_call_state(call_state));
- }
ret_value = telephony_call_get_video_call_state(handle_list.handle[0], &call_state);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("telephony_call_get_video_call_state() failed!!! [%d]", ret_value);
- } else {
+ else
LOGI("Video Call state is [%s]", _mapping_call_state(call_state));
+
+ ret_value = telephony_call_get_preferred_voice_subscription(handle_list.handle[0], &call_sub);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGE("telephony_call_get_preferred_voice_subscription() failed!!! [%d]", ret_value);
+ else
+ LOGI("Preferred voice subscription is [%s]", _mapping_preferred_voice_sub(call_sub));
+
+ ret_value = telephony_call_get_call_list(handle_list.handle[0], &count, &call_list);
+ if (ret_value != TELEPHONY_ERROR_NONE) {
+ LOGE("telephony_call_get_call_list() failed!!! [0x%x]", ret_value);
+ } else {
+ unsigned int handle_id = 0;
+ char *number = NULL;
+ telephony_call_type_e type = 0;
+ telephony_call_status_e status = 0;
+ telephony_call_direction_e direction = 0;
+ bool conf_status = 0;
+
+ for (i = 0; i < count; i++) {
+ telephony_call_get_handle_id(call_list[i], &handle_id);
+ telephony_call_get_number(call_list[i], &number);
+ telephony_call_get_type(call_list[i], &type);
+ telephony_call_get_status(call_list[i], &status);
+ telephony_call_get_direction(call_list[i], &direction);
+ telephony_call_get_conference_status(call_list[i], &conf_status);
+ LOGI("handle_id[%d] number[%s] type[%d] status[%d] direction[%d] conf_status[%d]",
+ handle_id, number, type, status, direction, conf_status);
+ free(number);
+ number = NULL;
+ }
+ telephony_call_release_call_list(count, &call_list);
}
/* Modem API */
free(imei);
}
+ ret_value = telephony_modem_get_power_status(handle_list.handle[0], &power_status);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGE("telephony_modem_get_power_status() failed!!! [%d]", ret_value);
+ else
+ LOGI("Modem power status is [%d] (0=on,1=off,2=rst,3=low)", power_status);
+
/* set_noti_cb */
ret_value = telephony_set_noti_cb(handle_list.handle[0], TELEPHONY_NOTI_SIM_STATUS, sim_noti_cb, NULL);
if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("Set noti failed!!!");
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < (sizeof(network_noti_tbl) / sizeof(int)); i++) {
ret_value = telephony_set_noti_cb(handle_list.handle[0], network_noti_tbl[i], network_noti_cb, NULL);
if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("Set noti failed!!!");
}
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < (sizeof(call_noti_tbl) / sizeof(int)); i++) {
ret_value = telephony_set_noti_cb(handle_list.handle[0], call_noti_tbl[i], call_noti_cb, NULL);
if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("Set noti failed!!!");
}
+ ret_value = telephony_get_state(&ready_state);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGI("telephony_get_state() failed!!!");
+ else
+ LOGI("telephony_get_state() succeed ! : %s", ready_state ? "TRUE" : "FALSE");
+
+ ret_value = telephony_set_state_changed_cb(on_telephony_state_changed_cb, NULL);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGI("telephony_set_state_changed_cb() failed!!!");
+ else
+ LOGI("telephony_set_state_changed_cb() succeed!!");
+
LOGI("If telephony status is changed, then callback function will be called");
event_loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(event_loop);
if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("Unset noti failed!!!");
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < (sizeof(network_noti_tbl) / sizeof(int)); i++) {
ret_value = telephony_unset_noti_cb(handle_list.handle[0], network_noti_tbl[i]);
if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("Unset noti failed!!!");
}
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < (sizeof(call_noti_tbl) / sizeof(int)); i++) {
ret_value = telephony_unset_noti_cb(handle_list.handle[0], call_noti_tbl[i]);
if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("Unset noti failed!!!");
}
ret_value = telephony_deinit(&handle_list);
- if (ret_value != TELEPHONY_ERROR_NONE) {
+ if (ret_value != TELEPHONY_ERROR_NONE)
LOGE("Deinitialize failed!!!");
- }
+
+ ret_value = telephony_unset_state_changed_cb(on_telephony_state_changed_cb);
+ if (ret_value != TELEPHONY_ERROR_NONE)
+ LOGE("telephony_unset_state_changed_cb() failed!!!");
+ else
+ LOGD("telephony_unset_state_changed_cb() succeed!!");
return 0;
}