diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 9f9acd1..863287a 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: configure - run: ./configure + run: ./configure.sh - name: 'build and package' run: ./package.sh diff --git a/backend/headers/backend.h b/backend/headers/backend.h index 9c6c3f3..0bed680 100644 --- a/backend/headers/backend.h +++ b/backend/headers/backend.h @@ -24,6 +24,8 @@ typedef enum _action_type Set_ID, Set_Name, Blink, + Snapshot, + FactoryDefault, Update_Firmware, Get_Firm_status, }action_type; @@ -52,6 +54,7 @@ typedef struct _backend_action int intParam; void (*functionParam)(double,int); + void *pointerParam; char stringParam[100]; backend_callback callback; @@ -69,6 +72,9 @@ backend_error get_devices(can_device_t *devices, int maxDeviceCount, int *device backend_error set_device_id(const can_device_t *device, int id, backend_callback callback); backend_error set_device_name(const can_device_t *device, const char *name, backend_callback callback); backend_error blink_device(const can_device_t *device, backend_callback callback); +backend_error get_device_snapshot(const can_device_t *device, backend_callback callback); +backend_error factory_default_device(const can_device_t *device, backend_callback callback); + backend_error update_device_firmware(const can_device_t *device, const char *firmware_file, void (*firm_upgrade_callback)(double, int), backend_callback callback); #endif diff --git a/backend/lib/libPenguin_Backend.so b/backend/lib/libPenguin_Backend.so index e2c7743..45e7ac5 100755 Binary files a/backend/lib/libPenguin_Backend.so and b/backend/lib/libPenguin_Backend.so differ diff --git a/config/MainApp.ui b/config/MainApp.ui index ccdd005..406afbc 100644 --- a/config/MainApp.ui +++ b/config/MainApp.ui @@ -53,6 +53,7 @@ + @@ -613,12 +614,13 @@ with matching type True False - + 300 True True True True + txt_device_selftest_snapshot 0 @@ -639,8 +641,8 @@ with matching type - - Copy to Clipboard + + Factory Default True True True diff --git a/configure b/configure.sh similarity index 76% rename from configure rename to configure.sh index 53c2a6f..20e21a8 100755 --- a/configure +++ b/configure.sh @@ -1,4 +1,5 @@ #!/bin/sh +sudo apt-get update sudo apt-get install libcurl4-gnutls-dev libgtk-3-dev diff --git a/native/include/can_devices.h b/native/include/can_devices.h index c0eab41..ff7fa09 100644 --- a/native/include/can_devices.h +++ b/native/include/can_devices.h @@ -18,6 +18,8 @@ void react_changed_device(GtkWidget *widget, gpointer data); void react_update_firmware(GtkWidget *widget, gpointer data); void react_changed_name(GtkWidget *widget, gpointer data); void react_blink_device(GtkWidget *widget, gpointer data); +void react_snapshot_device(GtkWidget *widget, gpointer data); +void react_default_device(GtkWidget *widget, gpointer data); #endif diff --git a/native/src/app_callbacks.c b/native/src/app_callbacks.c index 80b677e..30dc40c 100644 --- a/native/src/app_callbacks.c +++ b/native/src/app_callbacks.c @@ -21,6 +21,8 @@ static struct /* Gtk Widget references that matter */ GtkTreeModel *deviceTreeModel; GtkLevelBar *firmUpgradeStatus; + + GtkTextBuffer *snapshotTxt; }_module; int count = 0; @@ -99,6 +101,16 @@ void frontend_callback(backend_error err, const backend_action *action) dev.id = action->intParam; set_selected_device(dev); } + break; + } + case Snapshot: + { + /* Get contents of string and copy it to module */ + if(err == Ok) + { + gtk_text_buffer_set_text(_module.snapshotTxt, *((char **)action->pointerParam), -1); + } + break; } } } @@ -171,6 +183,13 @@ int connect_all_signals() g_signal_connect(obj, "clicked", G_CALLBACK(react_changed_name), NULL); obj = gtk_builder_get_object(builder, "btn_blink"); g_signal_connect(obj, "clicked", G_CALLBACK(react_blink_device), NULL); + /* Connect objects from the self-test snapshot page */ + obj = gtk_builder_get_object(builder, "btn_blink_clear"); + g_signal_connect(obj, "clicked", G_CALLBACK(react_blink_device), NULL); + obj = gtk_builder_get_object(builder, "btn_snapshot"); + g_signal_connect(obj, "clicked", G_CALLBACK(react_snapshot_device), NULL); + obj = gtk_builder_get_object(builder, "btn_factory_default"); + g_signal_connect(obj, "clicked", G_CALLBACK(react_default_device), NULL); obj = gtk_builder_get_object(builder, "txt_device_id"); add_txt_change_id((GtkSpinButton *)obj); @@ -180,6 +199,8 @@ int connect_all_signals() _module.firmUpgradeStatus = (GtkLevelBar *)obj; obj = gtk_builder_get_object(builder, "txt_device_name"); add_txt_device_name((GtkEntry *)obj); + obj = gtk_builder_get_object(builder, "txt_device_selftest_snapshot"); + _module.snapshotTxt = (GtkTextBuffer *)obj; /* Connect server address and port text change to react function */ diff --git a/native/src/can_devices.c b/native/src/can_devices.c index 0e57d3c..2a54fb1 100644 --- a/native/src/can_devices.c +++ b/native/src/can_devices.c @@ -122,4 +122,12 @@ void react_blink_device(GtkWidget *widget, gpointer data) { blink_device(&_module.selected_device, frontend_callback); } +void react_snapshot_device(GtkWidget *widget, gpointer data) +{ + get_device_snapshot(&_module.selected_device, frontend_callback); +} +void react_default_device(GtkWidget *widget, gpointer data) +{ + factory_default_device(&_module.selected_device, frontend_callback); +} diff --git a/version.txt b/version.txt index 13abad7..10a97fd 100644 --- a/version.txt +++ b/version.txt @@ -1,4 +1,4 @@ VERSION_MAJOR 0 -VERSION_MINOR 2 +VERSION_MINOR 3 VERSION_PATCH 0