tizen 2.4 release
[framework/api/telephony.git] / include / telephony_private.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __CAPI_TELEPHONY_PRIVATE_H__
18 #define __CAPI_TELEPHONY_PRIVATE_H__
19
20 #include <gio/gio.h>
21 #include <glib.h>
22 #include <system_info.h>
23 #include "telephony_common.h"
24 #include "telephony_call.h"
25
26 #define TELEPHONY_FEATURE       "http://tizen.org/feature/network.telephony"
27
28 #ifdef LOG_TAG
29 #undef LOG_TAG
30 #endif
31 #define LOG_TAG "CAPI_TELEPHONY"
32
33 #define CHECK_INPUT_PARAMETER(arg) \
34         if (arg == NULL) { \
35                 LOGE("INVALID_PARAMETER"); \
36                 return TELEPHONY_ERROR_INVALID_PARAMETER; \
37         }
38
39 #define CHECK_TELEPHONY_SUPPORTED(feature_name) { \
40         bool telephony_supported = FALSE; \
41         if (!system_info_get_platform_bool(feature_name, &telephony_supported)) { \
42                 if (telephony_supported == FALSE) { \
43                         LOGE("telephony feature is disabled"); \
44                         return TELEPHONY_ERROR_NOT_SUPPORTED; \
45                 } \
46         } else { \
47                 LOGE("Error - Feature getting from System Info"); \
48                 return TELEPHONY_ERROR_OPERATION_FAILED; \
49         } \
50 }
51
52 /**
53  * @brief Definition for the max length of call number
54  * @since_tizen 2.4
55  */
56 #define TELEPHONY_CALL_NUMBER_LEN_MAX 82
57
58 typedef struct {
59         GSList *evt_list;
60         struct tapi_handle *tapi_h;
61 } telephony_data;
62
63 /*
64  * Need to define the struct same as tapi_handle of libslp-tapi
65  * because we are request dbus directly using dbus_connection, path
66  */
67 struct tapi_handle {
68         gpointer dbus_connection;
69         char *path;
70         char *cp_name;
71         GHashTable *evt_list;
72         char cookie[20];
73         GCancellable *ca;
74
75         GHashTable *cache_property;
76         guint prop_callback_evt_id;
77 };
78
79 /**
80  * @brief The structure type for the call information.
81  * @since_tizen 2.4
82  */
83 typedef struct {
84         unsigned int id; /**< The handle of the call */
85         char number[TELEPHONY_CALL_NUMBER_LEN_MAX + 1]; /**< Calling number */
86         telephony_call_type_e type; /**< Type of call (voice, video, emergency) */
87         telephony_call_status_e status; /**< Call Status */
88         telephony_call_direction_e direction; /**< Call direction (MO, MT) */
89         bool conference_status; /**< true: Conference call, false: Single call */
90 } telephony_call_info_s;
91
92 #endif /* __CAPI_TELEPHONY_PRIVATE_H__ */