From 84f8f634584e22a557bf50f077fb15967311908d Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 10 Oct 2017 15:57:20 +0200 Subject: Return exception type when DeviceCommunicationException is encountered Signed-off-by: Szczepan Zalega --- NK_C_API.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'NK_C_API.cc') diff --git a/NK_C_API.cc b/NK_C_API.cc index bac11b3..822c95d 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -90,10 +90,10 @@ uint8_t get_without_result(T func){ NK_last_command_status = libraryException.exception_id(); } catch (const InvalidCRCReceived &invalidCRCException){ - ;;; + ; } catch (const DeviceCommunicationException &deviceException){ - NK_last_command_status = -1; + NK_last_command_status = 256-deviceException.getType(); } return NK_last_command_status; } -- cgit v1.2.1 From cf7110f02f793c791b7227bf1579eaaa81d3fd30 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 10 Oct 2017 15:54:43 +0200 Subject: Add DEBUG_L1 level and set it as default for Python tests Signed-off-by: Szczepan Zalega --- NK_C_API.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'NK_C_API.cc') diff --git a/NK_C_API.cc b/NK_C_API.cc index 822c95d..e730bae 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -296,6 +296,12 @@ extern "C" { m->set_debug(state); } + + NK_C_API void NK_set_debug_level(const int level) { + auto m = NitrokeyManager::instance(); + m->set_loglevel(level); + } + NK_C_API int NK_totp_set_time(uint64_t time) { auto m = NitrokeyManager::instance(); return get_without_result([&]() { -- cgit v1.2.1