Skip to content

Commit

Permalink
Merge pull request #3 from QRPp/extern-c
Browse files Browse the repository at this point in the history
Fix linking of API use from C++ code
  • Loading branch information
pimvanpelt authored Apr 2, 2021
2 parents 8b7d763 + d22fd85 commit f97198f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/mgos_homeassistant.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
#pragma once

#include "mgos_homeassistant_api.h"

#ifdef __cplusplus
extern "C" {
#endif

struct mgos_homeassistant *mgos_homeassistant_get_global(void);
bool mgos_homeassistant_fromfile(struct mgos_homeassistant *ha, const char *filename);
bool mgos_homeassistant_fromjson(struct mgos_homeassistant *ha, const char *json);
bool mgos_homeassistant_clear(struct mgos_homeassistant *ha);

#ifdef __cplusplus
}
#endif
8 changes: 8 additions & 0 deletions include/mgos_homeassistant_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ struct mgos_homeassistant_handler {
SLIST_ENTRY(mgos_homeassistant_handler) entry;
};

#ifdef __cplusplus
extern "C" {
#endif

bool mgos_homeassistant_send_config(struct mgos_homeassistant *ha);
bool mgos_homeassistant_send_status(struct mgos_homeassistant *ha);
bool mgos_homeassistant_add_handler(struct mgos_homeassistant *ha, ha_ev_handler ev_handler, void *user_data);
Expand All @@ -147,3 +151,7 @@ struct mgos_homeassistant_object_class *mgos_homeassistant_object_class_get(stru
bool mgos_homeassistant_object_class_send_status(struct mgos_homeassistant_object_class *c);
bool mgos_homeassistant_object_class_send_config(struct mgos_homeassistant_object_class *c);
bool mgos_homeassistant_object_class_remove(struct mgos_homeassistant_object_class **c);

#ifdef __cplusplus
}
#endif

0 comments on commit f97198f

Please sign in to comment.