Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/infuse_iot/rpc_wrappers/application_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/infuse_iot/rpc_wrappers/lte_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/infuse_iot/rpc_wrappers/lte_state_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/infuse_iot/rpc_wrappers/security_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/infuse_iot/rpc_wrappers/wifi_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion src/infuse_iot/rpc_wrappers/wifi_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/infuse_iot/tools/rpc_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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="<command>", required=True)

for _, name, _ in pkgutil.walk_packages(wrappers.__path__):
Expand Down Expand Up @@ -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)")
Expand Down
Loading