Blob: model.h

Blob id: 5e20719b29c6621a27191e999cdb9dbb88047868

Size: 1.3 KB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 *
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2019  Intel Corporation. All rights reserved.
 *
 *
 */

#define VENDOR_ID_INVALID	0xFFFF

typedef bool (*model_send_msg_func_t) (void *user_data, uint16_t dst,
				uint16_t app_idx, uint8_t *data, uint16_t len);
typedef bool (*model_send_pub_func_t) (void *user_data, uint16_t vendor_id,
				uint16_t mod_id, uint8_t *data, uint16_t len);
typedef bool (*model_set_send_func_t)(model_send_msg_func_t func,
							void *user_data);
typedef bool (*model_set_pub_func_t)(model_send_pub_func_t func,
							void *user_data);

typedef bool (*model_recv_func_t)(uint16_t src, uint16_t app_idx,
						uint8_t *data, uint16_t len);
typedef int (*model_bind_func_t)(uint16_t app_idx, int action);

struct model_pub {
	uint16_t app_idx;
	uint16_t period;
	union {
		uint16_t addr;
		uint8_t label[16];
	} u;
	bool cred;
	uint32_t prd_res;
	uint16_t rtx_interval;
	uint8_t prd_steps;
	uint8_t rtx_cnt;
	uint8_t ttl;
};

typedef int (*model_pub_func_t)(struct model_pub *pub);

struct model_ops {
	model_set_send_func_t set_send_func;
	model_set_pub_func_t set_pub_func;
	model_recv_func_t recv;
	model_bind_func_t bind;
	model_pub_func_t pub;
};

struct model_info {
	struct model_ops ops;
	uint16_t mod_id;
	uint16_t vendor_id;
};