From 9b77b4cfcddc302612637bfc294ad5b9fe64e0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Wed, 30 Jan 2019 15:04:11 +0100 Subject: [PATCH] mesh: Add header file support for C++ Add preprocessor directive for C++ compatibility. --- nimble/host/mesh/include/mesh/access.h | 8 ++++++++ nimble/host/mesh/include/mesh/cfg_cli.h | 7 +++++++ nimble/host/mesh/include/mesh/cfg_srv.h | 7 +++++++ nimble/host/mesh/include/mesh/glue.h | 8 ++++++++ nimble/host/mesh/include/mesh/health_cli.h | 8 ++++++++ nimble/host/mesh/include/mesh/health_srv.h | 8 ++++++++ nimble/host/mesh/include/mesh/main.h | 8 ++++++++ nimble/host/mesh/include/mesh/model_cli.h | 8 ++++++++ nimble/host/mesh/include/mesh/model_srv.h | 8 ++++++++ nimble/host/mesh/include/mesh/porting.h | 8 ++++++++ nimble/host/mesh/include/mesh/proxy.h | 8 ++++++++ 11 files changed, 86 insertions(+) diff --git a/nimble/host/mesh/include/mesh/access.h b/nimble/host/mesh/include/mesh/access.h index b31b645a0..71ca34e2d 100644 --- a/nimble/host/mesh/include/mesh/access.h +++ b/nimble/host/mesh/include/mesh/access.h @@ -17,6 +17,10 @@ * @{ */ +#ifdef __cplusplus +extern "C" { +#endif + #define BT_MESH_ADDR_UNASSIGNED 0x0000 #define BT_MESH_ADDR_ALL_NODES 0xffff #define BT_MESH_ADDR_PROXIES 0xfffc @@ -408,6 +412,10 @@ struct bt_mesh_comp { struct bt_mesh_elem *elem; }; +#ifdef __cplusplus +} +#endif + /** * @} */ diff --git a/nimble/host/mesh/include/mesh/cfg_cli.h b/nimble/host/mesh/include/mesh/cfg_cli.h index cc92476ae..9d80ccda7 100644 --- a/nimble/host/mesh/include/mesh/cfg_cli.h +++ b/nimble/host/mesh/include/mesh/cfg_cli.h @@ -17,6 +17,10 @@ * @{ */ +#ifdef __cplusplus +extern "C" { +#endif + /** Mesh Configuration Client Model Context */ struct bt_mesh_cfg_cli { struct bt_mesh_model *model; @@ -219,6 +223,9 @@ int bt_mesh_cfg_hb_pub_get(u16_t net_idx, u16_t addr, s32_t bt_mesh_cfg_cli_timeout_get(void); void bt_mesh_cfg_cli_timeout_set(s32_t timeout); +#ifdef __cplusplus +} +#endif /** * @} */ diff --git a/nimble/host/mesh/include/mesh/cfg_srv.h b/nimble/host/mesh/include/mesh/cfg_srv.h index d1e9928ed..cb5d25e69 100644 --- a/nimble/host/mesh/include/mesh/cfg_srv.h +++ b/nimble/host/mesh/include/mesh/cfg_srv.h @@ -17,6 +17,10 @@ * @{ */ +#ifdef __cplusplus +extern "C" { +#endif + /** Mesh Configuration Server Model Context */ struct bt_mesh_cfg_srv { struct bt_mesh_model *model; @@ -62,6 +66,9 @@ extern const struct bt_mesh_model_op bt_mesh_cfg_srv_op[]; BT_MESH_MODEL(BT_MESH_MODEL_ID_CFG_SRV, \ bt_mesh_cfg_srv_op, NULL, srv_data) +#ifdef __cplusplus +} +#endif /** * @} diff --git a/nimble/host/mesh/include/mesh/glue.h b/nimble/host/mesh/include/mesh/glue.h index a4ada7967..8edb6c3ba 100644 --- a/nimble/host/mesh/include/mesh/glue.h +++ b/nimble/host/mesh/include/mesh/glue.h @@ -45,6 +45,10 @@ #include "config/config.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + #define u8_t uint8_t #define s8_t int8_t #define u16_t uint16_t @@ -455,4 +459,8 @@ settings_load(void) #define BUILD_ASSERT(cond) _Static_assert(cond, "") +#ifdef __cplusplus +} #endif + +#endif /* _MESH_GLUE_ */ diff --git a/nimble/host/mesh/include/mesh/health_cli.h b/nimble/host/mesh/include/mesh/health_cli.h index 8b890422e..719d621e0 100644 --- a/nimble/host/mesh/include/mesh/health_cli.h +++ b/nimble/host/mesh/include/mesh/health_cli.h @@ -17,6 +17,10 @@ * @{ */ +#ifdef __cplusplus +extern "C" { +#endif + /** Mesh Health Client Model Context */ struct bt_mesh_health_cli { struct bt_mesh_model *model; @@ -65,6 +69,10 @@ int bt_mesh_health_attention_set(u16_t net_idx, u16_t addr, u16_t app_idx, s32_t bt_mesh_health_cli_timeout_get(void); void bt_mesh_health_cli_timeout_set(s32_t timeout); +#ifdef __cplusplus +} +#endif + /** * @} */ diff --git a/nimble/host/mesh/include/mesh/health_srv.h b/nimble/host/mesh/include/mesh/health_srv.h index 96f69e1e0..0638c982a 100644 --- a/nimble/host/mesh/include/mesh/health_srv.h +++ b/nimble/host/mesh/include/mesh/health_srv.h @@ -17,6 +17,10 @@ * @{ */ +#ifdef __cplusplus +extern "C" { +#endif + struct bt_mesh_health_srv_cb { /* Fetch current faults */ int (*fault_get_cur)(struct bt_mesh_model *model, u8_t *test_id, @@ -84,6 +88,10 @@ extern const struct bt_mesh_model_op bt_mesh_health_srv_op[]; BT_MESH_MODEL(BT_MESH_MODEL_ID_HEALTH_SRV, \ bt_mesh_health_srv_op, pub, srv) +#ifdef __cplusplus +} +#endif + /** * @} */ diff --git a/nimble/host/mesh/include/mesh/main.h b/nimble/host/mesh/include/mesh/main.h index 7a759ddbc..8abb8f8de 100644 --- a/nimble/host/mesh/include/mesh/main.h +++ b/nimble/host/mesh/include/mesh/main.h @@ -17,6 +17,10 @@ * @{ */ +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { BT_MESH_NO_OUTPUT = 0, BT_MESH_BLINK = BIT(0), @@ -358,6 +362,10 @@ int bt_mesh_lpn_poll(void); */ void bt_mesh_lpn_set_cb(void (*cb)(u16_t friend_addr, bool established)); +#ifdef __cplusplus +} +#endif + /** * @} */ diff --git a/nimble/host/mesh/include/mesh/model_cli.h b/nimble/host/mesh/include/mesh/model_cli.h index 972487649..33fbd6e9d 100644 --- a/nimble/host/mesh/include/mesh/model_cli.h +++ b/nimble/host/mesh/include/mesh/model_cli.h @@ -7,6 +7,10 @@ #ifndef __MODEL_CLI_H__ #define __MODEL_CLI_H__ +#ifdef __cplusplus +extern "C" { +#endif + struct bt_mesh_gen_model_cli { struct bt_mesh_model *model; @@ -40,4 +44,8 @@ int bt_mesh_gen_level_set(u16_t net_idx, u16_t addr, u16_t app_idx, s16_t val, s16_t *state); int bt_mesh_gen_model_cli_init(struct bt_mesh_model *model, bool primary); +#ifdef __cplusplus +} #endif + +#endif /* __MODEL_CLI_H__ */ diff --git a/nimble/host/mesh/include/mesh/model_srv.h b/nimble/host/mesh/include/mesh/model_srv.h index 1eff36eed..c4f4033df 100644 --- a/nimble/host/mesh/include/mesh/model_srv.h +++ b/nimble/host/mesh/include/mesh/model_srv.h @@ -7,6 +7,10 @@ #ifndef __MODEL_SRV_H__ #define __MODEL_SRV_H__ +#ifdef __cplusplus +extern "C" { +#endif + struct bt_mesh_gen_onoff_srv_cb { int (*get)(struct bt_mesh_model *model, u8_t *state); int (*set)(struct bt_mesh_model *model, u8_t state); @@ -45,4 +49,8 @@ void bt_mesh_set_gen_onoff_srv_cb(struct bt_mesh_gen_onoff_srv_cb *gen_onoff_cb) void bt_mesh_set_gen_level_srv_cb(struct bt_mesh_gen_level_srv_cb *gen_level_cb); void bt_mesh_set_light_lightness_srv_cb(struct bt_mesh_light_lightness_srv_cb *light_lightness_cb); +#ifdef __cplusplus +} #endif + +#endif /* __MODEL_SRV_H__ */ diff --git a/nimble/host/mesh/include/mesh/porting.h b/nimble/host/mesh/include/mesh/porting.h index eed8a2088..1667a8a04 100644 --- a/nimble/host/mesh/include/mesh/porting.h +++ b/nimble/host/mesh/include/mesh/porting.h @@ -10,8 +10,16 @@ #ifndef __BT_MESH_PORTING_H #define __BT_MESH_PORTING_H +#ifdef __cplusplus +extern "C" { +#endif + void mesh_adv_thread(void *args); +#ifdef __cplusplus +} +#endif + /** * @} */ diff --git a/nimble/host/mesh/include/mesh/proxy.h b/nimble/host/mesh/include/mesh/proxy.h index 55c74e902..63bbfa3e5 100644 --- a/nimble/host/mesh/include/mesh/proxy.h +++ b/nimble/host/mesh/include/mesh/proxy.h @@ -17,6 +17,10 @@ * @{ */ +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Enable advertising with Node Identity. * @@ -28,6 +32,10 @@ */ int bt_mesh_proxy_identity_enable(void); +#ifdef __cplusplus +} +#endif + /** * @} */