diff options
author | tobtoht <thotbot@protonmail.com> | 2021-06-04 15:24:53 +0200 |
---|---|---|
committer | tobtoht <thotbot@protonmail.com> | 2021-06-04 15:24:53 +0200 |
commit | f174a8f05fe966895557d23f571cf755852dcb7f (patch) | |
tree | fa4f8cfe748b054f2b40a09f90293774e4562e07 /src | |
parent | Merge pull request #7735 (diff) | |
download | monero-f174a8f05fe966895557d23f571cf755852dcb7f.tar.xz |
wallet_api: reconnectDevice
Diffstat (limited to '')
-rw-r--r-- | src/wallet/api/wallet.cpp | 17 | ||||
-rw-r--r-- | src/wallet/api/wallet.h | 1 | ||||
-rw-r--r-- | src/wallet/api/wallet2_api.h | 3 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index db3049f9e..00f6e92ca 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -2576,6 +2576,23 @@ void WalletImpl::deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, m_wallet->device_show_address(accountIndex, addressIndex, payment_id_param); } + +bool WalletImpl::reconnectDevice() +{ + clearStatus(); + + bool r; + try { + r = m_wallet->reconnect_device(); + } + catch (const std::exception &e) { + LOG_ERROR(__FUNCTION__ << " error: " << e.what()); + setStatusError(e.what()); + return false; + } + + return r; +} } // namespace namespace Bitmonero = Monero; diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h index ce2d7d7e4..dbbcda500 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -220,6 +220,7 @@ public: virtual bool isKeysFileLocked() override; virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) override; virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) override; + virtual bool reconnectDevice() override; private: void clearStatus() const; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h index e34332734..755e32bfd 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -1084,6 +1084,9 @@ struct Wallet //! shows address on device display virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0; + + //! attempt to reconnect to hardware device + virtual bool reconnectDevice() = 0; }; /** |