2 * Copyright (C) 2012 The Android Open Source Project
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.
17 #ifndef ANDROID_INCLUDE_BT_PAN_H
18 #define ANDROID_INCLUDE_BT_PAN_H
22 #define BTPAN_ROLE_NONE 0
23 #define BTPAN_ROLE_PANNAP 1
24 #define BTPAN_ROLE_PANU 2
27 BTPAN_STATE_CONNECTED
= 0,
28 BTPAN_STATE_CONNECTING
= 1,
29 BTPAN_STATE_DISCONNECTED
= 2,
30 BTPAN_STATE_DISCONNECTING
= 3
31 } btpan_connection_state_t
;
34 BTPAN_STATE_ENABLED
= 0,
35 BTPAN_STATE_DISABLED
= 1
36 } btpan_control_state_t
;
39 * Callback for pan connection state
41 typedef void (*btpan_connection_state_callback
)(btpan_connection_state_t state
, bt_status_t error
,
42 const bt_bdaddr_t
*bd_addr
, int local_role
, int remote_role
);
43 typedef void (*btpan_control_state_callback
)(btpan_control_state_t state
, bt_status_t error
,
44 int local_role
, const char* ifname
);
48 btpan_control_state_callback control_state_cb
;
49 btpan_connection_state_callback connection_state_cb
;
52 /** set to size of this struct*/
55 * Initialize the pan interface and register the btpan callbacks
57 bt_status_t (*init
)(const btpan_callbacks_t
* callbacks
);
59 * enable the pan service by specified role. The result state of
60 * enabl will be returned by btpan_control_state_callback. when pan-nap is enabled,
61 * the state of connecting panu device will be notified by btpan_connection_state_callback
63 bt_status_t (*enable
)(int local_role
);
65 * get current pan local role
67 int (*get_local_role
)(void);
69 * start bluetooth pan connection to the remote device by specified pan role. The result state will be
70 * returned by btpan_connection_state_callback
72 bt_status_t (*connect
)(const bt_bdaddr_t
*bd_addr
, int local_role
, int remote_role
);
74 * stop bluetooth pan connection. The result state will be returned by btpan_connection_state_callback
76 bt_status_t (*disconnect
)(const bt_bdaddr_t
*bd_addr
);
79 * Cleanup the pan interface
81 void (*cleanup
)(void);
87 #endif /* ANDROID_INCLUDE_BT_PAN_H */