Merge pull request #7742

f174a8f wallet_api: reconnectDevice (tobtoht)
This commit is contained in:
luigi1111 2021-06-24 14:05:35 -05:00
commit 7c3629a5ee
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 21 additions and 0 deletions

View file

@ -2571,6 +2571,23 @@ void WalletImpl::deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex,
m_wallet->device_show_address(accountIndex, addressIndex, payment_id_param); 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
namespace Bitmonero = Monero; namespace Bitmonero = Monero;

View file

@ -220,6 +220,7 @@ public:
virtual bool isKeysFileLocked() override; virtual bool isKeysFileLocked() override;
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) 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 void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) override;
virtual bool reconnectDevice() override;
private: private:
void clearStatus() const; void clearStatus() const;

View file

@ -1084,6 +1084,9 @@ struct Wallet
//! shows address on device display //! shows address on device display
virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0; virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0;
//! attempt to reconnect to hardware device
virtual bool reconnectDevice() = 0;
}; };
/** /**