OtaService 接口定义
This commit is contained in:
@@ -73,3 +73,23 @@ type DeviceResponse struct {
|
||||
Message string
|
||||
Data interface{} // 响应内容
|
||||
}
|
||||
|
||||
// OtaService 定义了设备 OTA 升级相关的业务逻辑。
|
||||
type OtaService interface {
|
||||
// StartUpgrade 用于启动一个 OTA 升级任务。
|
||||
// areaControllerID: 目标区域主控的设备 ID。
|
||||
// firmwarePath: 新固件文件所在的临时目录的绝对路径。
|
||||
// targetVersion: 目标固件的版本号。
|
||||
// 返回创建的 OTA 任务 ID 和可能发生的错误。
|
||||
StartUpgrade(ctx context.Context, areaControllerID uint32, firmwarePath, targetVersion string) (uint32, error)
|
||||
|
||||
// GetUpgradeProgress 用于查询指定 OTA 任务的进度。
|
||||
// taskID: 要查询的 OTA 任务 ID。
|
||||
// 返回 OTA 任务的当前状态和可能发生的错误。
|
||||
GetUpgradeProgress(ctx context.Context, taskID uint32) (status models.OTATaskStatus, err error)
|
||||
|
||||
// StopUpgrade 用于请求停止一个正在进行的 OTA 升级任务。
|
||||
// taskID: 要停止的 OTA 任务 ID。
|
||||
// 注意:这只是一个尽力而为的操作。如果设备已开始下载或处理,可能无法立即中止。
|
||||
StopUpgrade(ctx context.Context, taskID uint32) error
|
||||
}
|
||||
|
||||
1
internal/domain/device/ota_service.go
Normal file
1
internal/domain/device/ota_service.go
Normal file
@@ -0,0 +1 @@
|
||||
package device
|
||||
Reference in New Issue
Block a user