summaryrefslogtreecommitdiff
path: root/src/libs/mynewt-nimble/nimble/host/mesh/include/mesh/model_cli.h
blob: f2e77a47f5d27c7486a59a7ca01e5414491b91ba (plain)
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
/*
 * Copyright (c) 2017 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef __MODEL_CLI_H__
#define __MODEL_CLI_H__

#ifdef __cplusplus
extern "C" {
#endif

struct bt_mesh_gen_model_cli {
    struct bt_mesh_model *model;

    struct k_sem          op_sync;
    u32_t                 op_pending;
    void                 *op_param;
};

extern const struct bt_mesh_model_op gen_onoff_cli_op[];
extern const struct bt_mesh_model_cb bt_mesh_gen_onoff_cli_cb;

#define BT_MESH_MODEL_GEN_ONOFF_CLI(cli_data, pub)                             \
	BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_ONOFF_CLI, gen_onoff_cli_op, pub,\
			 cli_data, &bt_mesh_gen_onoff_cli_cb)

extern const struct bt_mesh_model_op gen_level_cli_op[];
extern const struct bt_mesh_model_cb bt_mesh_gen_level_cli_cb;

#define BT_MESH_MODEL_GEN_LEVEL_CLI(cli_data, pub)                             \
	BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_LEVEL_CLI, gen_level_cli_op, pub,\
			 cli_data, &bt_mesh_gen_level_cli_cb)

int bt_mesh_gen_onoff_get(u16_t net_idx, u16_t addr, u16_t app_idx,
			  u8_t *state);
int bt_mesh_gen_onoff_set(u16_t net_idx, u16_t addr, u16_t app_idx,
			  u8_t val, u8_t *state);
int bt_mesh_gen_level_get(u16_t net_idx, u16_t addr, u16_t app_idx,
			  s16_t *level);
int bt_mesh_gen_level_set(u16_t net_idx, u16_t addr, u16_t app_idx,
			  s16_t val, s16_t *state);

#ifdef __cplusplus
}
#endif

#endif /* __MODEL_CLI_H__ */