From 208c24479ec0ceca2b7c38034f23b164bf1672e5 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Fri, 22 Nov 2024 12:16:50 +0100 Subject: add better dummy device for ledger --- .../src/main/cpp/monero_checksum.h | 4 +- .../src/main/cpp/wallet2_api_c.cpp | 44 +--------------------- .../src/main/cpp/wallet2_api_c.h | 10 +---- 3 files changed, 5 insertions(+), 53 deletions(-) (limited to 'monero_libwallet2_api_c') diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h index 4d3d39f..ffd5517 100644 --- a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h +++ b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h @@ -1,6 +1,6 @@ #ifndef MONEROC_CHECKSUMS #define MONEROC_CHECKSUMS -const char * MONERO_wallet2_api_c_h_sha256 = "198a27486ce4f014b737f52ec2879a90838c3b3ca088de8dc7d55b79a10f4a5b"; -const char * MONERO_wallet2_api_c_cpp_sha256 = "22b0c9dd542fb55edfe9e17da67e97ddf5f80bcdd3e126e1bd64cce54234bde1-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; +const char * MONERO_wallet2_api_c_h_sha256 = "87ec362cdf9b3e6403d899c11e7ae39d932a8098c3ebb360723b537bded2d8de"; +const char * MONERO_wallet2_api_c_cpp_sha256 = "32cc5fbbdb89e77f33619b7f3d942cfac4202f3a3838605a396aed3882d668b5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; const char * MONERO_wallet2_api_c_exp_sha256 = "c1f785d62709fd8b849063ecf4fe8854d9e3b05b568b9716de98d33e7bdaf522"; #endif diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp index 0cc2f9f..f44e46a 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp @@ -1607,49 +1607,9 @@ uint64_t MONERO_Wallet_getBytesSent(void* wallet_ptr) { return wallet->getBytesSent(); } -bool MONERO_Wallet_getStateIsConnected(void* wallet_ptr) { +void MONERO_Wallet_setLedgerExchange(void* wallet_ptr, int (*sendToLedgerDevice) (unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len)) { Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->getStateIsConnected(); -} - -unsigned char* MONERO_Wallet_getSendToDevice(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->getSendToDevice(); -} - -size_t MONERO_Wallet_getSendToDeviceLength(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->getSendToDeviceLength(); -} - -unsigned char* MONERO_Wallet_getReceivedFromDevice(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->getReceivedFromDevice(); -} - -size_t MONERO_Wallet_getReceivedFromDeviceLength(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->getReceivedFromDeviceLength(); -} - -bool MONERO_Wallet_getWaitsForDeviceSend(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->getWaitsForDeviceSend(); -} - -bool MONERO_Wallet_getWaitsForDeviceReceive(void* wallet_ptr) { - Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->getWaitsForDeviceReceive(); -} - -void MONERO_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned char* data, size_t len) { - Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->setDeviceReceivedData(data, len); -} - -void MONERO_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, size_t len) { - Monero::Wallet *wallet = reinterpret_cast(wallet_ptr); - return wallet->setDeviceSendData(data, len); + return wallet->setLedgerExchange(sendToLedgerDevice); } void* MONERO_WalletManager_createWallet(void* wm_ptr, const char* path, const char* password, const char* language, int networkType) { diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h index 143da40..80a72c5 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h @@ -834,15 +834,7 @@ extern ADDAPI uint64_t MONERO_Wallet_getBytesReceived(void* wallet_ptr); // virtual uint64_t getBytesSent() = 0; extern ADDAPI uint64_t MONERO_Wallet_getBytesSent(void* wallet_ptr); // HIDAPI_DUMMY -extern ADDAPI bool MONERO_Wallet_getStateIsConnected(void* wallet_ptr); -extern ADDAPI unsigned char* MONERO_Wallet_getSendToDevice(void* wallet_ptr); -extern ADDAPI size_t MONERO_Wallet_getSendToDeviceLength(void* wallet_ptr); -extern ADDAPI unsigned char* MONERO_Wallet_getReceivedFromDevice(void* wallet_ptr); -extern ADDAPI size_t MONERO_Wallet_getReceivedFromDeviceLength(void* wallet_ptr); -extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceSend(void* wallet_ptr); -extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceReceive(void* wallet_ptr); -extern ADDAPI void MONERO_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned char* data, size_t len); -extern ADDAPI void MONERO_Wallet_setDeviceSendData(void* wallet_ptr, unsigned char* data, size_t len); +extern ADDAPI void MONERO_Wallet_setLedgerExchange(void* wallet_ptr, int (*sendToLedgerDevice) (unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len)); // }; // struct WalletManager -- cgit v1.2.3