Wrap various bluetooth service API with extern "C"

Make service API usable in C++ code without the need of explicit
include statements wrapping.
This commit is contained in:
Alexey Edelev
2025-05-29 15:19:48 +02:00
committed by Rahul Tank
parent 0225775e49
commit 08ccfd5b7d
12 changed files with 92 additions and 0 deletions
@@ -20,6 +20,10 @@
#ifndef H_BLE_SVC_ANS_
#define H_BLE_SVC_ANS_
#ifdef __cplusplus
extern "C" {
#endif
struct ble_hs_cfg;
/* 16 Bit Alert Notification Service UUID */
@@ -81,5 +85,8 @@ int ble_svc_ans_unr_alert_add(uint8_t cat_id);
void ble_svc_ans_init(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -20,6 +20,10 @@
#ifndef H_BLE_SVC_BAS_
#define H_BLE_SVC_BAS_
#ifdef __cplusplus
extern "C" {
#endif
/* 16 Bit Battery Service UUID */
#define BLE_SVC_BAS_UUID16 0x180F
@@ -30,4 +34,8 @@ int ble_svc_bas_battery_level_set(uint8_t level);
void ble_svc_bas_init(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -20,6 +20,10 @@
#ifndef H_BLE_SVC_CTE_
#define H_BLE_SVC_CTE_
#ifdef __cplusplus
extern "C" {
#endif
struct ble_hs_cfg;
#define BLE_SVC_CTE_UUID16 0x184A
@@ -33,5 +37,8 @@ struct ble_hs_cfg;
void ble_svc_cte_init(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -20,6 +20,10 @@
#ifndef H_BLE_SVC_CTS_
#define H_BLE_SVC_CTS_
#ifdef __cplusplus
extern "C" {
#endif
#define BLE_SVC_CTS_ERR_DATA_FIELD_IGNORED 0x80
/* 16 Bit Current Time Service UUID */
#define BLE_SVC_CTS_UUID16 0x1805
@@ -157,4 +161,8 @@ ble_svc_cts_init(struct ble_svc_cts_cfg cfg);
void
ble_svc_cts_time_updated(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -20,6 +20,10 @@
#ifndef H_BLE_SVC_DIS_
#define H_BLE_SVC_DIS_
#ifdef __cplusplus
extern "C" {
#endif
/**
* Example:
*
@@ -145,4 +149,8 @@ int ble_svc_dis_system_id_set(const char *value);
int ble_svc_dis_pnp_id_set(const char *value);
const char *ble_svc_dis_pnp_id(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -21,6 +21,10 @@
#ifndef H_BLE_SVC_HID_
#define H_BLE_SVC_HID_
#ifdef __cplusplus
extern "C" {
#endif
/* 16 Bit Battery Service UUID */
#define BLE_SVC_HID_UUID16 0x1812
@@ -110,5 +114,9 @@ void ble_svc_hid_init(void);
int ble_svc_hid_add(struct ble_svc_hid_params params);
void ble_svc_hid_reset(void);
#ifdef __cplusplus
}
#endif
#endif
#endif // CONFIG_BT_NIMBLE_HID_SERVICE
@@ -7,6 +7,10 @@
#ifndef H_BLE_SVC_HR_
#define H_BLE_SVC_HR_
#ifdef __cplusplus
extern "C" {
#endif
struct ble_hs_cfg;
/* 16 Bit Heart Rate Service UUID */
@@ -26,4 +30,8 @@ void ble_svc_hr_on_gap_disconnect(uint16_t conn_handle);
void ble_svc_hr_init(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -7,6 +7,10 @@
#ifndef H_BLE_SVC_HTP_
#define H_BLE_SVC_HTP_
#ifdef __cplusplus
extern "C" {
#endif
struct ble_hs_cfg;
/* 16 Bit Health Thermometer Service UUID */
@@ -47,4 +51,8 @@ int ble_svc_htp_notify(uint16_t conn_handle, float temp, bool temp_unit);
void ble_svc_htp_init(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -20,6 +20,10 @@
#ifndef H_BLE_IAS_TPS_
#define H_BLE_IAS_TPS_
#ifdef __cplusplus
extern "C" {
#endif
#define BLE_SVC_IAS_UUID16 0x1802
#define BLE_SVC_IAS_CHR_UUID16_ALERT_LEVEL 0x2a06
@@ -33,6 +37,9 @@ typedef int ble_svc_ias_event_fn(uint8_t alert_level);
void ble_svc_ias_set_cb(ble_svc_ias_event_fn *cb);
void ble_svc_ias_init(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -7,6 +7,10 @@
#ifndef H_BLE_SVC_PROX_
#define H_BLE_SVC_PROX_
#ifdef __cplusplus
extern "C" {
#endif
struct ble_hs_cfg;
/* 16 Bit Proximity Sensor Service UUID */
@@ -29,4 +33,8 @@ struct ble_hs_cfg;
*/
void ble_svc_prox_init(void);
#ifdef __cplusplus
}
#endif
#endif
@@ -22,6 +22,9 @@
#ifndef H_BLE_SVC_SPS_
#define H_BLE_SVC_SPS_
#ifdef __cplusplus
extern "C" {
#endif
#define BLE_SVC_SPS_UUID16 0x1813
#define BLE_SVC_SPS_CHR_UUID16_SCAN_ITVL_WINDOW 0x2A4F
@@ -32,4 +35,9 @@ typedef int ble_svc_sps_event_fn(uint16_t scan_interval, uint16_t scan_window);
void ble_svc_sps_scan_refresh(void);
void ble_svc_sps_init(uint16_t scan_itvl, uint16_t scan_window);
void ble_svc_sps_set_cb(ble_svc_sps_event_fn *cb);
#ifdef __cplusplus
}
#endif
#endif
@@ -20,6 +20,10 @@
#ifndef H_BLE_SVC_TPS_
#define H_BLE_SVC_TPS_
#ifdef __cplusplus
extern "C" {
#endif
struct ble_hs_cfg;
#define BLE_SVC_TPS_UUID16 0x1804
@@ -27,5 +31,8 @@ struct ble_hs_cfg;
void ble_svc_tps_init(void);
#ifdef __cplusplus
}
#endif
#endif