Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C linkage for C++ support #66

Merged
merged 5 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
#include "freertos/FreeRTOS.h"
#include "core_mqtt_agent.h"

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief Starts the OTA codesigning demo.
*/
Expand All @@ -51,4 +57,10 @@ void vStartOTACodeSigningDemo( void );
bool vOTAProcessMessage( void * pvIncomingPublishCallbackContext,
MQTTPublishInfo_t * pxPublishInfo );

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* OTA_OVER_MQTT_DEMO_H */
12 changes: 12 additions & 0 deletions main/demo_tasks/ota_over_mqtt_demo/ota_over_mqtt_demo_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
#include "qualification_wrapper_config.h"
#endif /* CONFIG_GRI_RUN_QUALIFICATION_TEST */

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief The thing name of the device.
*/
Expand Down Expand Up @@ -93,4 +99,10 @@
#define APP_VERSION_MINOR ( CONFIG_GRI_OTA_DEMO_APP_VERSION_MINOR )
#define APP_VERSION_BUILD ( CONFIG_GRI_OTA_DEMO_APP_VERSION_BUILD )

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* OTA_OVER_MQTT_DEMO_CONFIG_H */
12 changes: 12 additions & 0 deletions main/demo_tasks/sub_pub_unsub_demo/sub_pub_unsub_demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@
#ifndef SUB_PUB_UNSUB_DEMO_H
#define SUB_PUB_UNSUB_DEMO_H

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief This function starts the SubPubUnsub demo.
*/
void vStartSubscribePublishUnsubscribeDemo( void );

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* SUB_PUB_UNSUB_DEMO_H */
12 changes: 12 additions & 0 deletions main/demo_tasks/sub_pub_unsub_demo/sub_pub_unsub_demo_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
#include "qualification_wrapper_config.h"
#endif /* CONFIG_GRI_RUN_QUALIFICATION_TEST */

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief Size of statically allocated buffers for holding topic names and
* payloads.
Expand Down Expand Up @@ -75,4 +81,10 @@
*/
#define subpubunsubconfigTASK_STACK_SIZE ( ( unsigned int ) ( CONFIG_GRI_SUB_PUB_UNSUB_DEMO_TASK_STACK_SIZE ) )

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* SUB_PUB_UNSUB_DEMO_CONFIG_H */
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,30 @@
/* limitations under the License. */

#ifndef APP_DRIVER_H_
#define APP_DRIVER_H_
#define APP_DRIVER_H_

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
/* *INDENT-ON* */

#include "driver/temp_sensor.h"
#include "driver/gpio.h"
#include "led_strip.h"
#include "driver/temp_sensor.h"
#include "driver/gpio.h"
#include "led_strip.h"

esp_err_t app_driver_init();
esp_err_t app_driver_init();

float app_driver_temp_sensor_read_celsius();
float app_driver_temp_sensor_read_celsius();

esp_err_t app_driver_led_on();
esp_err_t app_driver_led_on();

esp_err_t app_driver_led_off();
esp_err_t app_driver_led_off();

/* *INDENT-OFF* */
#ifdef __cplusplus
}
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* APP_DRIVER_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@
#ifndef TEMP_SUB_PUB_AND_LED_CONTROL_DEMO_H
#define TEMP_SUB_PUB_AND_LED_CONTROL_DEMO_H

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief This function starts the Temp Sub Pub and LED Control demo.
*/
void vStartTempSubPubAndLEDControlDemo( void );

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* TEMP_SUB_PUB_AND_LED_CONTROL_DEMO_H */
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
/* ESP-IDF sdkconfig include. */
#include <sdkconfig.h>

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief Size of statically allocated buffers for holding topic names and
* payloads.
Expand Down Expand Up @@ -65,4 +71,10 @@
*/
#define temppubsubandledcontrolconfigTASK_STACK_SIZE ( ( unsigned int ) ( CONFIG_GRI_TEMPERATURE_PUB_SUB_AND_LED_CONTROL_DEMO_TASK_STACK_SIZE ) )

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* TEMP_SUB_PUB_AND_LED_CONTROL_DEMO_CONFIG_H */
12 changes: 12 additions & 0 deletions main/networking/mqtt/core_mqtt_agent_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
#include "freertos/FreeRTOS.h"
#include "esp_event.h"

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief Register an event handler with coreMQTT-Agent events.
*
Expand Down Expand Up @@ -62,4 +68,10 @@ BaseType_t xCoreMqttAgentManagerStart( NetworkContext_t * pxNetworkContextIn );
*/
BaseType_t xCoreMqttAgentManagerPost( int32_t lEventId );

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* CORE_MQTT_AGENT_NETWORK_MANAGER_H */
12 changes: 12 additions & 0 deletions main/networking/mqtt/core_mqtt_agent_manager_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
#include "qualification_wrapper_config.h"
#endif /* CONFIG_GRI_RUN_QUALIFICATION_TEST */

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief The thing name of the device.
*/
Expand Down Expand Up @@ -100,4 +106,10 @@
*/
#define configMQTT_AGENT_TASK_PRIORITY ( CONFIG_GRI_MQTT_AGENT_TASK_PRIORITY )

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* CORE_MQTT_AGENT_MANAGER_CONFIG_H */
12 changes: 12 additions & 0 deletions main/networking/mqtt/core_mqtt_agent_manager_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@

#include "esp_event.h"

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

ESP_EVENT_DECLARE_BASE( CORE_MQTT_AGENT_EVENT );

enum
Expand All @@ -39,4 +45,10 @@ enum
CORE_MQTT_AGENT_OTA_STOPPED_EVENT
};

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* CORE_MQTT_AGENT_MANAGER_EVENTS_H */
12 changes: 12 additions & 0 deletions main/networking/mqtt/subscription_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
#define SUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS 10U
#endif

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/**
* @brief Callback function called when receiving a publish.
*
Expand Down Expand Up @@ -119,4 +125,10 @@ void removeSubscription( SubscriptionElement_t * pxSubscriptionList,
bool handleIncomingPublishes( SubscriptionElement_t * pxSubscriptionList,
MQTTPublishInfo_t * pxPublishInfo );

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */

#endif /* SUBSCRIPTION_MANAGER_H */
12 changes: 12 additions & 0 deletions main/networking/wifi/app_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
#pragma once
#include <esp_err.h>

/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-ON* */

/** Types of Proof of Possession */
typedef enum
{
Expand All @@ -23,3 +29,9 @@ esp_err_t app_wifi_start( app_wifi_pop_type_t pop_type );
esp_err_t app_wifi_connect();
bool app_wifi_is_connected();
void vWaitOnWifiConnected( void );

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
#endif
/* *INDENT-ON* */