From 2735778d3fb8d61dd597f3daa7ad002ac1894ba4 Mon Sep 17 00:00:00 2001
From: Jordan Yates <jordan@embeint.com>
Date: Tue, 10 Feb 2026 10:08:03 +1000
Subject: [PATCH 1/3] tools: rpc_cloud: add data header param to requests

RPCs that are sending `RPC_DATA` packets require the data header to be
provided to the cloud. Provide the generic "unknown" value.

Signed-off-by: Jordan Yates <jordan@embeint.com>
---
 src/infuse_iot/tools/rpc_cloud.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/infuse_iot/tools/rpc_cloud.py b/src/infuse_iot/tools/rpc_cloud.py
index f6cbbe6..7b7ea19 100644
--- a/src/infuse_iot/tools/rpc_cloud.py
+++ b/src/infuse_iot/tools/rpc_cloud.py
@@ -16,11 +16,12 @@
 import infuse_iot.rpc_wrappers as wrappers
 from infuse_iot.api_client import Client
 from infuse_iot.api_client.api.rpc import get_rpc_by_id, send_rpc
-from infuse_iot.api_client.models import Error, NewRPCMessage, NewRPCReq, RPCParams, RpcRsp
+from infuse_iot.api_client.models import Error, NewRPCMessage, NewRPCReq, RPCParams, RPCReqDataHeader, RpcRsp
 from infuse_iot.api_client.models.downlink_message_status import DownlinkMessageStatus
 from infuse_iot.commands import InfuseCommand, InfuseRpcCommand
 from infuse_iot.credentials import get_api_key
 from infuse_iot.definitions.rpc import id_type_mapping
+from infuse_iot.util.ctypes import UINT32_MAX
 
 
 class SubCommand(InfuseCommand):
@@ -77,6 +78,10 @@ def queue(self, client: Client):
             params_encoded = base64.b64encode(struct_bytes).decode("utf-8")
             rpc_req = NewRPCReq(command_id=command.COMMAND_ID, params_encoded=params_encoded)
 
+        if command.RPC_DATA_RECEIVE:
+            # Generic "unknown" data volume
+            rpc_req.data_header = RPCReqDataHeader(UINT32_MAX, 0)
+
         rpc_msg = NewRPCMessage(infuse_id, rpc_req, timeout_ms)
         rsp = send_rpc.sync(client=client, body=rpc_msg)
         if isinstance(rsp, Error) or rsp is None:

From 934323ec1f15bf319badc8959ee922d029e6bf12 Mon Sep 17 00:00:00 2001
From: Jordan Yates <jordan@embeint.com>
Date: Tue, 10 Feb 2026 10:16:30 +1000
Subject: [PATCH 2/3] tools: rpc_cloud: improve error displays

Perform some minimal formatting of returned errors if queuing a RPC
fails.

Signed-off-by: Jordan Yates <jordan@embeint.com>
---
 src/infuse_iot/tools/rpc_cloud.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/infuse_iot/tools/rpc_cloud.py b/src/infuse_iot/tools/rpc_cloud.py
index 7b7ea19..d4e7842 100644
--- a/src/infuse_iot/tools/rpc_cloud.py
+++ b/src/infuse_iot/tools/rpc_cloud.py
@@ -84,8 +84,13 @@ def queue(self, client: Client):
 
         rpc_msg = NewRPCMessage(infuse_id, rpc_req, timeout_ms)
         rsp = send_rpc.sync(client=client, body=rpc_msg)
-        if isinstance(rsp, Error) or rsp is None:
-            sys.exit(f"Failed to queue RPC ({rsp})")
+        if rsp is None:
+            sys.exit("Failed to queue RPC (No response)")
+        elif isinstance(rsp, Error) or rsp is None:
+            msg = "Failed to queue RPC\n"
+            msg += f"\t Code: {rsp.code}\n"
+            msg += f"\t  Msg: '{rsp.message}'"
+            sys.exit(msg)
         print("Query RPC state with:")
         print(f"\tinfuse rpc_cloud query --id {rsp.id}")
 

From 9346b6c3e0f7cec350e3a381eb6551c4f060e36b Mon Sep 17 00:00:00 2001
From: Jordan Yates <jordan@embeint.com>
Date: Tue, 10 Feb 2026 10:17:15 +1000
Subject: [PATCH 3/3] rpc_wrappers: data_logger_read: fix cloud queuing

The integer parameters must be encoded as strings.

Signed-off-by: Jordan Yates <jordan@embeint.com>
---
 src/infuse_iot/rpc_wrappers/data_logger_read.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/infuse_iot/rpc_wrappers/data_logger_read.py b/src/infuse_iot/rpc_wrappers/data_logger_read.py
index 75ae4f8..5c23750 100644
--- a/src/infuse_iot/rpc_wrappers/data_logger_read.py
+++ b/src/infuse_iot/rpc_wrappers/data_logger_read.py
@@ -38,7 +38,7 @@ def request_struct(self):
         return self.request(self.logger, self.start, self.last)
 
     def request_json(self):
-        return {"logger": self.logger.name, "start_block": self.start, "last_block": self.last}
+        return {"logger": self.logger.name, "start_block": str(self.start), "last_block": str(self.last)}
 
     def data_recv_cb(self, offset: int, data: bytes) -> None:
         if self.expected_offset == 0:
