Created
December 17, 2021 16:27
-
-
Save gustavosinbandera1/e40a0c0419ffb9f89116d0341ef00461 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string CookLogger::processData(int32_t cook_event_id, grafana_event_data_t info_) { | |
switch (cook_event_id) { | |
case COOKING_EVENT_PROCESS_STARTED: | |
case COOKING_EVENT_PROCESS_CANCELLED: | |
case COOKING_EVENT_PROCESS_ENDED: { | |
grafana_event_data_t info = info_; | |
//printCookData(&info); | |
char *item_data; | |
item_data = json_asprintf("{event:%Q,cook_name:%Q,cook_type:%Q,event_time:%d,label:%Q, bottom_setting:%Q,bottom_temp:%d,bottom_time:%d,top_setting:%Q,top_temp:%d,top_time:%d}", | |
std::string(info.event).c_str(), info.cook_name.c_str(), info.cook_type.c_str(), info.event_time, std::string(info.label).c_str(), | |
info.bottom_cook_settings.mode.c_str(), info.bottom_cook_settings.temp, info.bottom_cook_settings.time, | |
info.top_cook_settings.mode.c_str(), info.top_cook_settings.temp, info.top_cook_settings.time); | |
std::string buffer(item_data); | |
delete item_data; | |
return buffer; | |
break; | |
} | |
case COOKING_EVENT_QUEUE_STARTED: | |
case COOKING_EVENT_QUEUE_ENDED: { | |
grafana_event_data_t info = info_; | |
//printCookData(&info); | |
char *item_data; | |
item_data = json_asprintf("{event:%Q,queue:%Q,event_time:%d, bottom_setting:%Q,bottom_temp:%d,bottom_time:%d,top_setting:%Q,top_temp:%d,top_time:%d}", | |
std::string(info.event).c_str(), info.queue.c_str(), info.event_time, | |
info.bottom_cook_settings.mode.c_str(), info.bottom_cook_settings.temp, info.bottom_cook_settings.time, | |
info.top_cook_settings.mode.c_str(), info.top_cook_settings.temp, info.top_cook_settings.time); | |
std::string buffer(item_data); | |
delete item_data; | |
return buffer; | |
break; | |
} | |
case COOKING_EVENT_STEP_STARTED: | |
case COOKING_EVENT_STEP_ENDED: { | |
grafana_event_data_t info = info_; | |
// printCookData(&info); | |
char *item_data; | |
item_data = json_asprintf("{event:%Q,label:%Q, queue:%Q,event_time:%d, bottom_setting:%Q,bottom_temp:%d,bottom_time:%d,top_setting:%Q,top_temp:%d,top_time:%d}", | |
std::string(info.event).c_str(),std::string(info.label).c_str(), info.queue.c_str(), info.event_time, | |
info.bottom_cook_settings.mode.c_str(), info.bottom_cook_settings.temp, info.bottom_cook_settings.time, | |
info.top_cook_settings.mode.c_str(), info.top_cook_settings.temp, info.top_cook_settings.time); | |
std::string buffer(item_data); | |
delete item_data; | |
return buffer; | |
break; | |
} | |
default: | |
break; | |
} | |
return ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment