2 * Copyright (c) 2015 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.
18 #ifndef __BLUETOOTH_LE_IPSP_API_H
19 #define __BLUETOOTH_LE_IPSP_API_H
26 #define IPSP_ADDRESS_LENGTH 6
28 #define IPSP_ERROR_NONE ((int)0)
30 #define IPSP_ERROR_BASE ((int)0)
31 #define IPSP_ERROR_ALREADY_INITIALIZED ((int)IPSP_ERROR_BASE - 0x01)
32 #define IPSP_ERROR_NOT_INITIALIZED ((int)IPSP_ERROR_BASE - 0x01)
33 #define IPSP_ERROR_NOT_PAIRED ((int)IPSP_ERROR_BASE - 0x02)
34 #define IPSP_ERROR_INTERNAL ((int)IPSP_ERROR_BASE - 0x03)
35 #define IPSP_ERROR_INVALID_PARAM ((int)IPSP_ERROR_BASE - 0x04)
36 #define IPSP_ERROR_NOT_ENABLED ((int)IPSP_ERROR_BASE - 0x05)
37 #define IPSP_ERROR_CONNECTION_FAILED ((int)IPSP_ERROR_BASE - 0x06)
38 #define IPSP_ERROR_PERMISSION_DEINED ((int)BLUETOOTH_ERROR_BASE - 0x07)
47 typedef void (*ipsp_cb_func_ptr)(int, ipsp_event_param_t *, void *);
50 unsigned char addr[IPSP_ADDRESS_LENGTH];
51 } ipsp_device_address_t;
54 * @fn int bluetooth_ipsp_init(void)
56 * @brief Initializes IPSP service and register the service to Bluez
58 * This function is a synchronous call.
59 * The IPSP Initialize request is responded by BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED event.
61 * @return IPSP_ERROR_NONE - Success \n
62 * IPSP_ERROR_ALREADY_INITIALIZED - Aready Initialized \n
63 * IPSP_ERROR_INTERNAL - Internal Error \n
64 * IPSP_ERROR_NOT_ENABLED - Not enabled \n
71 int bluetooth_ipsp_init(void);
74 * @fn int bluetooth_ipsp_deinit(void)
76 * @brief De-Initialize IPSP service and un-register the callback
77 * The IPSP De-Initialize request is responded by BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED event.
79 * This function is a synchronous call.
81 * @return IPSP_ERROR_NONE - Success \n
82 * IPSP_ERROR_NOTY_INITIALIZED - Aready Initialized \n
83 * IPSP_ERROR_INTERNAL - Internal Error \n
84 * IPSP_ERROR_NOT_ENABLED - Not enabled \n
89 int bluetooth_ipsp_deinit(void);
92 * @fn int bluetooth_ipsp_connect(const ipsp_device_address_t *device_address);
94 * @brief Connects to IPSP Router device. It establishes connection for 6Lowpan over LE.
96 * This function is a asynchronous call.
98 * @return IPSP_ERROR_NONE - Success \n
99 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
100 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth Not enabled \n
103 * @param[in] device_address - remote device address.
106 * @see bluetooth_ipsp_disconnect()
108 int bluetooth_ipsp_connect(const ipsp_device_address_t *device_address);
111 * @fn int bluetooth_ipsp_disconnect(const ipsp_device_address_t *device_address);
113 * @brief Disconnects to IPSP Router device. It disconnects connection for 6Lowpan over LE.
115 * This function is a asynchronous call.
117 * @return IPSP_ERROR_NONE - Success \n
118 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
119 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth Not enabled \n
122 * @param[in] device_address - remote device address.
125 * @see bluetooth_ipsp_disconnect()
127 int bluetooth_ipsp_disconnect(const ipsp_device_address_t *device_address);
133 #endif /* __BLUETOOTH_LE_IPSP_API_H */