diff --git a/src/infuse_iot/rpc_wrappers/application_info.py b/src/infuse_iot/rpc_wrappers/application_info.py index 5298578..f5f7607 100644 --- a/src/infuse_iot/rpc_wrappers/application_info.py +++ b/src/infuse_iot/rpc_wrappers/application_info.py @@ -22,7 +22,7 @@ def request_json(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query application info ({errno.strerror(-return_code)})") return r = response diff --git a/src/infuse_iot/rpc_wrappers/lte_state.py b/src/infuse_iot/rpc_wrappers/lte_state.py index acea112..9cbd6cb 100644 --- a/src/infuse_iot/rpc_wrappers/lte_state.py +++ b/src/infuse_iot/rpc_wrappers/lte_state.py @@ -25,7 +25,7 @@ def request_json(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query LTE state ({errno.strerror(-return_code)})") return common = response.common diff --git a/src/infuse_iot/rpc_wrappers/lte_state_v2.py b/src/infuse_iot/rpc_wrappers/lte_state_v2.py index 33aaed4..dea80d5 100644 --- a/src/infuse_iot/rpc_wrappers/lte_state_v2.py +++ b/src/infuse_iot/rpc_wrappers/lte_state_v2.py @@ -25,7 +25,7 @@ def request_json(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query LTE state ({errno.strerror(-return_code)})") return common = response.common diff --git a/src/infuse_iot/rpc_wrappers/security_state.py b/src/infuse_iot/rpc_wrappers/security_state.py index 2250e76..93ac68c 100644 --- a/src/infuse_iot/rpc_wrappers/security_state.py +++ b/src/infuse_iot/rpc_wrappers/security_state.py @@ -87,7 +87,7 @@ def _decrypt_response(self, response): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query security state ({errno.strerror(-return_code)})") return def print_bytes(ctypes_array) -> str: diff --git a/src/infuse_iot/rpc_wrappers/wifi_scan.py b/src/infuse_iot/rpc_wrappers/wifi_scan.py index 8d90d84..641743f 100644 --- a/src/infuse_iot/rpc_wrappers/wifi_scan.py +++ b/src/infuse_iot/rpc_wrappers/wifi_scan.py @@ -21,7 +21,7 @@ def request_struct(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to scan wifi networks ({errno.strerror(-return_code)})") return table = [] diff --git a/src/infuse_iot/rpc_wrappers/wifi_state.py b/src/infuse_iot/rpc_wrappers/wifi_state.py index c974d95..ee7587b 100644 --- a/src/infuse_iot/rpc_wrappers/wifi_state.py +++ b/src/infuse_iot/rpc_wrappers/wifi_state.py @@ -91,7 +91,7 @@ def request_struct(self): def handle_response(self, return_code, response): if return_code != 0: - print(f"Failed to query current time ({errno.strerror(-return_code)})") + print(f"Failed to query WiFi state ({errno.strerror(-return_code)})") return common = response.common diff --git a/src/infuse_iot/tools/rpc_cloud.py b/src/infuse_iot/tools/rpc_cloud.py index 15d7066..4009023 100644 --- a/src/infuse_iot/tools/rpc_cloud.py +++ b/src/infuse_iot/tools/rpc_cloud.py @@ -22,7 +22,6 @@ 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 from infuse_iot.zephyr.errno import errno @@ -39,6 +38,7 @@ def add_parser(cls, parser): parser_queue.set_defaults(_tool_action="queue") parser_queue.add_argument("--id", required=True, type=lambda x: int(x, 0), help="Infuse ID to run command on") parser_queue.add_argument("--queue-timeout", type=int, default=600, help="Timeout to send command in seconds") + parser_queue.add_argument("--print-params", action="store_true", help="Print queued RPC request") command_list_parser = parser_queue.add_subparsers(title="commands", metavar="", required=True) for _, name, _ in pkgutil.walk_packages(wrappers.__path__): @@ -82,9 +82,13 @@ def queue(self, client: Client): if command.RPC_DATA_RECEIVE: # Generic "unknown" data volume - rpc_req.data_header = RPCReqDataHeader(UINT32_MAX, 0) + rpc_req.data_header = RPCReqDataHeader(command.data_payload_recv_len(), 0) rpc_msg = NewRPCMessage(infuse_id, rpc_req, timeout_ms) + + if self._args.print_params: + print(f"Request: {rpc_msg.to_dict()}") + rsp = send_rpc.sync(client=client, body=rpc_msg) if rsp is None: sys.exit("Failed to queue RPC (No response)")