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
51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[build-system]
requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"

[project]
name = "infuse_iot"
version = "0.1.0"
authors = [{name = "Embeint Holdings Pty Ltd", email = "[email protected]"}]
description = "Infuse-IoT Platform python package"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
]
requires-python = ">=3.10"
dependencies = [
"argcomplete",
"attrs",
"cryptography",
"colorama",
"httpx",
"pylink-square",
"pynrfjprog",
"pyserial",
"python-dateutil",
"rich",
"simple-term-menu",
"tabulate",
"typing-extensions",
"keyring",
]

[project.license]
file = "LICENSE"

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.scripts]
infuse = "infuse_iot.app.main:main"

[tool.setuptools]
package-dir = {"" = "src"}
zip-safe = false
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]
namespaces = false
40 changes: 0 additions & 40 deletions setup.py

This file was deleted.

15 changes: 13 additions & 2 deletions src/infuse_iot/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,32 @@ def run(self):


class InfuseRpcCommand:
RPC_DATA = False

@classmethod
def add_parser(cls, parser: argparse.ArgumentParser):
raise NotImplementedError

def __init__(self, **kwargs):
pass

def auth_level(self):
def auth_level(self) -> Auth:
"""Authentication level to run command with"""
return Auth.DEVICE

def request_struct(self):
def request_struct(self) -> ctypes.LittleEndianStructure:
"""RPC_CMD request structure"""
raise NotImplementedError

def data_payload(self) -> bytes:
"""Payload to send with RPC_DATA"""
raise NotImplementedError

def data_progress_cb(self, offset: int) -> None:
"""Progress callback"""

def handle_response(self, return_code, response):
"""Handle RPC_RSP"""
raise NotImplementedError

class VariableSizeResponse:
Expand Down
161 changes: 161 additions & 0 deletions src/infuse_iot/generated/rpc_definitions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
#!/usr/bin/env python3

"""Autogenerated RPC definitions"""

import ctypes
import enum


class rpc_struct_mcuboot_img_sem_ver(ctypes.LittleEndianStructure):
"""MCUboot semantic versioning struct"""

_fields_ = [
("major", ctypes.c_uint8),
("minor", ctypes.c_uint8),
("revision", ctypes.c_uint16),
("build_num", ctypes.c_uint32),
]
_pack_ = 1


class rpc_struct_kv_store_value(ctypes.LittleEndianStructure):
"""KV store data value"""

_fields_ = [
("id", ctypes.c_uint16),
("len", ctypes.c_int16),
("data", 0 * ctypes.c_uint8),
]
_pack_ = 1


class rpc_struct_kv_store_crc(ctypes.LittleEndianStructure):
"""KV store data CRC"""

_fields_ = [
("id", ctypes.c_uint16),
("crc", ctypes.c_int32),
]
_pack_ = 1


class rpc_struct_bt_addr_le(ctypes.LittleEndianStructure):
"""Bluetooth LE address"""

_fields_ = [
("type", ctypes.c_uint8),
("val", 6 * ctypes.c_uint8),
]
_pack_ = 1


class rpc_struct_ipv4_address(ctypes.LittleEndianStructure):
"""IPv4 address"""

_fields_ = [
("addr", 4 * ctypes.c_uint8),
]
_pack_ = 1


class rpc_struct_ipv6_address(ctypes.LittleEndianStructure):
"""IPv6 address"""

_fields_ = [
("addr", 16 * ctypes.c_uint8),
]
_pack_ = 1


class rpc_struct_network_state(ctypes.LittleEndianStructure):
"""Common network state"""

_fields_ = [
("state", ctypes.c_uint8),
("if_flags", ctypes.c_uint32),
("l2_flags", ctypes.c_uint16),
("mtu", ctypes.c_uint16),
("ipv4", rpc_struct_ipv4_address),
("ipv6", rpc_struct_ipv6_address),
]
_pack_ = 1


class rpc_struct_wifi_state(ctypes.LittleEndianStructure):
"""WiFi interface status"""

_fields_ = [
("state", ctypes.c_uint8),
("ssid", 32 * ctypes.c_char),
("bssid", 6 * ctypes.c_char),
("band", ctypes.c_uint8),
("channel", ctypes.c_uint8),
("iface_mode", ctypes.c_uint8),
("link_mode", ctypes.c_uint8),
("security", ctypes.c_uint8),
("rssi", ctypes.c_int8),
("beacon_interval", ctypes.c_uint16),
("twt_capable", ctypes.c_uint8),
]
_pack_ = 1


class rpc_struct_lte_state(ctypes.LittleEndianStructure):
"""LTE interface status"""

_fields_ = [
("registration_state", ctypes.c_uint8),
("access_technology", ctypes.c_uint8),
("mcc", ctypes.c_uint16),
("mnc", ctypes.c_uint16),
("cell_id", ctypes.c_uint32),
("tac", ctypes.c_uint32),
("tau", ctypes.c_uint32),
("earfcn", ctypes.c_uint16),
("band", ctypes.c_uint8),
("psm_active_time", ctypes.c_uint16),
("edrx_interval", ctypes.c_float),
("edrx_paging_window", ctypes.c_float),
("rsrp", ctypes.c_int16),
("rsrq", ctypes.c_int8),
]
_pack_ = 1


class rpc_struct_wifi_scan_result(ctypes.LittleEndianStructure):
"""WiFi interface status"""

_fields_ = [
("band", ctypes.c_uint8),
("channel", ctypes.c_uint8),
("security", ctypes.c_uint8),
("rssi", ctypes.c_int8),
("bssid", 6 * ctypes.c_char),
("ssid_len", ctypes.c_uint8),
("ssid", 0 * ctypes.c_char),
]
_pack_ = 1


class rpc_enum_bt_le_addr_type(enum.IntEnum):
"""Bluetooth LE address type"""

PUBLIC = 0
RANDOM = 1


class rpc_enum_file_action(enum.IntEnum):
"""Actions to take upon receiving a file"""

DISCARD = 0
APP_IMG = 1
BT_CTLR_IMG = 2
NRF91_MODEM_DIFF = 20


class rpc_enum_infuse_bt_characteristic(enum.IntEnum):
"""Infuse-IoT Bluetooth characteristics (Bitmask)"""

COMMAND = 1
DATA = 2

Loading