Merge the code from tizen_2.4
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-ipsp-api.h
1 /*
2  * Bluetooth-frwk
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:  Paras Kumar <paras.kumar@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *              http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __BLUETOOTH_LE_IPSP_API_H
23 #define __BLUETOOTH_LE_IPSP_API_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29
30 #define IPSP_ADDRESS_LENGTH 6
31
32 #define IPSP_ERROR_NONE                 ((int)0)
33
34 #define IPSP_ERROR_BASE                 ((int)0)
35 #define IPSP_ERROR_ALREADY_INITIALIZED  ((int)IPSP_ERROR_BASE - 0x01)
36 #define IPSP_ERROR_NOT_INITIALIZED      ((int)IPSP_ERROR_BASE - 0x01)
37 #define IPSP_ERROR_NOT_PAIRED           ((int)IPSP_ERROR_BASE - 0x02)
38 #define IPSP_ERROR_INTERNAL             ((int)IPSP_ERROR_BASE - 0x03)
39 #define IPSP_ERROR_INVALID_PARAM                ((int)IPSP_ERROR_BASE - 0x04)
40 #define IPSP_ERROR_NOT_ENABLED          ((int)IPSP_ERROR_BASE - 0x05)
41 #define IPSP_ERROR_CONNECTION_FAILED    ((int)IPSP_ERROR_BASE - 0x06)
42 #define IPSP_ERROR_PERMISSION_DEINED    ((int)BLUETOOTH_ERROR_BASE - 0x07)
43
44 typedef struct {
45         int event;
46         int result;
47         void *param_data;
48         void *user_data;
49 } ipsp_event_param_t;
50
51 typedef void (*ipsp_cb_func_ptr)(int, ipsp_event_param_t *, void *);
52
53 typedef struct {
54         unsigned char addr[IPSP_ADDRESS_LENGTH];
55 } ipsp_device_address_t;
56
57 /**
58  * @fn int bluetooth_le_ipsp_init(void)
59  *
60  * @brief Initializes IPSP service and register the service to Bluez
61  *
62  * This function is a synchronous call.
63  * The IPSP Initialize request is responded by BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED event.
64  *
65  * @return  IPSP_ERROR_NONE  - Success \n
66  *              IPSP_ERROR_ALREADY_INITIALIZED - Aready Initialized \n
67  *              IPSP_ERROR_INTERNAL - Internal Error \n
68  *              IPSP_ERROR_NOT_ENABLED - Not enabled \n
69  *
70  * @exception   None
71  * @param[in]   None
72  * @remark      None
73  *
74  */
75 int bluetooth_le_ipsp_init(void);
76
77 /**
78  * @fn int bluetooth_le_ipsp_deinit(void)
79  *
80  * @brief De-Initialize IPSP service and un-register the callback
81  * The IPSP De-Initialize request is responded by BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED event.
82  *
83  * This function is a synchronous call.
84  *
85  * @return  IPSP_ERROR_NONE  - Success \n
86  *              IPSP_ERROR_NOTY_INITIALIZED - Aready Initialized \n
87  *              IPSP_ERROR_INTERNAL - Internal Error \n
88  *              IPSP_ERROR_NOT_ENABLED - Not enabled \n
89  *
90  * @remark      None
91  *
92  */
93 int bluetooth_le_ipsp_deinit(void);
94
95 /**
96  * @fn int bluetooth_le_ipsp_connect(const ipsp_device_address_t *device_address);
97  *
98  * @brief Connects to IPSP Router device. It establishes connection for 6Lowpan over LE.
99  *
100  * This function is a asynchronous call.
101  *
102  * @return       IPSP_ERROR_NONE  - Success \n
103  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
104  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth Not enabled \n
105  *
106  * @exception   None
107  * @param[in]   device_address - remote device address.
108  *
109  * @remark      None
110  * @see         bluetooth_le_ipsp_disconnect()
111  */
112 int bluetooth_le_ipsp_connect(const ipsp_device_address_t *device_address);
113
114 /**
115  * @fn int bluetooth_le_ipsp_disconnect(const ipsp_device_address_t *device_address);
116  *
117  * @brief Disconnects to IPSP Router device. It disconnects connection for 6Lowpan over LE.
118  *
119  * This function is a asynchronous call.
120  *
121  * @return       IPSP_ERROR_NONE  - Success \n
122  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
123  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth Not enabled \n
124  *
125  * @exception   None
126  * @param[in]   device_address - remote device address.
127  *
128  * @remark      None
129  * @see         bluetooth_le_ipsp_disconnect()
130  */
131 int bluetooth_le_ipsp_disconnect(const ipsp_device_address_t *device_address);
132
133
134 #ifdef __cplusplus
135 }
136 #endif
137 #endif /* __BLUETOOTH_LE_IPSP_API_H */
138