Android Hardware Abstraction Layer
bt_hl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
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 #ifndef ANDROID_INCLUDE_BT_HL_H
18 #define ANDROID_INCLUDE_BT_HL_H
19 
20 __BEGIN_DECLS
21 
22 /* HL connection states */
23 
24 typedef enum
25 {
29 
30 typedef enum {
36 
37 typedef enum
38 {
43 
44 
45 /* HL connection states */
46 typedef enum {
53 
54 typedef struct
55 {
57  int data_type;
59  const char *mdep_description; /* MDEP description to be used in the SDP (optional); null terminated */
61 
62 typedef struct
63 {
64  const char *application_name;
65  const char *provider_name; /* provider name to be used in the SDP (optional); null terminated */
66  const char *srv_name; /* service name to be used in the SDP (optional); null terminated*/
67  const char *srv_desp; /* service description to be used in the SDP (optional); null terminated */
69  bthl_mdep_cfg_t *mdep_cfg; /* Dynamic array */
71 
72 /** Callback for application registration status.
73  * state will have one of the values from bthl_app_reg_state_t
74  */
75 typedef void (* bthl_app_reg_state_callback)(int app_id, bthl_app_reg_state_t state);
76 
77 /** Callback for channel connection state change.
78  * state will have one of the values from
79  * bthl_connection_state_t and fd (file descriptor)
80  */
81 typedef void (* bthl_channel_state_callback)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int channel_id, bthl_channel_state_t state, int fd);
82 
83 /** BT-HL callback structure. */
84 typedef struct {
85  /** set to sizeof(bthl_callbacks_t) */
86  size_t size;
90 
91 
92 /** Represents the standard BT-HL interface. */
93 typedef struct {
94 
95  /** set to sizeof(bthl_interface_t) */
96  size_t size;
97 
98  /**
99  * Register the Bthl callbacks
100  */
101  bt_status_t (*init)( bthl_callbacks_t* callbacks );
102 
103  /** Register HL application */
104  bt_status_t (*register_application) ( bthl_reg_param_t *p_reg_param, int *app_id);
105 
106  /** Unregister HL application */
107  bt_status_t (*unregister_application) (int app_id);
108 
109  /** connect channel */
110  bt_status_t (*connect_channel)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int *channel_id);
111 
112  /** destroy channel */
113  bt_status_t (*destroy_channel)(int channel_id);
114 
115  /** Close the Bthl callback **/
116  void (*cleanup)(void);
117 
119 __END_DECLS
120 
121 #endif /* ANDROID_INCLUDE_BT_HL_H */
122 
123