1 /* 2 * Copyright (c) 2017 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef __MODEL_SRV_H__ 8 #define __MODEL_SRV_H__ 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 struct bt_mesh_gen_onoff_srv { 15 struct bt_mesh_model *model; 16 17 int (*get)(struct bt_mesh_model *model, u8_t *state); 18 int (*set)(struct bt_mesh_model *model, u8_t state); 19 }; 20 21 extern const struct bt_mesh_model_op gen_onoff_srv_op[]; 22 extern const struct bt_mesh_model_cb gen_onoff_srv_cb; 23 24 #define BT_MESH_MODEL_GEN_ONOFF_SRV(srv, pub) \ 25 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_ONOFF_SRV, \ 26 gen_onoff_srv_op, pub, srv, &gen_onoff_srv_cb) 27 28 struct bt_mesh_gen_level_srv { 29 struct bt_mesh_model *model; 30 31 int (*get)(struct bt_mesh_model *model, s16_t *level); 32 int (*set)(struct bt_mesh_model *model, s16_t level); 33 }; 34 35 extern const struct bt_mesh_model_op gen_level_srv_op[]; 36 extern const struct bt_mesh_model_cb gen_level_srv_cb; 37 38 #define BT_MESH_MODEL_GEN_LEVEL_SRV(srv, pub) \ 39 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_GEN_LEVEL_SRV, \ 40 gen_level_srv_op, pub, srv, &gen_level_srv_cb) 41 42 struct bt_mesh_light_lightness_srv { 43 struct bt_mesh_model *model; 44 45 int (*get)(struct bt_mesh_model *model, s16_t *level); 46 int (*set)(struct bt_mesh_model *model, s16_t level); 47 }; 48 49 extern const struct bt_mesh_model_op light_lightness_srv_op[]; 50 extern const struct bt_mesh_model_cb light_lightness_srv_cb; 51 52 #define BT_MESH_MODEL_LIGHT_LIGHTNESS_SRV(srv, pub) \ 53 BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV, \ 54 light_lightness_srv_op, pub, srv, &light_lightness_srv_cb) 55 56 void bt_mesh_set_gen_onoff_srv_cb(int (*get)(struct bt_mesh_model *model, u8_t *state), 57 int (*set)(struct bt_mesh_model *model, u8_t state)); 58 void bt_mesh_set_gen_level_srv_cb(int (*get)(struct bt_mesh_model *model, s16_t *level), 59 int (*set)(struct bt_mesh_model *model, s16_t level)); 60 void bt_mesh_set_light_lightness_srv_cb(int (*get)(struct bt_mesh_model *model, s16_t *level), 61 int (*set)(struct bt_mesh_model *model, s16_t level)); 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 #endif /* __MODEL_SRV_H__ */ 68