2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __CAPI_TELEPHONY_COMMON_H__
18 #define __CAPI_TELEPHONY_COMMON_H__
21 * @file telephony_common.h
22 * @brief This file contains telephony common APIs and related enumerations.
32 * @file telephony_common.h
33 * @brief This file contains the common information APIs.
37 * @addtogroup CAPI_TELEPHONY_INFORMATION
42 * @brief The Telephony API handle.
45 typedef struct telephony_data *telephony_h;
48 * @brief The structure type for the list of handles to use the Telephony API.
49 * @remarks There are two handles in case of dual SIM device. \n
50 * In this case, handle[0] is mean Primary SIM and handle[1] is mean Secondary SIM.
54 unsigned int count; /**< Number of available handle */
55 telephony_h *handle; /**< Handle to use Telephony API */
56 } telephony_handle_list_s;
59 * @brief Enumeration for Telephony error.
63 TELEPHONY_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
64 TELEPHONY_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
65 TELEPHONY_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
66 TELEPHONY_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
67 TELEPHONY_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
68 TELEPHONY_ERROR_OPERATION_FAILED = TIZEN_ERROR_TELEPHONY | 0x0001, /**< Operation failed */
69 TELEPHONY_ERROR_SIM_NOT_AVAILABLE = TIZEN_ERROR_TELEPHONY | 0x1001, /**< SIM is not available */
73 * @brief Enumeration for Telephony notification.
77 TELEPHONY_NOTI_SIM_STATUS = 0x10, /**< Notification to be invoked when the SIM card state changes */
79 TELEPHONY_NOTI_NETWORK_SERVICE_STATE = 0x20, /**< Notification to be invoked when the network service state changes */
80 TELEPHONY_NOTI_NETWORK_CELLID, /**< Notification to be invoked when the cell ID changes */
81 TELEPHONY_NOTI_NETWORK_ROAMING_STATUS, /**< Notification to be invoked when the roaming status changes */
82 TELEPHONY_NOTI_NETWORK_SIGNALSTRENGTH_LEVEL, /**< Notification to be invoked when the signal strength changes */
84 TELEPHONY_NOTI_VOICE_CALL_STATE = 0x30, /**< Notification to be invoked when the voice call state changes */
85 TELEPHONY_NOTI_VIDEO_CALL_STATE /**< Notification to be invoked when the video call state changes */
89 * @brief Called when the telephony state changes.
92 typedef void (*telephony_noti_cb)(telephony_h handle, telephony_noti_e noti_id, void *data, void *user_data);
95 * @brief Sets a callback function to be invoked when the telephony state changes.
99 * @privilege %http://tizen.org/privilege/telephony
101 * @param[in] handle The handle to use the telephony API
102 * @param[in] noti_id The notification ID to set the callback
103 * @param[in] cb The callback to be invoked when the telephony state changes
104 * @param[in] user_data The user data passed to the callback function
106 * @return @c 0 on success,
107 * otherwise a negative error value
109 * @retval #TELEPHONY_ERROR_NONE Successful
110 * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
111 * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
112 * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
113 * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
115 * @post telephony_noti_cb() will be invoked.
117 * @see telephony_unset_noti_cb()
119 int telephony_set_noti_cb(telephony_h handle,
120 telephony_noti_e noti_id, telephony_noti_cb cb, void *user_data);
123 * @brief Unsets a callback function.
127 * @privilege %http://tizen.org/privilege/telephony
129 * @param[in] handle The handle to use the telephony API
130 * @param[in] noti_id The notification ID to unset a callback
132 * @return @c 0 on success,
133 * otherwise a negative error value
135 * @retval #TELEPHONY_ERROR_NONE Successful
136 * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
137 * @retval #TELEPHONY_ERROR_PERMISSION_DENIED Permission denied
138 * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
139 * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
141 * @see telephony_set_noti_cb()
143 int telephony_unset_noti_cb(telephony_h handle, telephony_noti_e noti_id);
146 * @brief Acquires the list of available handles to use the telephony API.
150 * @remarks You will get two handles in case of dual SIM device. \n
151 * In this case, handle[0] is mean Primary SIM and handle[1] is mean Secondary SIM.
153 * @param[out] list The list contains the number of
154 * available handles and array of handles
156 * @return @c 0 on success,
157 * otherwise a negative error value
159 * @retval #TELEPHONY_ERROR_NONE Successful
160 * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
161 * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
162 * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
164 * @see telephony_deinit()
166 int telephony_init(telephony_handle_list_s *list);
169 * @brief Deinitializes the telephony handle list.
173 * @param[in] list The handle list to be deinitialized
175 * @return @c 0 on success,
176 * otherwise a negative error value
178 * @retval #TELEPHONY_ERROR_NONE Successful
179 * @retval #TELEPHONY_ERROR_INVALID_PARAMETER Invalid parameter
180 * @retval #TELEPHONY_ERROR_NOT_SUPPORTED Not supported
181 * @retval #TELEPHONY_ERROR_OPERATION_FAILED Operation failed
183 * @see telephony_init()
185 int telephony_deinit(telephony_handle_list_s *list);
195 #endif /* __CAPI_TELEPHONY_COMMON_H__ */