diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-02-17 17:49:20 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-11 15:41:48 +0100 |
commit | 6061ee1af573147e41a0834d1c6628eda2fa2f7c (patch) | |
tree | 6c6472d0d18970b9212d393e722ffba5d02ebb73 | |
parent | 5650e48b114529075d89dbdde0330901351b8460 (diff) | |
download | libnitrokey-6061ee1af573147e41a0834d1c6628eda2fa2f7c.tar.gz libnitrokey-6061ee1af573147e41a0834d1c6628eda2fa2f7c.tar.bz2 |
Rename is_connected to be more specific
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r-- | NitrokeyManager.cc | 4 | ||||
-rw-r--r-- | device.cc | 2 | ||||
-rw-r--r-- | 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<std::mutex> lock(mex_dev_com); if(device != nullptr){ - auto connected = device->is_connected(); + auto connected = device->could_be_enumerated(); if(connected){ return true; } else { @@ -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<std::mutex> 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; } |