feat: support firmware update control for esp-hosted

This commit is contained in:
Ulf Lilleengen
2025-11-27 13:49:41 +01:00
parent 7ff2baf4e2
commit d11e1dbe61

View File

@@ -24,6 +24,11 @@ pub struct Control<'a> {
shared: &'a Shared,
}
/// Handle for managing firmware update.
pub struct UpdateControl<'a, 'd> {
control: &'a mut Control<'d>,
}
/// WiFi mode.
#[allow(unused)]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
@@ -146,6 +151,13 @@ impl<'a> Control<'a> {
Ok(())
}
/// Initiate a firmware update.
pub async fn update(&mut self) -> Result<UpdateControl<'_, 'a>, Error> {
let req = proto::CtrlMsg_Req_OTABegin {};
ioctl!(self, ReqOtaBegin, RespOtaBegin, req, resp);
Ok(UpdateControl { control: self })
}
/// duration in seconds, clamped to [10, 3600]
async fn set_heartbeat(&mut self, duration: u32) -> Result<(), Error> {
let req = proto::CtrlMsg_Req_ConfigHeartbeat {