Skip to content

Commit ace78d7

Browse files
committed
insights: add support for custom transport
1 parent 0d84018 commit ace78d7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: libraries/Insights/src/Insights.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ ESPInsightsClass::~ESPInsightsClass(){
4949
end();
5050
}
5151

52-
bool ESPInsightsClass::begin(const char *auth_key, const char *node_id, uint32_t log_type, bool alloc_ext_ram){
52+
bool ESPInsightsClass::begin(const char *auth_key, const char *node_id, uint32_t log_type, bool alloc_ext_ram, bool use_default_transport){
5353
if(!initialized){
5454
if(log_type == 0xFFFFFFFF){
5555
log_type = (ESP_DIAG_LOG_TYPE_ERROR | ESP_DIAG_LOG_TYPE_WARNING | ESP_DIAG_LOG_TYPE_EVENT);
5656
}
5757
esp_insights_config_t config = {.log_type = log_type, .node_id = node_id, .auth_key = auth_key, .alloc_ext_ram = alloc_ext_ram};
58-
esp_err_t err = esp_insights_init(&config);
58+
esp_err_t err = ESP_OK;
59+
if (use_default_transport) {
60+
err = esp_insights_init(&config);
61+
} else {
62+
err = esp_insights_enable(&config);
63+
}
5964
if (err != ESP_OK) {
6065
log_e("Failed to initialize ESP Insights, err:0x%x", err);
6166
}

Diff for: libraries/Insights/src/Insights.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class ESPInsightsClass
9090
ESPInsightsClass();
9191
~ESPInsightsClass();
9292

93-
bool begin(const char *auth_key, const char *node_id = NULL, uint32_t log_type = 0xFFFFFFFF, bool alloc_ext_ram = false);
93+
bool begin(const char *auth_key, const char *node_id = NULL, uint32_t log_type = 0xFFFFFFFF, bool alloc_ext_ram = false, bool use_default_transport = true);
9494
void end();
9595
bool send();
9696
const char * nodeID();

0 commit comments

Comments
 (0)