Fix memory crash issue
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / hardware / bt_hd.h
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  * Copyright (C) 2019 Samsung Electronics Co., Ltd. All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef ANDROID_INCLUDE_BT_HD_H
19 #define ANDROID_INCLUDE_BT_HD_H
20
21 #include <stdint.h>
22
23 __BEGIN_DECLS
24
25 /* HID Device connection states */
26 typedef enum {
27         BTHD_CONN_STATE_CONNECTED = 0,
28         BTHD_CONN_STATE_CONNECTING,
29         BTHD_CONN_STATE_DISCONNECTED,
30         BTHD_CONN_STATE_DISCONNECTING,
31         BTHD_CONN_STATE_UNKNOWN
32 } bthd_connection_state_t;
33
34 /** Callback for connection state change.
35  *  state will have one of the values from bthd_connection_state_t
36  */
37 typedef void (*bthd_connection_state_callback)(bt_bdaddr_t *bd_addr, bthd_connection_state_t state);
38
39 /** BT-HD callback structure. */
40 typedef struct {
41         /** set to sizeof(BtHdCallbacks) */
42         size_t      size;
43         bthd_connection_state_callback  connection_state_cb;
44 } bthd_callbacks_t;
45
46 /** Represents the standard BT-HD interface. */
47 typedef struct {
48
49         /** set to sizeof(BtHdInterface) */
50         size_t          size;
51
52         /**
53          * Register the BtHd callbacks
54          */
55         bt_status_t (*init)(bthd_callbacks_t* callbacks);
56
57         /** Closes the interface. */
58         void (*cleanup)(void);
59
60 } bthd_interface_t;
61 __END_DECLS
62
63 #endif /* ANDROID_INCLUDE_BT_HD_H */