85 lines
2.9 KiB
C#
85 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace AgroBase.Models.Operadores
|
|
{
|
|
public class WeedWorkerModel
|
|
{
|
|
public bool Iniciado { get; set; }
|
|
public DateTime IniciadoEm { get; set; }
|
|
public bool Pronto { get; set; }
|
|
public DateTime ProntoEm { get; set; }
|
|
public DateTime UltimaMensagem { get; set; }
|
|
public Dictionary<CameraFrameType, OAKCameraFrameModel> CameraFrames { get; set; } = new Dictionary<CameraFrameType, OAKCameraFrameModel>();
|
|
public WeedWorkerAnaliseModel Analise { get; set; } = new WeedWorkerAnaliseModel();
|
|
|
|
|
|
public WeedWorkerModel Clone()
|
|
{
|
|
return new WeedWorkerModel()
|
|
{
|
|
Iniciado = Iniciado,
|
|
IniciadoEm = IniciadoEm,
|
|
Pronto = Pronto,
|
|
ProntoEm = ProntoEm,
|
|
CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>(CameraFrames ?? new Dictionary<CameraFrameType, OAKCameraFrameModel>()),
|
|
Analise = Analise.Clone()
|
|
};
|
|
}
|
|
|
|
public void ReiniciarEstado()
|
|
{
|
|
Iniciado = false;
|
|
IniciadoEm = DateTime.MinValue;
|
|
Pronto = false;
|
|
ProntoEm = DateTime.MinValue;
|
|
CameraFrames = new Dictionary<CameraFrameType, OAKCameraFrameModel>();
|
|
}
|
|
}
|
|
|
|
public class WeedWorkerAnaliseModel
|
|
{
|
|
public DateTime timestamp { get; set; }
|
|
public int frame_width { get; set; }
|
|
public int frame_height { get; set; }
|
|
public List<WeedWorkerAnaliseDeteccaoModel> deteccoes { get; set; }
|
|
public Dictionary<int, bool> controle { get; set; }
|
|
public List<Dictionary<string, int>> ervas_identificadas { get; set; }
|
|
|
|
public WeedWorkerAnaliseModel Clone()
|
|
{
|
|
return new WeedWorkerAnaliseModel()
|
|
{
|
|
timestamp = timestamp,
|
|
deteccoes = new List<WeedWorkerAnaliseDeteccaoModel>(deteccoes),
|
|
controle = new Dictionary<int, bool>(controle),
|
|
ervas_identificadas = ervas_identificadas?.Select(dict => new Dictionary<string, int>(dict)).ToList()
|
|
};
|
|
}
|
|
}
|
|
|
|
public class WeedWorkerAnaliseDeteccaoModel
|
|
{
|
|
public int id { get; set; }
|
|
public double[] centro { get; set; }
|
|
public double[] bbox { get; set; }
|
|
public int class_id { get; set; }
|
|
public int ultimo_frame { get; set; }
|
|
public int frames_detectada { get; set; }
|
|
public string status { get; set; }
|
|
public string descricao { get; set; }
|
|
public double confianca { get; set; }
|
|
}
|
|
|
|
public enum WeedWorkerCommandType
|
|
{
|
|
ScriptCarregado = 1,
|
|
IniciarCameraManager = 2,
|
|
AtualizarSaudeCamera = 3,
|
|
GetCameraFrame = 4,
|
|
SaveCameraFrames = 5,
|
|
EnviarDadosControle = 6,
|
|
}
|
|
}
|