2012-12-28 16:04:56 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* BlueZ - Bluetooth protocol stack for Linux
|
|
|
|
*
|
2014-02-12 03:04:11 +08:00
|
|
|
* Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
|
2012-12-28 16:04:56 +08:00
|
|
|
*
|
|
|
|
*
|
2013-01-02 04:35:09 +08:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2012-12-28 16:04:56 +08:00
|
|
|
*
|
2013-01-02 04:35:09 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2012-12-28 16:04:56 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2013-01-02 04:35:09 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2012-12-28 16:04:56 +08:00
|
|
|
*
|
2013-01-02 04:35:09 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2012-12-28 16:04:56 +08:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2013-01-02 04:20:38 +08:00
|
|
|
#include <stdbool.h>
|
2013-01-02 09:12:43 +08:00
|
|
|
#include <stdint.h>
|
2013-01-02 04:20:38 +08:00
|
|
|
|
2012-12-28 16:04:56 +08:00
|
|
|
struct hciemu;
|
|
|
|
|
2013-02-01 04:23:58 +08:00
|
|
|
enum hciemu_type {
|
|
|
|
HCIEMU_TYPE_BREDRLE,
|
|
|
|
HCIEMU_TYPE_BREDR,
|
|
|
|
HCIEMU_TYPE_LE,
|
2015-03-30 06:15:48 +08:00
|
|
|
HCIEMU_TYPE_LEGACY,
|
2013-02-01 04:23:58 +08:00
|
|
|
};
|
|
|
|
|
2013-07-21 08:17:15 +08:00
|
|
|
enum hciemu_hook_type {
|
|
|
|
HCIEMU_HOOK_PRE_CMD,
|
|
|
|
HCIEMU_HOOK_POST_CMD,
|
|
|
|
HCIEMU_HOOK_PRE_EVT,
|
|
|
|
HCIEMU_HOOK_POST_EVT,
|
|
|
|
};
|
|
|
|
|
2013-02-01 04:23:58 +08:00
|
|
|
struct hciemu *hciemu_new(enum hciemu_type type);
|
2012-12-28 16:04:56 +08:00
|
|
|
|
|
|
|
struct hciemu *hciemu_ref(struct hciemu *hciemu);
|
|
|
|
void hciemu_unref(struct hciemu *hciemu);
|
|
|
|
|
2013-05-29 15:13:56 +08:00
|
|
|
struct bthost *hciemu_client_get_host(struct hciemu *hciemu);
|
|
|
|
|
2012-12-28 16:04:56 +08:00
|
|
|
const char *hciemu_get_address(struct hciemu *hciemu);
|
2013-08-01 17:53:45 +08:00
|
|
|
uint8_t *hciemu_get_features(struct hciemu *hciemu);
|
2013-01-02 04:20:38 +08:00
|
|
|
|
2013-05-26 11:25:44 +08:00
|
|
|
const uint8_t *hciemu_get_master_bdaddr(struct hciemu *hciemu);
|
|
|
|
const uint8_t *hciemu_get_client_bdaddr(struct hciemu *hciemu);
|
|
|
|
|
2015-11-16 18:26:13 +08:00
|
|
|
uint8_t hciemu_get_master_scan_enable(struct hciemu *hciemu);
|
|
|
|
|
2015-11-16 18:22:46 +08:00
|
|
|
uint8_t hciemu_get_master_le_scan_enable(struct hciemu *hciemu);
|
2015-11-11 14:36:26 +08:00
|
|
|
|
2018-02-10 01:26:25 +08:00
|
|
|
void hciemu_set_master_le_states(struct hciemu *hciemu,
|
|
|
|
const uint8_t *le_states);
|
|
|
|
|
2013-01-02 04:20:38 +08:00
|
|
|
typedef void (*hciemu_command_func_t)(uint16_t opcode, const void *data,
|
|
|
|
uint8_t len, void *user_data);
|
|
|
|
|
2013-07-21 08:17:15 +08:00
|
|
|
typedef bool (*hciemu_hook_func_t)(const void *data, uint16_t len,
|
|
|
|
void *user_data);
|
|
|
|
|
2013-01-02 04:20:38 +08:00
|
|
|
bool hciemu_add_master_post_command_hook(struct hciemu *hciemu,
|
|
|
|
hciemu_command_func_t function, void *user_data);
|
2013-07-21 08:17:15 +08:00
|
|
|
|
2016-09-02 17:25:50 +08:00
|
|
|
bool hciemu_clear_master_post_command_hooks(struct hciemu *hciemu);
|
|
|
|
|
2013-07-21 08:17:15 +08:00
|
|
|
int hciemu_add_hook(struct hciemu *hciemu, enum hciemu_hook_type type,
|
|
|
|
uint16_t opcode, hciemu_hook_func_t function,
|
|
|
|
void *user_data);
|
2013-07-21 08:17:16 +08:00
|
|
|
|
|
|
|
bool hciemu_del_hook(struct hciemu *hciemu, enum hciemu_hook_type type,
|
|
|
|
uint16_t opcode);
|