7e61402c67539880b936ccf482a0c72f4b247d89
[platform/core/connectivity/bluetooth-frwk.git] / bt-core / include / bt-core-adapter.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
18 #ifndef _BT_CORE_ADAPTER_H_
19 #define _BT_CORE_ADAPTER_H_
20
21 #include <sys/types.h>
22 #include <sys/wait.h>
23 #include <dlog.h>
24 #include <glib.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #define CONNMAN_DBUS_NAME "net.connman"
31 #define CONNMAN_BLUETOOTH_TECHNOLOGY_PATH "/net/connman/technology/bluetooth"
32 #define CONNMAN_BLUETOTOH_TECHNOLOGY_INTERFACE "net.connman.Technology"
33
34 #define BT_CORE_NAME "org.projectx.bt_core"
35 #define BT_CORE_PATH "/org/projectx/bt_core"
36
37 #define BT_SYSTEMACT_HCI_LOGGER_START "/run/.hci_logger_start"
38 #define BT_SYSTEMACT_HCI_LOGGER_STOP "/run/.hci_logger_stop"
39 #define BT_SYSTEMACT_HCI_UP "/run/.hci_up"
40 #define BT_SYSTEMACT_HCI_DOWN "/run/.hci_down"
41 #define BT_SYSTEMACT_BLUEZ_START "/run/.bluez_start"
42 #define BT_SYSTEMACT_BLUETOOTH_SHARE_START "/run/.bluetooth_share_start"
43 #define BT_SYSTEMACT_RFKILL_UNBLOCK "/run/.rfkill_unblock"
44 #define BT_SYSTEMACT_RFKILL_BLOCK "/run/.rfkill_block"
45 #define BT_SYSTEMACT_STACK_DOWN "/run/.bt_stack_down"
46 #define BT_SYSTEMACT_STACK_DOWN_WITH_RADIO "/run/.bt_stack_down_with_radio"
47 #define BT_SYSTEMACT_BT_DRIVER_INSMOD "/run/.bt_driver_insmod"
48
49 #define BT_CORE_TYPE (bt_core_get_type())
50
51 typedef enum {
52         BT_DEACTIVATED,
53         BT_ACTIVATED,
54         BT_ACTIVATING,
55         BT_DEACTIVATING,
56 } bt_status_t;
57
58 typedef enum {
59         BT_LE_DEACTIVATED,
60         BT_LE_ACTIVATED,
61         BT_LE_ACTIVATING,
62         BT_LE_DEACTIVATING,
63 } bt_le_status_t;
64
65 typedef enum {
66         BT_POWER_SAVING_MODE,
67         BT_FLIGHT_MODE,
68         BT_RECOVERY_MODE,
69         BT_MODE_MAX
70 } bt_mode_e;
71
72 bt_status_t _bt_core_get_status(void);
73 bt_le_status_t _bt_core_get_le_status(void);
74 int _bt_core_get_bt_status(bt_mode_e mode);                     /* Get the status of BT before passed mode */
75 int _bt_core_get_bt_le_status(bt_mode_e mode);                  /* Get the status of BT LE before passed mode */
76 void _bt_core_set_bt_status(bt_mode_e mode, int status);        /* Set the status of BT before passed mode */
77 void _bt_core_set_bt_le_status(bt_mode_e mode, int status);     /* Set the status of BT LE before passed mode */
78
79 gboolean _bt_core_is_recovery_mode(void);
80 gboolean _bt_core_is_flight_mode_enabled(void);
81
82 int _bt_enable_adapter(void);
83 int _bt_disable_adapter(void);
84 int _bt_enable_adapter_le(void);
85 int _bt_disable_adapter_le(void);
86 int _bt_core_service_request_adapter(int service_function);
87
88 void _bt_core_adapter_added_cb(void);
89 void _bt_core_adapter_removed_cb(void);
90
91 gboolean _bt_core_enable_adapter(void);
92 gboolean _bt_core_disable_adapter(void);
93 gboolean _bt_core_recover_adapter(void);
94 gboolean _bt_core_enable_adapter_le(void);
95 gboolean _bt_core_disable_adapter_le(void);
96 gboolean __bt_core_reset_adapter(void);
97 gboolean _bt_core_enable_core(void);
98 gboolean _bt_core_set_transfer_value(gboolean value);
99 gboolean _bt_core_factory_test_mode(const char *type, const char *arg);
100
101 void _bt_core_update_status(void);
102
103 #ifdef __cplusplus
104 }
105 #endif /* __cplusplus */
106 #endif /*_BT_CORE_ADAPTER_H_*/