[Adapt:OAL]Implement Health Device Profile in OAL
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / include / oal-hdp.h
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
5  *
6  * Contact: Atul Kumar Rai <a.rai@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 _OAL_HDP_H_
23 #define _OAL_HDP_H_
24
25 #include <glib.h>
26 #include <sys/types.h>
27
28 #include <oal-manager.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 typedef enum {
35         OAL_HDP_ROLE_SOURCE,
36         OAL_HDP_ROLE_SINK
37 } oal_hdp_role_t;
38
39 typedef enum {
40         OAL_CHANNEL_TYPE_RELIABLE,
41         OAL_CHANNEL_TYPE_STREAMING,
42         OAL_CHANNEL_TYPE_ANY
43 } oal_channel_type_t;
44
45 /**
46  * @brief Initialize Health Device Profile
47  *
48  * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
49  * @retval #OAL_STATUS_SUCCESS  Successful
50  *
51  * @pre OAL API must be initialized with oal_bt_init().
52  *
53  * @see  hdp_cleanup()
54  */
55 oal_status_t hdp_init(void);
56
57
58 /**
59  * @brief Cleanup Health Device Profile
60  *
61  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
62  * @retval #OAL_STATUS_SUCCESS  Successful
63  *
64  * @pre HDP should be initialized with hdp_init().
65  *
66  * @see  hdp_init()
67  */
68 oal_status_t hdp_cleanup(void);
69
70 /**
71  * @brief Register HDP application
72  *
73  * @details  Result will be notified through an OAL event
74  *
75  * @param[in] role: HDP application role (SOURCE/SINK)
76  * @param[in] channel_type: HDP application channel type (RELIABLE/STREAMMING/ANY)
77  * @param[in] name: Application name
78  * @param[in] data_type: Data type supported by HDP application
79  * @return Registered application app_id >= 0 on success, otherwise a negative value.
80  * @remark None
81  *
82  * @pre HDP should be initialized with hdp_init().
83  *
84  * @see  OAL_EVENT_HDP_APP_REGISTERED
85  */
86 int hdp_register_application(oal_hdp_role_t role,
87         oal_channel_type_t channel_type, const char *name, int data_type);
88
89 /**
90  * @brief Un-register HDP application
91  *
92  * @details  Result will be notified through an OAL event
93  *
94  * @param[in] app_id: HDP application id to be unregistered
95  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
96  * @retval #OAL_STATUS_SUCCESS  Successful
97  * @remark None
98  *
99  * @pre HDP should be initialized with hdp_init().
100  *
101  * @see  OAL_EVENT_HDP_APP_UNREGISTERED
102  */
103 oal_status_t hdp_unregister_application(int app_id);
104
105 /**
106  * @brief Connec HDP channel
107  *
108  * @details  Result will be notified through an OAL event
109  *
110  * @pre HDP should be initialized with hdp_init().
111  *
112  * @param[in]   app_id HDP application id for which channel to be connected
113  * @param[in]   addresss Remote HDP device address
114  * @return Connected channel_id on success, otherwise a negative value.
115  * @remark None
116  *
117  * @see  OAL_EVENT_HDP_CHANNEL_CONNECTED
118  */
119 int hdp_connect_channel(int app_id, bt_address_t *address);
120
121 /**
122  * @brief Disconnect hdp channel
123  *
124  * @details  Result will be notified through an OAL event
125  *
126  * @pre HDP should be initialized with hdp_init().
127  *
128  * @param[in]   channel_id HDP channel id to be disconnected
129  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
130  * @retval #OAL_STATUS_SUCCESS  Successful
131  * @remark      None
132  *
133  * @see  OAL_EVENT_HDP_CHANNEL_DESTROYED
134  */
135 oal_status_t hdp_disconnect_channel(int channel_id);
136
137 #ifdef __cplusplus
138 }
139 #endif /* __cplusplus */
140 #endif /* _OAL_HDP_H_ */