40 lines
815 B
C
40 lines
815 B
C
/*
|
|
* AUTHOR: Alexander Popov <iiiypuk {at} fastmail.fm>
|
|
* DESC: ...
|
|
*/
|
|
|
|
#ifndef UI_H_
|
|
#define UI_H_
|
|
|
|
void app_close(webui_event_t* e) {
|
|
printf("Bye!\n");
|
|
// webui_destroy();
|
|
webui_exit();
|
|
}
|
|
|
|
void app_refresh_devices(webui_event_t* e) {
|
|
const char *available_ports = json_dumps(device_get_available(), 0);
|
|
|
|
#ifdef DEBUG
|
|
printf("Доступные порты:\n%s\n", available_ports);
|
|
#endif
|
|
|
|
webui_return_string(e, available_ports);
|
|
}
|
|
|
|
void app_connect_device(webui_event_t* e) {
|
|
const char* port = webui_get_string(e);
|
|
int result;
|
|
|
|
#ifdef DEBUG
|
|
printf("Подключение к порту: %s\n", port);
|
|
#endif
|
|
|
|
// TODO: Необходимо проверить подключение
|
|
result = device_connect(port);
|
|
|
|
webui_return_bool(e, (bool)result);
|
|
}
|
|
|
|
#endif
|