ares_lora.ImageManagerException
¶
ares_lora.AresImageStates
dataclass
¶
Data class for image states.
Attributes:
| Name | Type | Description |
|---|---|---|
slot |
int
|
The image slot. |
version |
str
|
The version of the image. |
hash |
bytes
|
The hash of the image. |
bootable |
bool
|
Flag indicating if the image is bootable. |
pending |
bool
|
Flag indicating image is pending. |
confirmed |
bool
|
Flag indicating image has been confirmed. |
active |
bool
|
Flag indicating image is active. |
permanent |
bool
|
Flag indicating the image is permanent. |
Source code in serial-driver/src/ares_lora/dfu.py
ares_lora.AresImageStates.from_smp_lib
classmethod
¶
from_smp_lib(states: ImageState) -> AresImageStates
Construct an AresImageStates object from an ImageState object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
states
|
ImageState
|
The |
required |
Returns:
| Type | Description |
|---|---|
AresImageStates
|
A constructed |
Source code in serial-driver/src/ares_lora/dfu.py
ares_lora.AresUploadStatusBase
¶
Bases: ABC
Base class for upload status CLI utilities. This must be subclassed.
Source code in serial-driver/src/ares_lora/dfu.py
ares_lora.AresUploadStatusBase.__init__
¶
__init__(image_len: int)
Initializes the base class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_len
|
int
|
The length of the image in bytes. |
required |
ares_lora.AresDfu
¶
Device firmware update manager for Ares LoRa.
Source code in serial-driver/src/ares_lora/dfu.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
ares_lora.AresDfu.__init__
¶
__init__(
port: str,
verbose: bool = False,
upload_status_cls: Type[AresUploadStatusBase] = AresUploadStatus,
)
Initializes AresDfu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
str
|
The port that supports the Dfu protocol. |
required |
verbose
|
bool
|
Run DFU in verbose mode. |
False
|
upload_status_cls
|
Type[AresUploadStatusBase]
|
The upload status class. |
AresUploadStatus
|
Source code in serial-driver/src/ares_lora/dfu.py
ares_lora.AresDfu.confirm_image
¶
Confirm an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot
|
int
|
The image to confirm (index). |
0
|
force
|
bool
|
Force the confirmation. |
False
|
timeout
|
float
|
The response timeout in seconds. |
2.5
|
Raises:
| Type | Description |
|---|---|
ImageManagerException
|
Unable to confirm image. |
Source code in serial-driver/src/ares_lora/dfu.py
ares_lora.AresDfu.mark_image_pending
¶
Mark an image as pending.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot
|
int
|
The image to mark as pending (index). |
1
|
timeout
|
float
|
The timeout for the request in seconds. |
2.5
|
Raises:
| Type | Description |
|---|---|
ImageManagerException
|
Unable to mark image as pending. |
Source code in serial-driver/src/ares_lora/dfu.py
ares_lora.AresDfu.read_image_states
¶
read_image_states(timeout: float = 2.0) -> tuple[AresImageStates, ...]
Read the images and their states from the microcontroller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Timeout in seconds to complete this operation. |
2.0
|
Returns:
| Type | Description |
|---|---|
tuple[AresImageStates, ...]
|
A tuple of AresImageStates objects. |
Raises:
| Type | Description |
|---|---|
ImageManagerException
|
SMP Response errors or unknown responses. |
Source code in serial-driver/src/ares_lora/dfu.py
ares_lora.AresDfu.reset_mcu
¶
Reset the microcontroller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
bool
|
Force the reset. This will cause a cold restart as opposed to a warm restart. |
False
|
timeout
|
float
|
The timeout of the reset request in seconds. |
2.5
|
Raises:
| Type | Description |
|---|---|
ImageManagerException
|
Reset request failed. |
Source code in serial-driver/src/ares_lora/dfu.py
ares_lora.AresDfu.upload_image
¶
upload_image(
image_path: str | Path,
slot: int = 0,
retries: int = 3,
timeout: float = 40.0,
) -> None
Upload an image to the microcontroller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path
|
str | Path
|
The file path to the image to upload. |
required |
slot
|
int
|
The slot to upload the image to. |
0
|
retries
|
int
|
The maximum amount of retries. |
3
|
timeout
|
float
|
Timeout of the first write request in seconds. |
40.0
|
Raises:
| Type | Description |
|---|---|
ImageManagerException
|
Upload image failed. |