Skip to content

Commit

Permalink
add dummy device to monero codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCyjaneK committed Jun 26, 2024
1 parent 4f4cde8 commit 34a3616
Show file tree
Hide file tree
Showing 5 changed files with 563 additions and 6 deletions.
10 changes: 5 additions & 5 deletions build_single.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,16 @@ pushd $repo/build/${HOST_ABI}
env CC="${CC}" CXX="${CXX}" cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64="ON" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=false -D BUILD_TAG="linux-armv8" -D CMAKE_SYSTEM_NAME="Linux" ../..
;;
"x86_64-linux-android")
env CC="${CC}" CXX="${CXX}" cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="x86-64" -D STATIC=ON -D BUILD_64="ON" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=true -D BUILD_TAG="android-x86_64" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_ARCH_ABI="x86_64" ../..
env CC="${CC}" CXX="${CXX}" cmake -DHIDAPI_DUMMY=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="x86-64" -D STATIC=ON -D BUILD_64="ON" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=true -D BUILD_TAG="android-x86_64" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_ARCH_ABI="x86_64" ../..
;;
"i686-linux-android")
env CC="${CC}" CXX="${CXX}" cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="x86" -D STATIC=ON -D BUILD_64="OFF" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=true -D BUILD_TAG="android-x86" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_ARCH_ABI="x86" ../..
env CC="${CC}" CXX="${CXX}" cmake -DHIDAPI_DUMMY=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="x86" -D STATIC=ON -D BUILD_64="OFF" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=true -D BUILD_TAG="android-x86" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_ARCH_ABI="x86" ../..
;;
"aarch64-linux-android")
env CC="${CC}" CXX="${CXX}" cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64="ON" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=true -D BUILD_TAG="android-armv8" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_ARCH_ABI="arm64-v8a" ../..
env CC="${CC}" CXX="${CXX}" cmake -DHIDAPI_DUMMY=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64="ON" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=true -D BUILD_TAG="android-armv8" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_ARCH_ABI="arm64-v8a" ../..
;;
"armv7a-linux-androideabi")
env CC="${CC}" CXX="${CXX}" cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64="OFF" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=true -D BUILD_TAG="android-armv7" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_ARCH_ABI="armeabi-v7a" ../..
env CC="${CC}" CXX="${CXX}" cmake -DHIDAPI_DUMMY=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64="OFF" -D CMAKE_BUILD_TYPE=$buildType -D ANDROID=true -D BUILD_TAG="android-armv7" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_ARCH_ABI="armeabi-v7a" ../..
;;
"x86_64-w64-mingw32")
env CC="${CC}" CXX="${CXX}" cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=$buildType -D BUILD_TAG="win-x64" ../..
Expand Down Expand Up @@ -306,7 +306,7 @@ pushd $repo/build/${HOST_ABI}
env \
CMAKE_INCLUDE_PATH="${PREFIX}/include" \
CMAKE_LIBRARY_PATH="${PREFIX}/lib" \
CC="${IOS_CC}" CXX="${IOS_CXX}" cmake -D IOS=ON -D ARCH=arm64 -D CMAKE_BUILD_DYPE=$buildType -D STATIC=ON -D BUILD_GUI_DEPS=1 -D UNBOUND_INCLUDE_DIR="${PREFIX}/lib" ../..
CC="${IOS_CC}" CXX="${IOS_CXX}" cmake -DHIDAPI_DUMMY=ON -D IOS=ON -D ARCH=arm64 -D CMAKE_BUILD_DYPE=$buildType -D STATIC=ON -D BUILD_GUI_DEPS=1 -D UNBOUND_INCLUDE_DIR="${PREFIX}/lib" ../..
;;
*)
echo "we don't know how to compile monero for '$HOST_ABI'"
Expand Down
11 changes: 10 additions & 1 deletion monero_libwallet2_api_c/monero_libwallet2_api_c.exp
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,13 @@ _MONERO_Wallet_submitTransactionUR
_MONERO_Wallet_exportOutputsUR
_MONERO_Wallet_exportKeyImagesUR
_MONERO_Wallet_importKeyImagesUR
_MONERO_Wallet_importOutputsUR
_MONERO_Wallet_importOutputsUR
_MONERO_Wallet_getStateIsConnected
_MONERO_Wallet_getSendToDevice
_MONERO_Wallet_getSendToDeviceLength
_MONERO_Wallet_getReceivedFromDevice
_MONERO_Wallet_getReceivedFromDeviceLength
_MONERO_Wallet_getWaitsForDeviceSend
_MONERO_Wallet_getWaitsForDeviceReceive
_MONERO_Wallet_setDeviceReceivedData
_MONERO_Wallet_setDeviceSendData
44 changes: 44 additions & 0 deletions monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,50 @@ uint64_t MONERO_Wallet_getBytesSent(void* wallet_ptr) {
return wallet->getBytesSent();
}

bool MONERO_Wallet_getStateIsConnected(void* wallet_ptr) {
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->getStateIsConnected();
}

unsigned char* MONERO_Wallet_getSendToDevice(void* wallet_ptr) {
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->getSendToDevice();
}

size_t MONERO_Wallet_getSendToDeviceLength(void* wallet_ptr) {
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->getSendToDeviceLength();
}

unsigned char* MONERO_Wallet_getReceivedFromDevice(void* wallet_ptr) {
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->getReceivedFromDevice();
}

size_t MONERO_Wallet_getReceivedFromDeviceLength(void* wallet_ptr) {
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->getReceivedFromDeviceLength();
}

bool MONERO_Wallet_getWaitsForDeviceSend(void* wallet_ptr) {
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->getWaitsForDeviceSend();
}

bool MONERO_Wallet_getWaitsForDeviceReceive(void* wallet_ptr) {
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr);
return wallet->getWaitsForDeviceReceive();
}

void MONERO_Wallet_setDeviceReceivedData(void* wallet_ptr, unsigned char* data, size_t len) {
Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(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<Monero::Wallet*>(wallet_ptr);
return wallet->setDeviceSendData(data, len);
}

void* MONERO_WalletManager_createWallet(void* wm_ptr, const char* path, const char* password, const char* language, int networkType) {
Monero::WalletManager *wm = reinterpret_cast<Monero::WalletManager*>(wm_ptr);
Expand Down
10 changes: 10 additions & 0 deletions monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,16 @@ extern ADDAPI bool MONERO_Wallet_reconnectDevice(void* wallet_ptr);
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);
// };

// struct WalletManager
Expand Down
Loading

0 comments on commit 34a3616

Please sign in to comment.