From 6061ee1af573147e41a0834d1c6628eda2fa2f7c Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 17 Feb 2017 17:49:20 +0100 Subject: Rename is_connected to be more specific Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 4 ++-- device.cc | 2 +- include/device.h | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index ac1074b..4fed0a6 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -107,7 +107,7 @@ namespace nitrokey{ bool NitrokeyManager::_disconnect_no_lock() { //do not use directly without locked mutex, - //used by is_connected, disconnect + //used by could_be_enumerated, disconnect if (device == nullptr){ return false; } @@ -119,7 +119,7 @@ namespace nitrokey{ bool NitrokeyManager::is_connected() throw(){ std::lock_guard lock(mex_dev_com); if(device != nullptr){ - auto connected = device->is_connected(); + auto connected = device->could_be_enumerated(); if(connected){ return true; } else { diff --git a/device.cc b/device.cc index 8fdf99a..fcc3ba7 100644 --- a/device.cc +++ b/device.cc @@ -115,7 +115,7 @@ int Device::recv(void *packet) { return status; } -bool Device::is_connected() { +bool Device::could_be_enumerated() { Log::instance()(__FUNCTION__, Loglevel::DEBUG_L2); std::lock_guard lock(mex_dev_com); if (mp_devhandle==nullptr){ diff --git a/include/device.h b/include/device.h index 40eb376..5d7ee12 100644 --- a/include/device.h +++ b/include/device.h @@ -77,7 +77,12 @@ public: */ virtual int recv(void *packet); - bool is_connected(); + /*** + * Returns true if some device is visible by OS with given VID and PID + * whether the device is connected through HID API or not. + * @return true if visible by OS + */ + bool could_be_enumerated(); void show_stats(); // ErrorCounters get_stats(){ return m_counters; } -- cgit v1.2.3