From 4e606de2b3f9d986584984cbf7463f6c0ac81ed2 Mon Sep 17 00:00:00 2001 From: Rodrigo Alfonso Date: Sun, 25 Aug 2024 21:30:03 -0300 Subject: [PATCH] Fixing LinkMobile C binding --- lib/LinkMobile.hpp | 4 +--- lib/c_bindings/C_LinkMobile.cpp | 2 +- lib/c_bindings/C_LinkMobile.h | 28 ++++++++++++++++------------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/LinkMobile.hpp b/lib/LinkMobile.hpp index ddee9cd..e90423e 100644 --- a/lib/LinkMobile.hpp +++ b/lib/LinkMobile.hpp @@ -216,9 +216,7 @@ class LinkMobile { u8 connectionId = 0; }; - struct CloseConn : public AsyncRequest { - bool success = false; - }; + struct CloseConn : public AsyncRequest {}; struct DataTransfer : public AsyncRequest { u8 data[LINK_MOBILE_MAX_USER_TRANSFER_LENGTH] = {}; diff --git a/lib/c_bindings/C_LinkMobile.cpp b/lib/c_bindings/C_LinkMobile.cpp index 9efd310..8fc86cb 100644 --- a/lib/c_bindings/C_LinkMobile.cpp +++ b/lib/c_bindings/C_LinkMobile.cpp @@ -127,10 +127,10 @@ C_LinkMobile_Error C_LinkMobile_getError(C_LinkMobileHandle handle) { LinkMobile::Error error = static_cast(handle)->getError(); return {static_cast(error.type), static_cast(error.state), - error.cmdIsSending, error.cmdId, static_cast(error.cmdResult), error.cmdErrorCode, + error.cmdIsSending, error.reqType}; } diff --git a/lib/c_bindings/C_LinkMobile.h b/lib/c_bindings/C_LinkMobile.h index 0c780af..271f515 100644 --- a/lib/c_bindings/C_LinkMobile.h +++ b/lib/c_bindings/C_LinkMobile.h @@ -78,35 +78,39 @@ typedef enum { typedef struct { C_LinkMobile_ErrorType type; C_LinkMobile_State state; - bool cmdIsSending; u8 cmdId; C_LinkMobile_CommandResult cmdResult; - u32 cmdErrorCode; + u8 cmdErrorCode; + bool cmdIsSending; int reqType; } C_LinkMobile_Error; typedef struct { - u32 connectionId; - bool completed; - u32 size; - u8 data[254]; -} C_LinkMobile_DataTransfer; + volatile bool completed; + bool success; + + u8 ipv4[4]; +} C_LinkMobile_DNSQuery; typedef struct { - u32 connectionId; + volatile bool completed; bool success; + + u32 connectionId; } C_LinkMobile_OpenConn; typedef struct { - u32 connectionId; + volatile bool completed; bool success; } C_LinkMobile_CloseConn; typedef struct { - u8 ipv4[4]; + volatile bool completed; bool success; - bool completed; -} C_LinkMobile_DNSQuery; + + u8 data[C_LINK_MOBILE_MAX_USER_TRANSFER_LENGTH]; + u8 size; +} C_LinkMobile_DataTransfer; typedef struct { char magic[2];