3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #define MGMT_VERSION(v, r) (((v) << 16) + (r))
29 typedef void (*mgmt_destroy_func_t)(void *user_data);
33 struct mgmt *mgmt_new(int fd);
34 struct mgmt *mgmt_new_default(void);
36 struct mgmt *mgmt_ref(struct mgmt *mgmt);
37 void mgmt_unref(struct mgmt *mgmt);
39 typedef void (*mgmt_debug_func_t)(const char *str, void *user_data);
41 bool mgmt_set_debug(struct mgmt *mgmt, mgmt_debug_func_t callback,
42 void *user_data, mgmt_destroy_func_t destroy);
44 bool mgmt_set_close_on_unref(struct mgmt *mgmt, bool do_close);
46 typedef void (*mgmt_request_func_t)(uint8_t status, uint16_t length,
47 const void *param, void *user_data);
49 unsigned int mgmt_send(struct mgmt *mgmt, uint16_t opcode, uint16_t index,
50 uint16_t length, const void *param,
51 mgmt_request_func_t callback,
52 void *user_data, mgmt_destroy_func_t destroy);
53 unsigned int mgmt_send_nowait(struct mgmt *mgmt, uint16_t opcode, uint16_t index,
54 uint16_t length, const void *param,
55 mgmt_request_func_t callback,
56 void *user_data, mgmt_destroy_func_t destroy);
57 unsigned int mgmt_reply(struct mgmt *mgmt, uint16_t opcode, uint16_t index,
58 uint16_t length, const void *param,
59 mgmt_request_func_t callback,
60 void *user_data, mgmt_destroy_func_t destroy);
61 bool mgmt_cancel(struct mgmt *mgmt, unsigned int id);
62 bool mgmt_cancel_index(struct mgmt *mgmt, uint16_t index);
63 bool mgmt_cancel_all(struct mgmt *mgmt);
65 typedef void (*mgmt_notify_func_t)(uint16_t index, uint16_t length,
66 const void *param, void *user_data);
68 unsigned int mgmt_register(struct mgmt *mgmt, uint16_t event, uint16_t index,
69 mgmt_notify_func_t callback,
70 void *user_data, mgmt_destroy_func_t destroy);
71 bool mgmt_unregister(struct mgmt *mgmt, unsigned int id);
72 bool mgmt_unregister_index(struct mgmt *mgmt, uint16_t index);
73 bool mgmt_unregister_all(struct mgmt *mgmt);