ajustes no protocolo LoRa
|
|
@ -169,43 +169,45 @@ namespace AgroBase.Forms
|
||||||
MessageBox.Show("Preencha o destinatario corretamente!");
|
MessageBox.Show("Preencha o destinatario corretamente!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Variaveis.IsAgroMonitor)
|
|
||||||
{
|
|
||||||
LoRaService.MontarMensagemEnvio(txtMensagem.Text, destinatario, LoRaTipoProtocolo.MensagemTexto, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Remove espaços extras e divide por espaço
|
|
||||||
string[] partes = txtMensagem.Text.Trim().Split(' ');
|
|
||||||
|
|
||||||
// Converte cada string para byte
|
try
|
||||||
List<byte> payload = new List<byte>();
|
{
|
||||||
foreach (var parte in partes)
|
// Remove espaços extras e divide por espaço
|
||||||
|
string[] partes = txtMensagem.Text.Trim().Split(' ');
|
||||||
|
|
||||||
|
// Converte cada string para byte
|
||||||
|
List<byte> payload = new List<byte>();
|
||||||
|
payload.AddRange(LoRaSerializer.CanPrefix(LoRaEspService.DadosLoRaParse.DadosLivre));
|
||||||
|
foreach (var parte in partes)
|
||||||
|
{
|
||||||
|
if (byte.TryParse(parte, System.Globalization.NumberStyles.HexNumber, null, out byte valor))
|
||||||
{
|
{
|
||||||
if (byte.TryParse(parte, System.Globalization.NumberStyles.HexNumber, null, out byte valor))
|
if (payload.Count < 8)
|
||||||
{
|
|
||||||
payload.Add(valor);
|
payload.Add(valor);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show($"Valor inválido: '{parte}'", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Envia usando seu método
|
{
|
||||||
bool success = Variaveis.LoraService.EnviarMensagem(CanMessagePosicaoDados.Dados2, payload.ToArray());
|
MessageBox.Show($"Valor inválido: '{parte}'", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
MessageBox.Show("Dados enviados com sucesso!");
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
|
if (Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"Erro ao enviar: {ex.Message}", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
LoRaService.EnviarDadosLoRa(payload.ToArray(), destinatario);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Variaveis.LoraService.EnviarDadosLoRaViaCAN(payload.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Dados enviados com sucesso: " + FuncoesGlobais.ConverterComandoBytesParaTexto(payload.ToArray()));
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Erro ao enviar: {ex.Message}", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
|
||||||
AtualizarConsole(Parametros.address, destinatario, txtMensagem.Text);
|
AtualizarConsole(Parametros.address, destinatario, txtMensagem.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ using System.Threading.Tasks;
|
||||||
using static AgroBase.Models.Enums;
|
using static AgroBase.Models.Enums;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using static AgroBase.Services.LoRaEspService;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace AgroBase.Models.Modules
|
namespace AgroBase.Models.Modules
|
||||||
{
|
{
|
||||||
|
|
@ -2262,13 +2264,13 @@ namespace AgroBase.Models.Modules
|
||||||
|
|
||||||
Console.WriteLine($"[SEN] Componente={componente.ToString()}, ID_Num={ID_Num}, Posicao={posicao.ToString()}, Data={FuncoesGlobais.ConverterComandoBytesParaTexto(data)}");
|
Console.WriteLine($"[SEN] Componente={componente.ToString()}, ID_Num={ID_Num}, Posicao={posicao.ToString()}, Data={FuncoesGlobais.ConverterComandoBytesParaTexto(data)}");
|
||||||
|
|
||||||
switch (posicao)
|
switch (componente)
|
||||||
{
|
{
|
||||||
case CanMessagePosicaoDados.Status:
|
case S_Code.sMOD:
|
||||||
{
|
{
|
||||||
switch (componente)
|
switch (posicao)
|
||||||
{
|
{
|
||||||
case S_Code.sMOD:
|
case CanMessagePosicaoDados.Status:
|
||||||
{
|
{
|
||||||
T_Code tipoModulo = (T_Code)data[2];
|
T_Code tipoModulo = (T_Code)data[2];
|
||||||
bool conectado = data[3] == 1;
|
bool conectado = data[3] == 1;
|
||||||
|
|
@ -2281,7 +2283,14 @@ namespace AgroBase.Models.Modules
|
||||||
item.Versao = versao;
|
item.Versao = versao;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case S_Code.sLRA:
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case S_Code.sLRA:
|
||||||
|
{
|
||||||
|
switch (posicao)
|
||||||
|
{
|
||||||
|
case CanMessagePosicaoDados.Status:
|
||||||
{
|
{
|
||||||
bool Conectado = data[2] == 1;
|
bool Conectado = data[2] == 1;
|
||||||
bool Configurado = data[3] == 1;
|
bool Configurado = data[3] == 1;
|
||||||
|
|
@ -2292,73 +2301,7 @@ namespace AgroBase.Models.Modules
|
||||||
loraService.Parametros.UltimaLeitura = DateTime.Now;
|
loraService.Parametros.UltimaLeitura = DateTime.Now;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
case CanMessagePosicaoDados.Dados1:
|
||||||
{
|
|
||||||
bool Iniciado = data[2] == 1;
|
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CanMessagePosicaoDados.DadosAll:
|
|
||||||
{
|
|
||||||
if (componente == S_Code.sTOD)
|
|
||||||
{
|
|
||||||
int latenciaLoop = data[2];
|
|
||||||
Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.LatenciaLoop = latenciaLoop;
|
|
||||||
|
|
||||||
Console.WriteLine($"[SEN] Ciclo concluido. Latencia de loop: {latenciaLoop} ms");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CanMessagePosicaoDados.Dados1:
|
|
||||||
{
|
|
||||||
switch (componente)
|
|
||||||
{
|
|
||||||
case S_Code.sTMP:
|
|
||||||
{
|
|
||||||
double temperatura = ConverterByteParaDouble(data, 2);
|
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { temperatura });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case S_Code.sCOR:
|
|
||||||
{
|
|
||||||
double busVoltage = ConverterByteParaDouble(data, 2); // continua igual
|
|
||||||
double current = ConverterByteParaDouble(data, 4) * 1000.0; // volts / 100, amps * 10 (volta para mA)
|
|
||||||
double power = ConverterByteParaDouble(data, 6) * 1000.0; // volta para mW
|
|
||||||
Console.WriteLine($"[AB36V] Tensao {busVoltage}, Corrente: {current}, Power: {power}");
|
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { busVoltage, current, power });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case S_Code.sLED:
|
|
||||||
{
|
|
||||||
StatusLED statusLeitura = (StatusLED)data[2];
|
|
||||||
StatusLED statusComando = (StatusLED)data[3];
|
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { statusLeitura, statusComando });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case S_Code.sRLE:
|
|
||||||
{
|
|
||||||
Estado estado = (Estado)data[2];
|
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { estado });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case S_Code.sFRO:
|
|
||||||
{
|
|
||||||
int angulo = data[2];
|
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { angulo });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case S_Code.sIMU:
|
|
||||||
{
|
|
||||||
double roll = ConverterByteParaDouble(data, 2);
|
|
||||||
double pitch = ConverterByteParaDouble(data, 4);
|
|
||||||
double yaw = ConverterByteParaDouble(data, 6);
|
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { roll, pitch, yaw });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case S_Code.sLRA:
|
|
||||||
{
|
{
|
||||||
byte address = data[2];
|
byte address = data[2];
|
||||||
byte baudAndAirRate = data[3];
|
byte baudAndAirRate = data[3];
|
||||||
|
|
@ -2384,28 +2327,224 @@ namespace AgroBase.Models.Modules
|
||||||
loraService.Parametros.UltimaLeitura = DateTime.Now;
|
loraService.Parametros.UltimaLeitura = DateTime.Now;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Console.WriteLine($"[SEN] Resposta de {ID_Num} na posicao {posicao.ToString()} recebida. Parametros nao mapeados: {FuncoesGlobais.ConverterComandoBytesParaTexto(data)}");
|
DadosLoRaParse tipoDado = (DadosLoRaParse)posicao;
|
||||||
|
switch (tipoDado)
|
||||||
|
{
|
||||||
|
case DadosLoRaParse.ComandoControle:
|
||||||
|
{
|
||||||
|
Keys tecla = (Keys)data[2];
|
||||||
|
int percentualVelocidadeSp = data[3];
|
||||||
|
TipoMovimentoDirecional tipoMovimentoDirecional = (TipoMovimentoDirecional)data[4];
|
||||||
|
int anguloMp = data[5];
|
||||||
|
//int velocidadeMp = data[6];
|
||||||
|
T_Code dispositivo = (T_Code)data[6];
|
||||||
|
bool emergencia = data[7] == 1;
|
||||||
|
|
||||||
|
OperacaoControleBaseModel Controle = new OperacaoControleBaseModel()
|
||||||
|
{
|
||||||
|
Momento = DateTime.Now,
|
||||||
|
Tecla = tecla,
|
||||||
|
AnguloMP = anguloMp,
|
||||||
|
Emergencia = emergencia,
|
||||||
|
PercentualVelocidadeSP = percentualVelocidadeSp,
|
||||||
|
TipoMovimento = tipoMovimentoDirecional,
|
||||||
|
//VelocidadeMP = velocidadeMp,
|
||||||
|
Dispositivo = dispositivo
|
||||||
|
};
|
||||||
|
Variaveis.OperacaoEmAndamento.ExecutaComandoDaBase(Controle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.DadosLivre:
|
||||||
|
{
|
||||||
|
Console.WriteLine("[LRA] Dados livres LORA recebidos da base: " + FuncoesGlobais.ConverterComandoBytesParaTexto(data));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.GpsQualidade:
|
||||||
|
{
|
||||||
|
bool iniciado = data[2] == 1;
|
||||||
|
TiposCorrecaoGPS qualidadeFix = (TiposCorrecaoGPS)data[3];
|
||||||
|
int numeroSatelites = data[4];
|
||||||
|
double precisao = LoRaSerializer.DescompactarDecimal(data, 5);
|
||||||
|
|
||||||
|
VariaveisOperacao.PosicaoBase.Inicializado = iniciado;
|
||||||
|
VariaveisOperacao.PosicaoBase.QualidadeFix = qualidadeFix;
|
||||||
|
VariaveisOperacao.PosicaoBase.NumeroSatelites = numeroSatelites;
|
||||||
|
VariaveisOperacao.PosicaoBase.PrecisaoHorizontal = precisao;
|
||||||
|
VariaveisOperacao.PosicaoBase.Momento = DateTime.Now;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.GpsLatitude:
|
||||||
|
{
|
||||||
|
double _lat = LoRaSerializer.DescompactarCoordenada(data.Skip(2).ToArray());
|
||||||
|
VariaveisOperacao.PosicaoBase.Latitude = _lat;
|
||||||
|
VariaveisOperacao.PosicaoBase.Momento = DateTime.Now;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.GpsLongitude:
|
||||||
|
{
|
||||||
|
double _long = LoRaSerializer.DescompactarCoordenada(data.Skip(2).ToArray());
|
||||||
|
VariaveisOperacao.PosicaoBase.Longitude = _long;
|
||||||
|
VariaveisOperacao.PosicaoBase.Momento = DateTime.Now;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.GpsGerais:
|
||||||
|
{
|
||||||
|
double _altitude = LoRaSerializer.DescompactarDecimal(data, 2);
|
||||||
|
double _velocidade = LoRaSerializer.DescompactarDecimal(data, 4);
|
||||||
|
double _orientacao = LoRaSerializer.DescompactarDecimal(data, 6);
|
||||||
|
VariaveisOperacao.PosicaoBase.Altitude = _altitude;
|
||||||
|
VariaveisOperacao.PosicaoBase.Velocidade = _velocidade;
|
||||||
|
VariaveisOperacao.PosicaoBase.OrientacaoReal = _orientacao;
|
||||||
|
VariaveisOperacao.PosicaoBase.Momento = DateTime.Now;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CanMessagePosicaoDados.Dados2:
|
case S_Code.sTOD:
|
||||||
{
|
{
|
||||||
switch (componente)
|
switch (posicao)
|
||||||
{
|
{
|
||||||
case S_Code.sCOR:
|
case CanMessagePosicaoDados.DadosAll:
|
||||||
|
{
|
||||||
|
int latenciaLoop = data[2];
|
||||||
|
Variaveis.OperacaoEmAndamento.DispSen.Dados.DadosLeitura.LatenciaLoop = latenciaLoop;
|
||||||
|
Console.WriteLine($"[SEN] Ciclo concluido. Latencia de loop: {latenciaLoop} ms");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case S_Code.sTMP:
|
||||||
|
{
|
||||||
|
switch (posicao)
|
||||||
|
{
|
||||||
|
case CanMessagePosicaoDados.Status:
|
||||||
|
{
|
||||||
|
bool Iniciado = data[2] == 1;
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados1:
|
||||||
|
{
|
||||||
|
double temperatura = ConverterByteParaDouble(data, 2);
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { temperatura });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case S_Code.sCOR:
|
||||||
|
{
|
||||||
|
switch (posicao)
|
||||||
|
{
|
||||||
|
case CanMessagePosicaoDados.Status:
|
||||||
|
{
|
||||||
|
bool Iniciado = data[2] == 1;
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados1:
|
||||||
|
{
|
||||||
|
double busVoltage = ConverterByteParaDouble(data, 2); // continua igual
|
||||||
|
double current = ConverterByteParaDouble(data, 4) * 1000.0; // volts / 100, amps * 10 (volta para mA)
|
||||||
|
double power = ConverterByteParaDouble(data, 6) * 1000.0; // volta para mW
|
||||||
|
Console.WriteLine($"[AB36V] Tensao {busVoltage}, Corrente: {current}, Power: {power}");
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { busVoltage, current, power });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados2:
|
||||||
{
|
{
|
||||||
double energia = ConverterByteParaDouble(data, 2) * 1000.0; // volta para mWh
|
double energia = ConverterByteParaDouble(data, 2) * 1000.0; // volta para mWh
|
||||||
double temperatura = ConverterByteParaDouble(data, 4); // volta para °C
|
double temperatura = ConverterByteParaDouble(data, 4); // volta para °C
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { energia, temperatura });
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { energia, temperatura });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case S_Code.sIMU:
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case S_Code.sLED:
|
||||||
|
{
|
||||||
|
switch (posicao)
|
||||||
|
{
|
||||||
|
case CanMessagePosicaoDados.Status:
|
||||||
|
{
|
||||||
|
bool Iniciado = data[2] == 1;
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados1:
|
||||||
|
{
|
||||||
|
StatusLED statusLeitura = (StatusLED)data[2];
|
||||||
|
StatusLED statusComando = (StatusLED)data[3];
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { statusLeitura, statusComando });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case S_Code.sRLE:
|
||||||
|
{
|
||||||
|
switch (posicao)
|
||||||
|
{
|
||||||
|
case CanMessagePosicaoDados.Status:
|
||||||
|
{
|
||||||
|
bool Iniciado = data[2] == 1;
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados1:
|
||||||
|
{
|
||||||
|
Estado estado = (Estado)data[2];
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { estado });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case S_Code.sFRO:
|
||||||
|
{
|
||||||
|
switch (posicao)
|
||||||
|
{
|
||||||
|
case CanMessagePosicaoDados.Status:
|
||||||
|
{
|
||||||
|
bool Iniciado = data[2] == 1;
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados1:
|
||||||
|
{
|
||||||
|
int angulo = data[2];
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { angulo });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case S_Code.sIMU:
|
||||||
|
{
|
||||||
|
switch (posicao)
|
||||||
|
{
|
||||||
|
case CanMessagePosicaoDados.Status:
|
||||||
|
{
|
||||||
|
bool Iniciado = data[2] == 1;
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { Iniciado });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados1:
|
||||||
|
{
|
||||||
|
double roll = ConverterByteParaDouble(data, 2);
|
||||||
|
double pitch = ConverterByteParaDouble(data, 4);
|
||||||
|
double yaw = ConverterByteParaDouble(data, 6);
|
||||||
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { roll, pitch, yaw });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados2:
|
||||||
{
|
{
|
||||||
double temperatura = ConverterByteParaDouble(data, 2);
|
double temperatura = ConverterByteParaDouble(data, 2);
|
||||||
double pressao = ConverterValorEscala(data, 4, 10);
|
double pressao = ConverterValorEscala(data, 4, 10);
|
||||||
|
|
@ -2413,47 +2552,15 @@ namespace AgroBase.Models.Modules
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { temperatura, pressao, altitude });
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { temperatura, pressao, altitude });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case S_Code.sLRA:
|
case CanMessagePosicaoDados.Dados3:
|
||||||
{
|
|
||||||
Console.WriteLine("Dados LORA recebidos da base: " + FuncoesGlobais.ConverterComandoBytesParaTexto(data));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Console.WriteLine($"[SEN] Resposta de {ID_Num} na posicao {posicao.ToString()} recebida. Parametros nao mapeados: {FuncoesGlobais.ConverterComandoBytesParaTexto(data)}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CanMessagePosicaoDados.Dados3:
|
|
||||||
{
|
|
||||||
switch (componente)
|
|
||||||
{
|
|
||||||
case S_Code.sIMU:
|
|
||||||
{
|
{
|
||||||
double accX = ConverterByteParaDouble(data, 2);
|
double accX = ConverterByteParaDouble(data, 2);
|
||||||
double accY = ConverterByteParaDouble(data, 4);
|
double accY = ConverterByteParaDouble(data, 4);
|
||||||
double accZ = ConverterByteParaDouble(data, 6);
|
double accZ = ConverterByteParaDouble(data, 6);
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { accX, accY, accZ});
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { accX, accY, accZ });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados4:
|
||||||
default:
|
|
||||||
{
|
|
||||||
Console.WriteLine($"[SEN] Resposta de {ID_Num} na posicao {posicao.ToString()} recebida. Parametros nao mapeados: {FuncoesGlobais.ConverterComandoBytesParaTexto(data)}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CanMessagePosicaoDados.Dados4:
|
|
||||||
{
|
|
||||||
switch (componente)
|
|
||||||
{
|
|
||||||
case S_Code.sIMU:
|
|
||||||
{
|
{
|
||||||
double gyrX = ConverterByteParaDouble(data, 2);
|
double gyrX = ConverterByteParaDouble(data, 2);
|
||||||
double gyrY = ConverterByteParaDouble(data, 4);
|
double gyrY = ConverterByteParaDouble(data, 4);
|
||||||
|
|
@ -2461,21 +2568,7 @@ namespace AgroBase.Models.Modules
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { gyrX, gyrY, gyrZ });
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { gyrX, gyrY, gyrZ });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CanMessagePosicaoDados.Dados5:
|
||||||
default:
|
|
||||||
{
|
|
||||||
Console.WriteLine($"[SEN] Resposta de {ID_Num} na posicao {posicao.ToString()} recebida. Parametros nao mapeados: {FuncoesGlobais.ConverterComandoBytesParaTexto(data)}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case CanMessagePosicaoDados.Dados5:
|
|
||||||
{
|
|
||||||
switch (componente)
|
|
||||||
{
|
|
||||||
case S_Code.sIMU:
|
|
||||||
{
|
{
|
||||||
double magX = ConverterByteParaDouble(data, 2);
|
double magX = ConverterByteParaDouble(data, 2);
|
||||||
double magY = ConverterByteParaDouble(data, 4);
|
double magY = ConverterByteParaDouble(data, 4);
|
||||||
|
|
@ -2483,14 +2576,7 @@ namespace AgroBase.Models.Modules
|
||||||
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { magX, magY, magZ });
|
DefinirOuCriar(ID_Num, posicao, componente, new List<dynamic>() { magX, magY, magZ });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Console.WriteLine($"[SEN] Resposta de {ID_Num} na posicao {posicao.ToString()} recebida. Parametros nao mapeados: {FuncoesGlobais.ConverterComandoBytesParaTexto(data)}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -367,7 +367,7 @@ namespace AgroBase.Models
|
||||||
return 0.7;
|
return 0.7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static GPSModel PosicaoBase { get; set; }
|
public static GPSModel PosicaoBase { get; set; } = new GPSModel();
|
||||||
|
|
||||||
|
|
||||||
public static void RegistrarLogDispositivo(List<string> Logs, T_Code Dispositivo, string Sulfixo, int MinLogs = 100)
|
public static void RegistrarLogDispositivo(List<string> Logs, T_Code Dispositivo, string Sulfixo, int MinLogs = 100)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,11 @@ namespace AgroBase.Services
|
||||||
Command3 = 103,
|
Command3 = 103,
|
||||||
Command4 = 104,
|
Command4 = 104,
|
||||||
Command5 = 105,
|
Command5 = 105,
|
||||||
|
Command6 = 106,
|
||||||
|
Command7 = 107,
|
||||||
|
Command8 = 108,
|
||||||
|
Command9 = 109,
|
||||||
|
Command10 = 110,
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ICanMessageHandler
|
public interface ICanMessageHandler
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,10 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(PinoutDataModel Pinout, bool conectar)
|
public List<(int, CanMessagePosicaoDados, byte[])> ProtocoloConfiguracao(PinoutDataModel Pinout, bool conectar)
|
||||||
{
|
{
|
||||||
List<byte> config1 = new List<byte>();
|
List<byte> config1 = new List<byte>()
|
||||||
|
{
|
||||||
|
Variaveis.OperacaoEmAndamento.DispSen?.Dados?.LoRaParametrosBase?.address ?? 0x01
|
||||||
|
};
|
||||||
var _pinout = Pinout.Clone();
|
var _pinout = Pinout.Clone();
|
||||||
_pinout.Pinos = _pinout.Pinos.Where(x => x.ComponenteID == ID).ToList();
|
_pinout.Pinos = _pinout.Pinos.Where(x => x.ComponenteID == ID).ToList();
|
||||||
if (_pinout.Pinos.Count > 0)
|
if (_pinout.Pinos.Count > 0)
|
||||||
|
|
@ -79,108 +82,28 @@ namespace AgroBase.Services
|
||||||
return (Configurado, Parametros);
|
return (Configurado, Parametros);
|
||||||
}
|
}
|
||||||
|
|
||||||
public (bool, byte[]) EnviarDadosLoRa(DadosLoRaParse TipoDado)
|
public bool EnviarDadosLoRaViaCAN(byte[] payload)
|
||||||
{
|
|
||||||
(CanMessagePosicaoDados posicao, byte[] dados) = MontarMensagemLoRa(TipoDado);
|
|
||||||
|
|
||||||
bool sucesso = EnviarMensagem(posicao, dados);
|
|
||||||
|
|
||||||
return (sucesso, dados);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public bool EnviarMensagem(CanMessagePosicaoDados posicao, byte[] payload)
|
|
||||||
{
|
{
|
||||||
if (payload == null) return false;
|
if (payload == null) return false;
|
||||||
|
|
||||||
if (payload.Length > 5) return false; // Payload muito grande para o nosso protocolo CAN-Style LoRa
|
if (payload.Length > 8) return false;
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.DispSen?.AdicionarMensagemFila(ID_Num, posicao, posicao, payload, false);
|
CanMessagePosicaoDados posicao = ((CanMessagePosicaoDados)payload[0]);
|
||||||
|
byte idNum = payload[1];
|
||||||
|
|
||||||
|
Variaveis.OperacaoEmAndamento.DispSen?.AdicionarMensagemFila(idNum, posicao, posicao, payload.Skip(2).ToArray(), false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private (CanMessagePosicaoDados, byte[]) MontarMensagemLoRa(DadosLoRaParse TipoDado)
|
|
||||||
{
|
|
||||||
List<byte> dados = new List<byte>();
|
|
||||||
|
|
||||||
switch (TipoDado)
|
|
||||||
{
|
|
||||||
case DadosLoRaParse.GpsQualidade:
|
|
||||||
{
|
|
||||||
var Gps = Variaveis.OperacaoEmAndamento.Sensoriamento.Gps;
|
|
||||||
dados.Add((byte)(Gps.Inicializado ? 1 : 0)); // 1 byte
|
|
||||||
dados.Add((byte)Gps.QualidadeFix); // 1 byte
|
|
||||||
dados.Add((byte)Gps.NumeroSatelites); // 1 byte
|
|
||||||
dados.AddRange(CompactarDecimal(Gps.PrecisaoCm)); // 2 bytes
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DadosLoRaParse.GpsLatitude:
|
|
||||||
{
|
|
||||||
var Gps = Variaveis.OperacaoEmAndamento.Sensoriamento.Gps;
|
|
||||||
dados.AddRange(CompactarCoordenada(Gps.Latitude)); // 4 bytes
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DadosLoRaParse.GpsLongitude:
|
|
||||||
{
|
|
||||||
var Gps = Variaveis.OperacaoEmAndamento.Sensoriamento.Gps;
|
|
||||||
dados.AddRange(CompactarCoordenada(Gps.Longitude)); // 4 bytes
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DadosLoRaParse.GpsGerais:
|
|
||||||
{
|
|
||||||
var Gps = Variaveis.OperacaoEmAndamento.Sensoriamento.Gps;
|
|
||||||
dados.Add((byte)Gps.VariacaoMagnetica); // 1 byte
|
|
||||||
dados.AddRange(CompactarDecimal(Gps.Altitude)); // 2 bytes
|
|
||||||
dados.AddRange(CompactarDecimal(Gps.Velocidade)); // 2 bytes
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DadosLoRaParse.DadosControle:
|
|
||||||
{
|
|
||||||
var Controle = Variaveis.OperacaoEmAndamento.Sensoriamento.Controle;
|
|
||||||
dados.Add((byte)Controle.Direcao); // 1 byte
|
|
||||||
dados.Add((byte)Controle.PercentualVelocidadeSP); // 1 byte
|
|
||||||
dados.Add((byte)Controle.TipoMovimento); // 1 byte
|
|
||||||
dados.Add((byte)Controle.Angulo); // 1 byte
|
|
||||||
dados.Add((byte)Controle.VelocidadeMP); // 1 byte
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((CanMessagePosicaoDados)TipoDado, dados.ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] CompactarCoordenada(double valor)
|
|
||||||
{
|
|
||||||
int inteiro = (int)(valor * 1e7); // Multiplica para preservar precisão
|
|
||||||
byte[] bytes = BitConverter.GetBytes(inteiro); // 4 bytes (little endian)
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double DescompactarCoordenada(byte[] payload)
|
|
||||||
{
|
|
||||||
int inteiro = BitConverter.ToInt32(payload, 0); // 4 primeiros bytes
|
|
||||||
return inteiro / 1e7; // Voltar para graus decimais
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] CompactarDecimal(double precisaoCm)
|
|
||||||
{
|
|
||||||
ushort valor = (ushort)Math.Round(precisaoCm); // Arredonda para inteiro
|
|
||||||
return BitConverter.GetBytes(valor); // 2 bytes (little endian)
|
|
||||||
}
|
|
||||||
|
|
||||||
private double DescompactarDecimal(byte[] payload, int offset)
|
|
||||||
{
|
|
||||||
ushort valor = BitConverter.ToUInt16(payload, offset); // Lê 2 bytes
|
|
||||||
return (double)valor; // Volta para double
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum DadosLoRaParse
|
public enum DadosLoRaParse
|
||||||
{
|
{
|
||||||
GpsQualidade = (int)CanMessagePosicaoDados.Dados2,
|
DadosLivre = (int)CanMessagePosicaoDados.Command2,
|
||||||
GpsLatitude = (int)CanMessagePosicaoDados.Dados3,
|
GpsQualidade = (int)CanMessagePosicaoDados.Command3,
|
||||||
GpsLongitude = (int)CanMessagePosicaoDados.Dados4,
|
GpsLatitude = (int)CanMessagePosicaoDados.Command4,
|
||||||
GpsGerais = (int)CanMessagePosicaoDados.Dados5,
|
GpsLongitude = (int)CanMessagePosicaoDados.Command5,
|
||||||
DadosControle = (int)CanMessagePosicaoDados.Dados6,
|
GpsGerais = (int)CanMessagePosicaoDados.Command6,
|
||||||
|
ComandoControle = (int)CanMessagePosicaoDados.Command7,
|
||||||
|
DadosControle = (int)CanMessagePosicaoDados.Command8,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum LoRaCaracteresEspeciais
|
public enum LoRaCaracteresEspeciais
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
using AgroBase.Models;
|
using AgroBase.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using static AgroBase.Models.Enums;
|
using static AgroBase.Models.Enums;
|
||||||
|
using static AgroBase.Services.LoRaEspService;
|
||||||
|
|
||||||
namespace AgroBase.Services
|
namespace AgroBase.Services
|
||||||
{
|
{
|
||||||
|
|
@ -132,7 +135,7 @@ namespace AgroBase.Services
|
||||||
// Serializar Coordenadas (LoRaProtocoloTransmissaoCoordenadasModel)
|
// Serializar Coordenadas (LoRaProtocoloTransmissaoCoordenadasModel)
|
||||||
bytes.AddRange(BitConverter.GetBytes(model.Latitude));
|
bytes.AddRange(BitConverter.GetBytes(model.Latitude));
|
||||||
bytes.AddRange(BitConverter.GetBytes(model.Longitude));
|
bytes.AddRange(BitConverter.GetBytes(model.Longitude));
|
||||||
bytes.AddRange(BitConverter.GetBytes(model.CursoVerdadeiro));
|
bytes.AddRange(BitConverter.GetBytes(model.OrientacaoReal));
|
||||||
|
|
||||||
return bytes.ToArray();
|
return bytes.ToArray();
|
||||||
}
|
}
|
||||||
|
|
@ -229,5 +232,112 @@ namespace AgroBase.Services
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static List<byte> CanPrefix(DadosLoRaParse dado)
|
||||||
|
{
|
||||||
|
return new List<byte>()
|
||||||
|
{
|
||||||
|
(byte)(CanMessagePosicaoDados)dado,
|
||||||
|
Variaveis.ID_Num_sLRA
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<byte[]> SerializeGPS(GPSModel Gps)
|
||||||
|
{
|
||||||
|
List<byte> fix = new List<byte>();
|
||||||
|
fix.AddRange(CanPrefix(DadosLoRaParse.GpsQualidade));
|
||||||
|
fix.Add((byte)(Gps.Inicializado ? 1 : 0)); // 1 byte
|
||||||
|
fix.Add((byte)Gps.QualidadeFix); // 1 byte
|
||||||
|
fix.Add((byte)Gps.NumeroSatelites); // 1 byte
|
||||||
|
fix.AddRange(CompactarDecimal(Gps.PrecisaoHorizontal)); // 2 bytes
|
||||||
|
|
||||||
|
List<byte> _lat = new List<byte>();
|
||||||
|
_lat.AddRange(CanPrefix(DadosLoRaParse.GpsLatitude));
|
||||||
|
_lat.AddRange(CompactarCoordenada(Gps.Latitude)); // 6 bytes
|
||||||
|
|
||||||
|
List<byte> _long = new List<byte>();
|
||||||
|
_long.AddRange(CanPrefix(DadosLoRaParse.GpsLongitude));
|
||||||
|
_long.AddRange(CompactarCoordenada(Gps.Longitude)); // 6 bytes
|
||||||
|
|
||||||
|
List<byte> _gerais = new List<byte>();
|
||||||
|
_long.AddRange(CanPrefix(DadosLoRaParse.GpsGerais));
|
||||||
|
_gerais.AddRange(CompactarDecimal(Gps.Altitude)); // 2 bytes
|
||||||
|
_gerais.AddRange(CompactarDecimal(Gps.Velocidade)); // 2 bytes
|
||||||
|
_gerais.AddRange(CompactarDecimal(Gps.OrientacaoReal)); // 2 bytes
|
||||||
|
|
||||||
|
return new List<byte[]>()
|
||||||
|
{
|
||||||
|
fix.ToArray(),
|
||||||
|
_lat.ToArray(),
|
||||||
|
_long.ToArray(),
|
||||||
|
_gerais.ToArray(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] SerializeComandoControle(OperacaoControleBaseModel Controle)
|
||||||
|
{
|
||||||
|
List<byte> dados = new List<byte>();
|
||||||
|
dados.AddRange(CanPrefix(DadosLoRaParse.ComandoControle));
|
||||||
|
dados.Add((byte)Controle.Tecla); // 1 byte
|
||||||
|
dados.Add((byte)Controle.PercentualVelocidadeSP); // 1 byte
|
||||||
|
dados.Add((byte)Controle.TipoMovimento); // 1 byte
|
||||||
|
dados.Add((byte)Controle.AnguloMP); // 1 byte
|
||||||
|
//dados.Add((byte)Controle.VelocidadeMP); // 1 byte
|
||||||
|
dados.Add((byte)Controle.Dispositivo); // 1 byte
|
||||||
|
dados.Add((byte)(Controle.Emergencia ? 1 : 0)); // 1 byte
|
||||||
|
return dados.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] SerializeControleAtual(OperacaoControleModel Controle)
|
||||||
|
{
|
||||||
|
List<byte> dados = new List<byte>();
|
||||||
|
dados.AddRange(CanPrefix(DadosLoRaParse.DadosControle));
|
||||||
|
dados.Add((byte)Controle.Direcao); // 1 byte
|
||||||
|
dados.Add((byte)Controle.PercentualVelocidadeSP); // 1 byte
|
||||||
|
dados.Add((byte)Controle.TipoMovimento); // 1 byte
|
||||||
|
dados.Add((byte)Controle.Angulo); // 1 byte
|
||||||
|
dados.Add((byte)Controle.VelocidadeMP); // 1 byte
|
||||||
|
return dados.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] CompactarDecimal(double precisaoCm)
|
||||||
|
{
|
||||||
|
ushort valor = (ushort)Math.Round(precisaoCm); // Arredonda para inteiro
|
||||||
|
return BitConverter.GetBytes(valor); // 2 bytes (little endian)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double DescompactarDecimal(byte[] payload, int offset)
|
||||||
|
{
|
||||||
|
ushort valor = BitConverter.ToUInt16(payload, offset); // Lê 2 bytes
|
||||||
|
return (double)valor; // Volta para double
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] CompactarCoordenada(double valor)
|
||||||
|
{
|
||||||
|
long inteiro = (long)(valor * 1e7); // Precisão de 7 casas decimais
|
||||||
|
byte[] bytes = BitConverter.GetBytes(inteiro); // 8 bytes little endian
|
||||||
|
return bytes.Take(6).ToArray(); // Pega só os 6 bytes menos significativos
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double DescompactarCoordenada(byte[] payload)
|
||||||
|
{
|
||||||
|
if (payload.Length < 6)
|
||||||
|
throw new ArgumentException("Payload deve ter pelo menos 6 bytes");
|
||||||
|
|
||||||
|
// Monta os 8 bytes de volta, fazendo extensão de sinal manual
|
||||||
|
byte[] full = new byte[8];
|
||||||
|
Array.Copy(payload, 0, full, 0, 6);
|
||||||
|
|
||||||
|
// Se o bit mais significativo (6º byte) tem sinal negativo, completa com 0xFF
|
||||||
|
bool negativo = (payload[5] & 0x80) != 0;
|
||||||
|
full[6] = (byte)(negativo ? 0xFF : 0x00);
|
||||||
|
full[7] = (byte)(negativo ? 0xFF : 0x00);
|
||||||
|
|
||||||
|
long inteiro = BitConverter.ToInt64(full, 0);
|
||||||
|
return inteiro / 1e7;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using AgroBase.Models;
|
using AgroBase.Models;
|
||||||
using AgroMonitor;
|
using AgroMonitor;
|
||||||
using OpenTK.Graphics.OpenGL;
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -42,9 +42,6 @@ namespace AgroBase.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static Dictionary<DateTime, List<byte>> bufferRecebido = new Dictionary<DateTime, List<byte>>();
|
|
||||||
|
|
||||||
private static List<byte[]> bufferEnvio = new List<byte[]>();
|
|
||||||
|
|
||||||
private static LoRaParametrosModel parametrosModel { get; set; } = new LoRaParametrosModel();
|
private static LoRaParametrosModel parametrosModel { get; set; } = new LoRaParametrosModel();
|
||||||
public LoRaParametrosModel parametros
|
public LoRaParametrosModel parametros
|
||||||
|
|
@ -57,6 +54,22 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
private DateTime UltimaLeituraMensagem = DateTime.Now.AddMinutes(-1);
|
private DateTime UltimaLeituraMensagem = DateTime.Now.AddMinutes(-1);
|
||||||
|
|
||||||
|
private static AsyncTaskTimerModel tmrLeitura;
|
||||||
|
private static AsyncTaskTimerModel tmrProcessamento;
|
||||||
|
private static ConcurrentQueue<byte[]> _filaTx = new ConcurrentQueue<byte[]>();
|
||||||
|
private static readonly ConcurrentQueue<(bool, byte[])> _filaRx = new ConcurrentQueue<(bool, byte[])>();
|
||||||
|
private static List<byte> _bufferAtual = new List<byte>();
|
||||||
|
private static bool _recebendo = false;
|
||||||
|
private static DateTime _inicioRecepcao;
|
||||||
|
private static TipoRecepcao _tipoAtual = TipoRecepcao.Nenhum;
|
||||||
|
private static int _tamanhoEsperadoConfig = 0;
|
||||||
|
private enum TipoRecepcao
|
||||||
|
{
|
||||||
|
Nenhum,
|
||||||
|
Config,
|
||||||
|
Mensagem
|
||||||
|
}
|
||||||
|
|
||||||
public static Dictionary<string, byte> CodigosFuncoes = new Dictionary<string, byte>()
|
public static Dictionary<string, byte> CodigosFuncoes = new Dictionary<string, byte>()
|
||||||
{
|
{
|
||||||
{ "ComandoConfiguracao", 0xc0 },
|
{ "ComandoConfiguracao", 0xc0 },
|
||||||
|
|
@ -65,8 +78,8 @@ namespace AgroBase.Services
|
||||||
};
|
};
|
||||||
public static Dictionary<string, byte> CodigosTipoTransmissao = new Dictionary<string, byte>()
|
public static Dictionary<string, byte> CodigosTipoTransmissao = new Dictionary<string, byte>()
|
||||||
{
|
{
|
||||||
{ "Normal", 0x00 },
|
{ "Normal", 0x00 },
|
||||||
{ "Fixed", 0x40 },
|
{ "Fixed", 0x40 },
|
||||||
};
|
};
|
||||||
public static Dictionary<int, byte> CodigosBaudRates = new Dictionary<int, byte>()
|
public static Dictionary<int, byte> CodigosBaudRates = new Dictionary<int, byte>()
|
||||||
{
|
{
|
||||||
|
|
@ -75,18 +88,18 @@ namespace AgroBase.Services
|
||||||
{ 4800, 0x40 },
|
{ 4800, 0x40 },
|
||||||
{ 9600, 0x60 },
|
{ 9600, 0x60 },
|
||||||
{ 19200, 0x80 },
|
{ 19200, 0x80 },
|
||||||
{ 34800, 0xa0 },
|
{ 38400, 0xa0 },
|
||||||
{ 57600, 0xc0 },
|
{ 57600, 0xc0 },
|
||||||
{ 115200, 0xe0 },
|
{ 115200, 0xe0 },
|
||||||
};
|
};
|
||||||
public static Dictionary<double, byte> CodigosAirRates = new Dictionary<double, byte>()
|
public static Dictionary<double, byte> CodigosAirRates = new Dictionary<double, byte>()
|
||||||
{
|
{
|
||||||
{ 2.4, 0x02 },
|
{ 2.4, 0x00 },
|
||||||
{ 4.8, 0x03 },
|
{ 4.8, 0x01 },
|
||||||
{ 9.6, 0x04 },
|
{ 9.6, 0x02 },
|
||||||
{ 19.2, 0x05 },
|
{ 19.2, 0x03 },
|
||||||
{ 38.4, 0x06 },
|
{ 38.4, 0x04 },
|
||||||
{ 62.5, 0x67 },
|
{ 62.5, 0x05 },
|
||||||
};
|
};
|
||||||
public static Dictionary<int, byte> CodigosPacketSizes = new Dictionary<int, byte>()
|
public static Dictionary<int, byte> CodigosPacketSizes = new Dictionary<int, byte>()
|
||||||
{
|
{
|
||||||
|
|
@ -139,80 +152,46 @@ namespace AgroBase.Services
|
||||||
|
|
||||||
public static async Task<bool> VerificaPortaLoRa(SerialPort porta)
|
public static async Task<bool> VerificaPortaLoRa(SerialPort porta)
|
||||||
{
|
{
|
||||||
|
if (!(tmrLeitura?.IsRunning ?? false))
|
||||||
|
{
|
||||||
|
tmrLeitura = new AsyncTaskTimerModel("tmrLeitura_LoRa", tmrLeitura_Tick, 5);
|
||||||
|
tmrLeitura.Start();
|
||||||
|
}
|
||||||
|
if (!(tmrProcessamento?.IsRunning ?? false))
|
||||||
|
{
|
||||||
|
tmrProcessamento = new AsyncTaskTimerModel("tmrProcessamento_LoRa", tmrProcessamento_Tick, 10);
|
||||||
|
tmrProcessamento.Start();
|
||||||
|
}
|
||||||
|
|
||||||
porta.Close();
|
porta.Close();
|
||||||
porta.BaudRate = 9600;
|
|
||||||
|
_PortaLoRa = new SerialPort();
|
||||||
|
_PortaLoRa.BaudRate = 9600;
|
||||||
|
_PortaLoRa.PortName = porta.PortName;
|
||||||
|
|
||||||
var comando = ComandoRequisitarParametros();
|
var comando = ComandoRequisitarParametros();
|
||||||
if (!await AlterarStatusReleModo(Estado.Ligado))
|
|
||||||
|
DateTime Inicio = DateTime.Now;
|
||||||
|
|
||||||
|
if (!EnviarComando(comando))
|
||||||
{
|
{
|
||||||
porta.Close();
|
porta.Close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EnviarComando(porta, comando))
|
bool Respondido() => parametrosModel.UltimaLeitura > Inicio;
|
||||||
{
|
await FuncoesGlobais.AguardarCondicaoAsync(Respondido, 1000, 100);
|
||||||
await AlterarStatusReleModo(Estado.Desligado);
|
|
||||||
porta.Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
await Task.Delay(1000);
|
|
||||||
var resposta = SerialService.VerificarRespostaPortasDesconhecidas(porta);
|
|
||||||
await AlterarStatusReleModo(Estado.Desligado);
|
|
||||||
if (resposta.Length > 3)
|
|
||||||
{
|
|
||||||
var protocolo = new LoRaProtocoloModel()
|
|
||||||
{
|
|
||||||
Cabecalho = new List<byte>()
|
|
||||||
{
|
|
||||||
resposta[0],
|
|
||||||
resposta[1],
|
|
||||||
resposta[2]
|
|
||||||
},
|
|
||||||
Dados = new Dictionary<DateTime, List<byte>>()
|
|
||||||
{
|
|
||||||
{ DateTime.Now, resposta.ToList() }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var parametros = DecifrarResposta(protocolo);
|
|
||||||
if (parametros != null)
|
|
||||||
{
|
|
||||||
parametrosModel = parametros;
|
|
||||||
AtualizarPortaCOM(porta);
|
|
||||||
return Iniciado;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
porta.Close();
|
if (Respondido())
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AtualizarPortaCOM(SerialPort Porta)
|
|
||||||
{
|
|
||||||
if (_PortaLoRa == null)
|
|
||||||
{
|
|
||||||
_PortaLoRa = new SerialPort()
|
|
||||||
{
|
|
||||||
Encoding = Encoding.UTF8,
|
|
||||||
ReadBufferSize = 8192,
|
|
||||||
WriteBufferSize = 8192,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else if (Iniciado)
|
|
||||||
{
|
|
||||||
_PortaLoRa.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
_PortaLoRa.BaudRate = Porta.BaudRate;
|
|
||||||
_PortaLoRa.PortName = Porta.PortName;
|
|
||||||
_PortaLoRa.DataReceived -= PortaLoRa_DataReceived;
|
|
||||||
_PortaLoRa.DataReceived += PortaLoRa_DataReceived;
|
|
||||||
|
|
||||||
Porta.Close();
|
|
||||||
|
|
||||||
if (Iniciado)
|
|
||||||
{
|
{
|
||||||
DefinirDispositivo();
|
DefinirDispositivo();
|
||||||
|
return Iniciado;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_PortaLoRa.Close();
|
||||||
|
_PortaLoRa = null;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DefinirDispositivo()
|
private static void DefinirDispositivo()
|
||||||
|
|
@ -232,7 +211,7 @@ namespace AgroBase.Services
|
||||||
{
|
{
|
||||||
PararRotinas();
|
PararRotinas();
|
||||||
|
|
||||||
tmrEnvio = new AsyncTaskTimerModel("tmrEnvio", tmrEnvio_Tick, 500);
|
tmrEnvio = new AsyncTaskTimerModel("tmrEnvio", tmrEnvio_Tick, 50);
|
||||||
tmrEnvio.Start();
|
tmrEnvio.Start();
|
||||||
|
|
||||||
tmrPing = new AsyncTaskTimerModel("tmrPing", tmrPing_Tick, VariaveisEquipamento.TempoEntrePingsConexao);
|
tmrPing = new AsyncTaskTimerModel("tmrPing", tmrPing_Tick, VariaveisEquipamento.TempoEntrePingsConexao);
|
||||||
|
|
@ -245,341 +224,214 @@ namespace AgroBase.Services
|
||||||
tmrPing?.Dispose();
|
tmrPing?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PortaLoRa_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
private static async Task tmrLeitura_Tick()
|
||||||
{
|
{
|
||||||
if (_PortaLoRa.IsOpen)
|
while ((_PortaLoRa?.BytesToRead ?? 0) > 0)
|
||||||
{
|
{
|
||||||
VerificaProtocoloCompleto();
|
byte b = (byte)_PortaLoRa.ReadByte();
|
||||||
|
|
||||||
|
if (!_recebendo)
|
||||||
|
|
||||||
|
|
||||||
/*byte[] buffer;
|
|
||||||
|
|
||||||
if (Variaveis.OperacaoEmAndamento.DispSen?.Dados.Conectado ?? false)
|
|
||||||
{
|
{
|
||||||
string line = PortaLoRa.ReadLine();
|
if (b == CodigosFuncoes["RespostaConfiguracao"])
|
||||||
buffer = Encoding.UTF8.GetBytes(line);
|
{
|
||||||
|
_recebendo = true;
|
||||||
|
_bufferAtual.Clear();
|
||||||
|
_bufferAtual.Add(b);
|
||||||
|
_tipoAtual = TipoRecepcao.Config;
|
||||||
|
_inicioRecepcao = DateTime.Now;
|
||||||
|
}
|
||||||
|
else if (b == (byte)LoRaCaracteresEspeciais.BeginMsg)
|
||||||
|
{
|
||||||
|
_recebendo = true;
|
||||||
|
_bufferAtual.Clear();
|
||||||
|
_bufferAtual.Add(b);
|
||||||
|
_tipoAtual = TipoRecepcao.Mensagem;
|
||||||
|
_inicioRecepcao = DateTime.Now;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int bytesToRead = PortaLoRa.BytesToRead;
|
_bufferAtual.Add(b);
|
||||||
buffer = new byte[bytesToRead];
|
|
||||||
PortaLoRa.Read(buffer, 0, bytesToRead);
|
|
||||||
}
|
|
||||||
|
|
||||||
//int bytesToRead = PortaLoRa.BytesToRead;
|
if (_tipoAtual == TipoRecepcao.Config)
|
||||||
//byte[] buffer = new byte[bytesToRead];
|
|
||||||
//PortaLoRa.Read(buffer, 0, bytesToRead);
|
|
||||||
var Res = DecifrarResposta(buffer);
|
|
||||||
if (Res != null)
|
|
||||||
{
|
|
||||||
parametrosModel = Res;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*int bytesToRead = PortaLoRa.BytesToRead;
|
|
||||||
byte[] buffer = new byte[bytesToRead];
|
|
||||||
PortaLoRa.Read(buffer, 0, bytesToRead);
|
|
||||||
var Res = DecifrarResposta(buffer);
|
|
||||||
if (Res != null)
|
|
||||||
{
|
|
||||||
parametrosModel = Res;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*List<byte> bufferRecebido = new List<byte>();
|
|
||||||
// Continuar lendo enquanto houver dados disponíveis
|
|
||||||
while (PortaLoRa.BytesToRead > 0)
|
|
||||||
{
|
|
||||||
int bytesToRead = PortaLoRa.BytesToRead;
|
|
||||||
byte[] buffer = new byte[bytesToRead];
|
|
||||||
PortaLoRa.Read(buffer, 0, bytesToRead);
|
|
||||||
|
|
||||||
// Adiciona os bytes lidos ao buffer global
|
|
||||||
bufferRecebido.AddRange(buffer);
|
|
||||||
|
|
||||||
Task.Delay(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (PortaLoRa.BytesToRead == 0)
|
|
||||||
{
|
|
||||||
// Processa a mensagem recebida
|
|
||||||
var Res = DecifrarResposta(bufferRecebido.ToArray());
|
|
||||||
if (Res != null)
|
|
||||||
{
|
{
|
||||||
parametrosModel = Res;
|
if (_bufferAtual.Count == 3)
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void VerificaProtocoloCompleto()
|
|
||||||
{
|
|
||||||
byte[] buffer = new byte[1];
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_PortaLoRa.Read(buffer, 0, 1);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
byte caractere0 = buffer[0];
|
|
||||||
|
|
||||||
if (caractere0 == CodigosFuncoes["RespostaConfiguracao"])
|
|
||||||
{
|
|
||||||
//buffer = SerialService.VerificarRespostaPortasDesconhecidas(PortaLoRa);
|
|
||||||
buffer = SerialService.LerDadosDaPortaSerial(_PortaLoRa, 6);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*string leitura = PortaLoRa.ReadLine();
|
|
||||||
buffer = Encoding.UTF8.GetBytes(leitura);*/
|
|
||||||
buffer = SerialService.LerDadosDaPortaSerial(_PortaLoRa, 168);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cria um novo buffer com espaço para o caractere0 no início
|
|
||||||
byte[] bufferCompleto = new byte[buffer.Length + 1];
|
|
||||||
bufferCompleto[0] = caractere0;
|
|
||||||
Array.Copy(buffer, 0, bufferCompleto, 1, buffer.Length);
|
|
||||||
|
|
||||||
if (bufferCompleto.Length > 0)
|
|
||||||
{
|
|
||||||
bufferRecebido.Add(DateTime.Now.AddMilliseconds(1), bufferCompleto.ToList());
|
|
||||||
}
|
|
||||||
|
|
||||||
var buferEntrada = bufferRecebido.OrderBy(x => x.Key);
|
|
||||||
|
|
||||||
var mensagens = new List<LoRaProtocoloModel>();
|
|
||||||
|
|
||||||
foreach (var item in buferEntrada)
|
|
||||||
{
|
|
||||||
if (item.Value != null && item.Value.Count > 3)
|
|
||||||
{
|
|
||||||
List<byte> cabecalho = new List<byte>()
|
|
||||||
{
|
|
||||||
//item.Value[0],
|
|
||||||
item.Value[1],
|
|
||||||
item.Value[2]
|
|
||||||
};
|
|
||||||
var mensagem = mensagens.FirstOrDefault(m => m.Cabecalho[0] == cabecalho[0] && m.Cabecalho[1] == cabecalho[1]);
|
|
||||||
|
|
||||||
if (mensagem != null)
|
|
||||||
{
|
|
||||||
mensagem.Dados.Add(item.Key, item.Value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mensagens.Add(new LoRaProtocoloModel()
|
|
||||||
{
|
{
|
||||||
Cabecalho = cabecalho,
|
_tamanhoEsperadoConfig = _bufferAtual[2];
|
||||||
Dados = new Dictionary<DateTime, List<byte>>() { { item.Key, item.Value } }
|
}
|
||||||
});
|
else if (_bufferAtual.Count == 3 + _tamanhoEsperadoConfig)
|
||||||
|
{
|
||||||
|
_filaRx.Enqueue((true, _bufferAtual.ToArray()));
|
||||||
|
_bufferAtual.Clear();
|
||||||
|
_recebendo = false;
|
||||||
|
_tipoAtual = TipoRecepcao.Nenhum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_tipoAtual == TipoRecepcao.Mensagem)
|
||||||
|
{
|
||||||
|
if (b == (byte)LoRaCaracteresEspeciais.EndMsg)
|
||||||
|
{
|
||||||
|
_filaRx.Enqueue((false, _bufferAtual.ToArray()));
|
||||||
|
_bufferAtual.Clear();
|
||||||
|
_recebendo = false;
|
||||||
|
_tipoAtual = TipoRecepcao.Nenhum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
bufferRecebido.Remove(item.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var mensagem in mensagens.Where(x => x.MensagemCompleta))
|
// ⏱️ Timeout de segurança
|
||||||
{
|
if (_recebendo && (DateTime.Now - _inicioRecepcao).TotalMilliseconds > 500)
|
||||||
var Res = DecifrarResposta(mensagem);
|
|
||||||
|
|
||||||
if (Res != null)
|
|
||||||
{
|
{
|
||||||
parametrosModel = Res;
|
_bufferAtual.Clear();
|
||||||
}
|
_recebendo = false;
|
||||||
|
_tipoAtual = TipoRecepcao.Nenhum;
|
||||||
foreach (var item in mensagem.Dados)
|
|
||||||
{
|
|
||||||
bufferRecebido.Remove(item.Key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoRaParametrosModel DecifrarResposta(LoRaProtocoloModel resposta)
|
private static async Task tmrProcessamento_Tick()
|
||||||
{
|
{
|
||||||
try
|
while (_filaRx.TryDequeue(out var item))
|
||||||
{
|
{
|
||||||
if (resposta.Parametrizacao)
|
if (item.Item1)
|
||||||
{
|
{
|
||||||
LoRaParametrosModel modelo = new LoRaParametrosModel()
|
ProcessarRespostaConfiguracao(item.Item2);
|
||||||
{
|
|
||||||
UltimaLeitura = DateTime.Now
|
|
||||||
};
|
|
||||||
int numBytes = resposta.Buffer[2];
|
|
||||||
if (numBytes == 6 || numBytes == 11) // Set ou Get nos parametros
|
|
||||||
{
|
|
||||||
var data = resposta.Buffer;
|
|
||||||
byte address = data[4];
|
|
||||||
byte baudAndAirRate = data[5];
|
|
||||||
byte baud = (byte)(baudAndAirRate & 0b11100000);
|
|
||||||
byte airRate = (byte)((baudAndAirRate & 0b00011100) >> 2);
|
|
||||||
byte packetSizeAndPower = data[6];
|
|
||||||
byte packetSize = (byte)((packetSizeAndPower & 0b11000000));
|
|
||||||
byte power = (byte)(packetSizeAndPower & 0b00000011);
|
|
||||||
byte channel = data[7];
|
|
||||||
byte tranModeAndWorCycle = data[8];
|
|
||||||
byte tranMode = (byte)(tranModeAndWorCycle & 0b01000000);
|
|
||||||
byte worCycle = (byte)(tranModeAndWorCycle & 0b00000111);
|
|
||||||
|
|
||||||
/*modelo.address = resposta.Buffer[4];
|
|
||||||
string baudAndAirRates = Convert.ToInt32(resposta.Buffer[5].ToString("X")).ToString("00");
|
|
||||||
modelo.baudRate = Convert.ToByte(baudAndAirRates[0] + "0", 16);
|
|
||||||
modelo.airRate = Convert.ToByte("0" + baudAndAirRates[1], 16);
|
|
||||||
string packetSizeAndPower = Convert.ToInt32(resposta.Buffer[6].ToString("X")).ToString("00");
|
|
||||||
modelo.packetSize = Convert.ToByte(packetSizeAndPower[0] + "0", 16);
|
|
||||||
modelo.power = Convert.ToByte("0" + packetSizeAndPower[1], 16);
|
|
||||||
modelo.channel = resposta.Buffer[7];
|
|
||||||
string tranModeAndWorCycle = Convert.ToInt32(resposta.Buffer[8].ToString("X")).ToString("00");
|
|
||||||
modelo.tranMode = Convert.ToByte(tranModeAndWorCycle[0] + "0", 16);
|
|
||||||
modelo.worCycle = Convert.ToByte("0" + tranModeAndWorCycle[1], 16);*/
|
|
||||||
|
|
||||||
modelo.address = address;
|
|
||||||
modelo.baudRate = baud;
|
|
||||||
modelo.airRate = airRate;
|
|
||||||
modelo.packetSize = packetSize;
|
|
||||||
modelo.power = power;
|
|
||||||
modelo.channel = channel;
|
|
||||||
modelo.tranMode = tranMode;
|
|
||||||
modelo.worCycle = worCycle;
|
|
||||||
|
|
||||||
return modelo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("Número de bytes de dados não esperado.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (resposta.Tipo)
|
ProcessarMensagemLoRaCAN(item.Item2);
|
||||||
{
|
}
|
||||||
case LoRaTipoProtocolo.MensagemTexto:
|
}
|
||||||
{
|
}
|
||||||
LoRaMensagemModel Mensagem = new LoRaMensagemModel()
|
|
||||||
{
|
|
||||||
Momento = DateTime.Now,
|
|
||||||
channel = parametrosModel.channel,
|
|
||||||
Remetente = resposta.Remtente,
|
|
||||||
Destinatario = resposta.Destinatario,
|
|
||||||
Mensagem = resposta.Mensagem,
|
|
||||||
Lido = false
|
|
||||||
};
|
|
||||||
MensagensRecebidas.Add(Mensagem);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
case LoRaTipoProtocolo.DadosOperacao:
|
|
||||||
{
|
|
||||||
byte[] bufferDados = new byte[resposta.Buffer.Length - 4];
|
|
||||||
Array.Copy(resposta.Buffer, 4, bufferDados, 0, bufferDados.Length);
|
|
||||||
LoRaProtocoloTransmissaoModel Dados = LoRaSerializer.DeserializeLoRaProtocoloTransmissaoModel(bufferDados);
|
|
||||||
Dados.RecebidoEm = DateTime.Now;
|
|
||||||
lock (_dadosOperacaoLock)
|
|
||||||
{
|
|
||||||
LeituraDadosOperacao.Add(Dados);
|
|
||||||
if (LeituraDadosOperacao.Count() > 5)
|
|
||||||
{
|
|
||||||
LeituraDadosOperacao.RemoveAt(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Console.WriteLine($"{Dados.RecebidoEm.ToString("HH:mm:ss.fff")} Dados de operação recebidos: Mod_ID = {Dados.EnderecoCarro}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case LoRaTipoProtocolo.PosicaoGPS:
|
|
||||||
{
|
|
||||||
byte[] bufferDados = new byte[resposta.Buffer.Length - 4];
|
|
||||||
Array.Copy(resposta.Buffer, 4, bufferDados, 0, bufferDados.Length);
|
|
||||||
(byte Endereco, GPSModel Posicao) = LoRaSerializer.DeserializeGPSModel(bufferDados);
|
|
||||||
if (Endereco == Variaveis.OperacaoEmAndamento.DispSen.Dados.LoRaParametrosBase.address)
|
|
||||||
{
|
|
||||||
VariaveisOperacao.PosicaoBase = Posicao;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case LoRaTipoProtocolo.ComandoControle:
|
|
||||||
{
|
|
||||||
byte[] bufferDados = new byte[resposta.Buffer.Length - 4];
|
|
||||||
Array.Copy(resposta.Buffer, 4, bufferDados, 0, bufferDados.Length);
|
|
||||||
OperacaoControleBaseModel Controle = LoRaSerializer.DeserializeControleModel(bufferDados);
|
|
||||||
|
|
||||||
Variaveis.OperacaoEmAndamento.ExecutaComandoDaBase(Controle);
|
private static async Task tmrEnvio_Tick()
|
||||||
break;
|
{
|
||||||
}
|
if (_filaTx.TryDequeue(out var buffer))
|
||||||
}
|
{
|
||||||
|
EnviarComando(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessarRespostaConfiguracao(byte[] buffer)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Dados de parametrizacao recebidos do modulo: {FuncoesGlobais.ConverterComandoBytesParaTexto(buffer)}");
|
||||||
|
|
||||||
|
int numBytes = buffer[2];
|
||||||
|
if (numBytes != 6 && numBytes != 11)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Número de bytes de dados não esperado.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] data = buffer;
|
||||||
|
|
||||||
|
byte address = data[4];
|
||||||
|
byte baudAndAirRate = data[5];
|
||||||
|
byte baud = (byte)(baudAndAirRate & 0b11100000);
|
||||||
|
byte airRate = (byte)((baudAndAirRate & 0b00011100) >> 2);
|
||||||
|
byte packetSizeAndPower = data[6];
|
||||||
|
byte packetSize = (byte)((packetSizeAndPower & 0b11000000));
|
||||||
|
byte power = (byte)(packetSizeAndPower & 0b00000011);
|
||||||
|
byte channel = data[7];
|
||||||
|
byte tranModeAndWorCycle = data[8];
|
||||||
|
byte tranMode = (byte)(tranModeAndWorCycle & 0b01000000);
|
||||||
|
byte worCycle = (byte)(tranModeAndWorCycle & 0b00000111);
|
||||||
|
|
||||||
|
if (parametrosModel == null)
|
||||||
|
{
|
||||||
|
parametrosModel = new LoRaParametrosModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
parametrosModel.address = address;
|
||||||
|
parametrosModel.baudRate = baud;
|
||||||
|
parametrosModel.airRate = airRate;
|
||||||
|
parametrosModel.packetSize = packetSize;
|
||||||
|
parametrosModel.power = power;
|
||||||
|
parametrosModel.channel = channel;
|
||||||
|
parametrosModel.tranMode = tranMode;
|
||||||
|
parametrosModel.worCycle = worCycle;
|
||||||
|
|
||||||
|
parametrosModel.UltimaLeitura = DateTime.Now;
|
||||||
|
|
||||||
|
Console.WriteLine("Parâmetros atualizados com sucesso.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ProcessarMensagemLoRaCAN(byte[] mensagem)
|
||||||
|
{
|
||||||
|
if (mensagem.Length < 6) return; // Tamanho mínimo: Begin + Size + Remetente + Dest + Check + End
|
||||||
|
|
||||||
|
byte size = mensagem[1];
|
||||||
|
if (mensagem.Length != size + 6) return; // Tamanho real esperado
|
||||||
|
|
||||||
|
byte remetente = mensagem[2];
|
||||||
|
byte destinatario = mensagem[3];
|
||||||
|
byte[] dados = mensagem.Skip(4).Take(size).ToArray();
|
||||||
|
byte checksum = mensagem[4 + size];
|
||||||
|
byte end = mensagem[5 + size];
|
||||||
|
|
||||||
|
if (checksum != (byte)(dados.Sum(x => x) % 256)) return;
|
||||||
|
if (end != (byte)LoRaCaracteresEspeciais.EndMsg) return;
|
||||||
|
|
||||||
|
// Aqui você pode aplicar a lógica CAN-style, como extrair posição, idNum, etc.
|
||||||
|
// Exemplo:
|
||||||
|
if (dados.Length >= 2)
|
||||||
|
{
|
||||||
|
CanMessagePosicaoDados posicao = (CanMessagePosicaoDados)dados[0];
|
||||||
|
byte idNum = dados[1];
|
||||||
|
|
||||||
|
LoRaProtocoloTransmissaoModel equipamento = LeituraDadosOperacao.FirstOrDefault(x => x.EnderecoCarro == remetente);
|
||||||
|
if (equipamento == null)
|
||||||
|
{
|
||||||
|
equipamento = new LoRaProtocoloTransmissaoModel()
|
||||||
|
{
|
||||||
|
EnderecoCarro = remetente,
|
||||||
|
};
|
||||||
|
LeituraDadosOperacao.Add(equipamento);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
equipamento.Momento = DateTime.Now;
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Erro ao receber dados LoRa: " + ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
switch ((DadosLoRaParse)posicao)
|
||||||
|
{
|
||||||
|
case DadosLoRaParse.GpsLatitude:
|
||||||
|
{
|
||||||
|
equipamento.Coordenadas.Latitude = LoRaSerializer.DescompactarCoordenada(dados.Skip(2).ToArray());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.GpsLongitude:
|
||||||
|
{
|
||||||
|
equipamento.Coordenadas.Longitude = LoRaSerializer.DescompactarCoordenada(dados.Skip(2).ToArray());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.GpsGerais:
|
||||||
|
{
|
||||||
|
double _altitude = LoRaSerializer.DescompactarDecimal(dados, 2);
|
||||||
|
double _velocidade = LoRaSerializer.DescompactarDecimal(dados, 4);
|
||||||
|
double _orientacao = LoRaSerializer.DescompactarDecimal(dados, 6);
|
||||||
|
equipamento.Coordenadas.Orientacao = _orientacao;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DadosLoRaParse.DadosControle:
|
||||||
|
{
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<(bool, LoRaParametrosModel)> RequisitarParametrosModuloAsync()
|
public async Task<(bool, LoRaParametrosModel)> RequisitarParametrosModuloAsync()
|
||||||
{
|
{
|
||||||
await AlterarStatusReleModo(Estado.Ligado);
|
|
||||||
|
|
||||||
byte[] command = ComandoRequisitarParametros();
|
byte[] command = ComandoRequisitarParametros();
|
||||||
DateTime inicio = DateTime.Now;
|
DateTime inicio = DateTime.Now;
|
||||||
TimeSpan timeout = TimeSpan.FromSeconds(5);
|
|
||||||
|
|
||||||
// Envia o comando para a porta COM
|
// Envia o comando para a porta COM
|
||||||
EnviarComando(_PortaLoRa, command);
|
EnviarComando(command);
|
||||||
|
|
||||||
// Aguarda a resposta ou até que o timeout seja atingido
|
bool Respondido() => parametrosModel.UltimaLeitura > inicio;
|
||||||
while (DateTime.Now - inicio < timeout)
|
await FuncoesGlobais.AguardarCondicaoAsync(Respondido, 1000, 100);
|
||||||
{
|
|
||||||
// Verifica se a última leitura foi atualizada nos últimos 3 segundos
|
|
||||||
if (parametrosModel.UltimaLeitura >= DateTime.Now.AddSeconds(-3))
|
|
||||||
{
|
|
||||||
await AlterarStatusReleModo(Estado.Desligado);
|
|
||||||
|
|
||||||
return (true, parametrosModel);
|
return (Respondido(), parametrosModel);
|
||||||
}
|
|
||||||
|
|
||||||
// Aguarda de forma assíncrona por um curto período de tempo
|
|
||||||
await Task.Delay(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
await AlterarStatusReleModo(Estado.Desligado);
|
|
||||||
|
|
||||||
// Se o timeout for atingido, retorna o modelo com os dados disponíveis até o momento
|
|
||||||
return (false, parametrosModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<bool> AlterarStatusReleModo(Estado novoEstado)
|
|
||||||
{
|
|
||||||
if (Variaveis.IsAgroMonitor)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var DispSen = Variaveis.OperacaoEmAndamento.DispSen;
|
|
||||||
if (DispSen == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ReleLra = DispSen.Dados.Reles.FirstOrDefault(x => x.ID == "RLLRA" && x.Inicializado);
|
|
||||||
if (DispSen == null || !DispSen.Dados.Conectado || ReleLra == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Relé de controle LoRa não está conectado");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralJoystick.EnviarComandoSensoriamento(S_Code.sRLE, ReleLra.ID, novoEstado);
|
|
||||||
await Task.Delay(1000);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<(bool, LoRaParametrosModel)> ConfigurarModuloAsync(LoRaParametrosModel Parametros)
|
public async Task<(bool, LoRaParametrosModel)> ConfigurarModuloAsync(LoRaParametrosModel Parametros)
|
||||||
|
|
@ -587,102 +439,26 @@ namespace AgroBase.Services
|
||||||
parametrosModel = Parametros;
|
parametrosModel = Parametros;
|
||||||
|
|
||||||
byte[] command = ComandoConfigurarModulo();
|
byte[] command = ComandoConfigurarModulo();
|
||||||
|
Console.WriteLine($"Comando de configuracao do LoRa enviado: {FuncoesGlobais.ConverterComandoBytesParaTexto(command)}");
|
||||||
DateTime inicio = DateTime.Now;
|
DateTime inicio = DateTime.Now;
|
||||||
TimeSpan timeout = TimeSpan.FromSeconds(5);
|
|
||||||
|
|
||||||
// Envia o comando para a porta COM
|
// Envia o comando para a porta COM
|
||||||
EnviarComando(_PortaLoRa, command);
|
EnviarComando(command);
|
||||||
|
|
||||||
// Aguarda a resposta ou até que o timeout seja atingido
|
bool Respondido() => parametrosModel.UltimaLeitura > inicio;
|
||||||
while (DateTime.Now - inicio < timeout)
|
await FuncoesGlobais.AguardarCondicaoAsync(Respondido, 1000, 100);
|
||||||
|
|
||||||
|
if (Respondido())
|
||||||
{
|
{
|
||||||
// Verifica se a última leitura foi atualizada nos últimos 3 segundos
|
return (true, parametrosModel);
|
||||||
if (parametrosModel.UltimaLeitura >= DateTime.Now.AddSeconds(-3))
|
}
|
||||||
{
|
else
|
||||||
return (true, parametrosModel);
|
{
|
||||||
}
|
return (false, null);
|
||||||
|
|
||||||
// Aguarda de forma assíncrona por um curto período de tempo
|
|
||||||
await Task.Delay(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se o timeout for atingido, retorna o modelo com os dados disponíveis até o momento
|
|
||||||
return (false, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<byte[]> EnviarDadosLoRa(byte[] bytes, byte targetAddress)
|
||||||
public static List<byte[]> MontarMensagemEnvio(string texto, byte targetAddress, LoRaTipoProtocolo tipo, bool Enviar)
|
|
||||||
{
|
|
||||||
List<byte[]> Partes = new List<byte[]>();
|
|
||||||
|
|
||||||
byte[] Cabecalho = new byte[] { parametrosModel.address, targetAddress, (byte)tipo };
|
|
||||||
|
|
||||||
int packetSize = CodigosPacketSizes.FirstOrDefault(x => x.Value == parametrosModel.packetSize).Key - 10;
|
|
||||||
byte addressHigh = 0x00;
|
|
||||||
int prefixLength = Encoding.UTF8.GetByteCount(SerialService.BeginLine) + Cabecalho.Length;
|
|
||||||
int maxTextLength = packetSize - prefixLength;
|
|
||||||
|
|
||||||
List<string> messageParts = new List<string>();
|
|
||||||
for (int i = 0; i < texto.Length; i += maxTextLength)
|
|
||||||
{
|
|
||||||
int length = Math.Min(maxTextLength, texto.Length - i);
|
|
||||||
messageParts.Add(texto.Substring(i, length).Replace(SerialService.BeginLine, "?").Replace(SerialService.EndLine, "?").Replace(SerialService.BreakLine, "?"));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < messageParts.Count; i++)
|
|
||||||
{
|
|
||||||
string Prefixo = (i == 0 ? SerialService.BeginLine : SerialService.BreakLine);
|
|
||||||
string Sulfixo = (i == messageParts.Count() - 1 ? SerialService.EndLine : SerialService.BreakLine) + "\n";
|
|
||||||
|
|
||||||
byte[] prefixoBytes = Encoding.UTF8.GetBytes(Prefixo);
|
|
||||||
byte[] sulfixoBytes = Encoding.UTF8.GetBytes(Sulfixo);
|
|
||||||
|
|
||||||
byte[] Mensagem = Encoding.UTF8.GetBytes(messageParts[i]);
|
|
||||||
|
|
||||||
byte[] message = new byte[prefixoBytes.Length + Cabecalho.Length + Mensagem.Length + sulfixoBytes.Length + 3];
|
|
||||||
message[0] = addressHigh;
|
|
||||||
message[1] = targetAddress;
|
|
||||||
message[2] = parametrosModel.channel;
|
|
||||||
//Array.Copy(Encoding.UTF8.GetBytes(Mensagem), 0, message, 3, Mensagem.Length);
|
|
||||||
Array.Copy(prefixoBytes, 0, message, 3, prefixoBytes.Length);
|
|
||||||
Array.Copy(Cabecalho, 0, message, 3 + prefixoBytes.Length, Cabecalho.Length);
|
|
||||||
Array.Copy(Mensagem, 0, message, 3 + prefixoBytes.Length + Cabecalho.Length, Mensagem.Length);
|
|
||||||
Array.Copy(sulfixoBytes, 0, message, 3 + prefixoBytes.Length + Cabecalho.Length + Mensagem.Length, sulfixoBytes.Length);
|
|
||||||
Partes.Add(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Regex.IsMatch(texto, @"[^a-zA-Z0-9\s]"))
|
|
||||||
{
|
|
||||||
string mensagemControle = " " + SerialService.EndLine + "\n";
|
|
||||||
|
|
||||||
byte[] beginLine = Encoding.UTF8.GetBytes(SerialService.BeginLine);
|
|
||||||
|
|
||||||
byte[] mensagemBytes = Encoding.UTF8.GetBytes(mensagemControle);
|
|
||||||
byte[] message = new byte[beginLine.Length + Cabecalho.Length + mensagemBytes.Length + 3];
|
|
||||||
message[0] = addressHigh;
|
|
||||||
message[1] = targetAddress;
|
|
||||||
message[2] = parametrosModel.channel;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Array.Copy(beginLine, 0, message, 3, beginLine.Length);
|
|
||||||
Array.Copy(Cabecalho, 0, message, 3 + beginLine.Length, Cabecalho.Length);
|
|
||||||
Array.Copy(mensagemBytes, 0, message, 3 + beginLine.Length + Cabecalho.Length, mensagemBytes.Length);
|
|
||||||
Partes.Add(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Enviar)
|
|
||||||
{
|
|
||||||
foreach (var parte in Partes)
|
|
||||||
{
|
|
||||||
bufferEnvio.Add(parte);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Partes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<byte[]> MontarMensagemEnvio(byte[] bytes, byte targetAddress, LoRaTipoProtocolo tipo, bool Enviar)
|
|
||||||
{
|
{
|
||||||
List<byte[]> Partes = new List<byte[]>();
|
List<byte[]> Partes = new List<byte[]>();
|
||||||
|
|
||||||
|
|
@ -723,53 +499,31 @@ namespace AgroBase.Services
|
||||||
Partes.Add(mensagem);
|
Partes.Add(mensagem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Enviar)
|
foreach (var parte in Partes)
|
||||||
{
|
{
|
||||||
foreach (var parte in Partes)
|
_filaTx.Enqueue(parte);
|
||||||
{
|
|
||||||
bufferEnvio.Add(parte);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Partes;
|
return Partes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static bool EnviarComando(byte[] Comando)
|
||||||
private static async Task tmrEnvio_Tick()
|
|
||||||
{
|
|
||||||
var mensagens = bufferEnvio.ToList();
|
|
||||||
foreach (var buffer in mensagens)
|
|
||||||
{
|
|
||||||
EnviarComando(_PortaLoRa, buffer);
|
|
||||||
await Task.Delay(1500);
|
|
||||||
}
|
|
||||||
mensagens.ForEach(x => bufferEnvio.Remove(x));
|
|
||||||
|
|
||||||
|
|
||||||
var mensagensAntigas = bufferRecebido.Where(x => x.Key.AddSeconds(10) <= DateTime.Now).ToList();
|
|
||||||
foreach (var item in mensagensAntigas)
|
|
||||||
{
|
|
||||||
bufferRecebido.Remove(item.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool EnviarComando(SerialPort _Porta, byte[] Comando)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_Porta != null)
|
if (_PortaLoRa != null)
|
||||||
{
|
{
|
||||||
if (!_Porta.IsOpen)
|
if (!_PortaLoRa.IsOpen)
|
||||||
{
|
{
|
||||||
_Porta.Open();
|
_PortaLoRa.Open();
|
||||||
}
|
}
|
||||||
if (_Porta.IsOpen)
|
if (_PortaLoRa.IsOpen)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Dados enviados LoRa: {Comando.Length}");
|
Console.WriteLine($"Dados enviados LoRa: {Comando.Length}");
|
||||||
MensagensEnviadas++;
|
MensagensEnviadas++;
|
||||||
return SerialService.EnviarDadosPortaSerial(_Porta, Comando, 0, Comando.Length);
|
return SerialService.EnviarDadosPortaSerial(_PortaLoRa, Comando, 0, Comando.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -810,10 +564,9 @@ namespace AgroBase.Services
|
||||||
if (Variaveis.IsAgroMonitor)
|
if (Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
byte EnderecoBase = Variaveis.ConexaoLoRa.parametros.address;
|
byte EnderecoBase = Variaveis.ConexaoLoRa.parametros.address;
|
||||||
//GPSService.EnviarCoordenadasParaMapa(GPSService.UltimaLeitura.Latitude, GPSService.UltimaLeitura.Longitude, GPSService.UltimaLeitura.Orientacao, false, Convert.ToInt32(EnderecoBase));
|
|
||||||
foreach (var Equipamento in VariaveisMonitoramento.EquipamentosConectados.Where(x => x.Key != EnderecoBase))
|
foreach (var Equipamento in VariaveisMonitoramento.EquipamentosConectados.Where(x => x.Key != EnderecoBase))
|
||||||
{
|
{
|
||||||
EnviarDadosPosicao(EnderecoBase, Equipamento.Key);
|
EnviarDadosPosicao(Equipamento.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -830,63 +583,28 @@ namespace AgroBase.Services
|
||||||
{
|
{
|
||||||
if (Iniciado && !Variaveis.IsAgroMonitor)
|
if (Iniciado && !Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
double TemperaturaCampo = Variaveis.OperacaoEmAndamento.Sensoriamento.IMU.Temperatura;
|
|
||||||
|
|
||||||
(bool dirOperante, List<string> dirModsFalha) = Variaveis.OperacaoEmAndamento.DispMvd.Dados.StatusModulosDIR(Variaveis.OperacaoEmAndamento.Controle.TipoMovimento);
|
|
||||||
(bool movEsqOperante, List<string> movEsqModsFalha) = Variaveis.OperacaoEmAndamento.DispMvd.Dados.StatusModulosMOV(Direcao.Esquerda);
|
|
||||||
(bool movDirOperante, List<string> movDirModsFalha) = Variaveis.OperacaoEmAndamento.DispMvd.Dados.StatusModulosMOV(Direcao.Direita);
|
|
||||||
|
|
||||||
var _Sensoriamento = Variaveis.OperacaoEmAndamento.Sensoriamento;
|
var _Sensoriamento = Variaveis.OperacaoEmAndamento.Sensoriamento;
|
||||||
|
|
||||||
LoRaProtocoloTransmissaoModel dados = new LoRaProtocoloTransmissaoModel()
|
List<byte[]> dadosGps = LoRaSerializer.SerializeGPS(_Sensoriamento.Gps);
|
||||||
|
foreach (var dado in dadosGps)
|
||||||
{
|
{
|
||||||
Momento = DateTime.Now,
|
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(dado);
|
||||||
EnderecoCarro = Variaveis.ConexaoLoRa.parametros.address,
|
}
|
||||||
CodigoFalha = Variaveis.OperacaoEmAndamento.RetornaCodigoFalha(),
|
|
||||||
Operacao = new LoRaProtocoloTransmissaoOperacaoModel()
|
|
||||||
{
|
|
||||||
idxRuaAtual = _Sensoriamento.Trajetoria.CorredorAtual.Idx,
|
|
||||||
statusOperacao = _Sensoriamento.StatusOperacao,
|
|
||||||
statusCarro = _Sensoriamento.Trajetoria.StatusCarro,
|
|
||||||
TempoOperacao = (int)_Sensoriamento.TempoDecorridoSeg,
|
|
||||||
PercentualRua = _Sensoriamento.Trajetoria.CorredorAtual.Progresso,
|
|
||||||
PercentualOperacao = _Sensoriamento.Trajetoria.ProgressoTrajeto,
|
|
||||||
TempoEstimado = Variaveis.OperacaoEmAndamento.Trajetoria?.TempoEstimadoOperacao ?? "",
|
|
||||||
},
|
|
||||||
Coordenadas = new LoRaProtocoloTransmissaoCoordenadasModel()
|
|
||||||
{
|
|
||||||
Latitude = Variaveis.OperacaoEmAndamento.Sensoriamento.Gps.Latitude,
|
|
||||||
Longitude = Variaveis.OperacaoEmAndamento.Sensoriamento.Gps.Longitude,
|
|
||||||
},
|
|
||||||
Sensores = new LoRaProtocoloTransmissaoSensoresModel()
|
|
||||||
{
|
|
||||||
DistanciaPercorrida = Math.Round(_Sensoriamento.Trajetoria.DistanciaPercorrida, 2),
|
|
||||||
ErvasIdentificadas = _Sensoriamento.Atuador.QtdErvasIdentificadas,
|
|
||||||
OrientacaoCaminho = Math.Round(_Sensoriamento.Trajetoria.AnguloCaminho, 2),
|
|
||||||
PercentualBateria = Math.Round(_Sensoriamento.Bateria.PorcentagemBateria, 2),
|
|
||||||
PercentualReservatorio = Math.Round(_Sensoriamento.Atuador.PercentualReservatorio, 2),
|
|
||||||
PressaoLinha = Math.Round(_Sensoriamento.Atuador.PressaoLinha, 2),
|
|
||||||
TemperaturaMotores = Math.Round(Variaveis.OperacaoEmAndamento.DispMvd.Dados.Modulos.Average(x => x.MovMotor.Temperatura), 2),
|
|
||||||
TemperaturaCampo = Math.Round(TemperaturaCampo, 2),
|
|
||||||
Velocidade = Math.Round(_Sensoriamento.Movimentacao.VelocidadeMedia, 2),
|
|
||||||
HerbicidaConsumido = Math.Round(_Sensoriamento.Atuador.HerbicidaConsumido, 2),
|
|
||||||
HerbicidaPorErva = Math.Round(_Sensoriamento.Atuador.HerbicidaPorErva, 2),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
byte[] dadosEnvio = LoRaSerializer.SerializeLoRaProtocoloTransmissaoModel(dados);
|
Variaveis.LoraService?.EnviarDadosLoRaViaCAN(LoRaSerializer.SerializeControleAtual(_Sensoriamento.Controle));
|
||||||
|
|
||||||
MontarMensagemEnvio(dadosEnvio, Variaveis.OperacaoEmAndamento.DispSen.Dados.LoRaParametrosBase.address, LoRaTipoProtocolo.DadosOperacao, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void EnviarDadosPosicao(byte EnderecoRemetente, byte EnderecoDestinatario)
|
private static void EnviarDadosPosicao(byte EnderecoDestinatario)
|
||||||
{
|
{
|
||||||
if (Iniciado && Variaveis.IsAgroMonitor)
|
if (Iniciado && Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
byte[] dadosEnvio = LoRaSerializer.SerializeGPSModel(EnderecoRemetente, GPSService.UltimaLeitura);
|
List<byte[]> dadosEnvio = LoRaSerializer.SerializeGPS(GPSService.UltimaLeitura);
|
||||||
|
|
||||||
MontarMensagemEnvio(dadosEnvio, EnderecoDestinatario, LoRaTipoProtocolo.PosicaoGPS, true);
|
foreach (var payload in dadosEnvio)
|
||||||
|
{
|
||||||
|
EnviarDadosLoRa(payload, EnderecoDestinatario);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -894,9 +612,9 @@ namespace AgroBase.Services
|
||||||
{
|
{
|
||||||
if (Iniciado && Variaveis.IsAgroMonitor)
|
if (Iniciado && Variaveis.IsAgroMonitor)
|
||||||
{
|
{
|
||||||
byte[] dadosEnvio = LoRaSerializer.SerializeControleModel(Controle);
|
byte[] dadosEnvio = LoRaSerializer.SerializeComandoControle(Controle);
|
||||||
|
|
||||||
MontarMensagemEnvio(dadosEnvio, EnderecoDestinatario, LoRaTipoProtocolo.ComandoControle, true);
|
EnviarDadosLoRa(dadosEnvio, EnderecoDestinatario);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:20:27.960 7620 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Extension State/MANIFEST-000001
|
2025/05/09-17:15:51.290 4c3c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Extension State/MANIFEST-000001
|
||||||
2025/05/07-13:20:27.960 7620 Recovering log #3
|
2025/05/09-17:15:51.291 4c3c Recovering log #3
|
||||||
2025/05/07-13:20:27.961 7620 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Extension State/000003.log
|
2025/05/09-17:15:51.291 4c3c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Extension State/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:18:33.690 46c4 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Extension State/MANIFEST-000001
|
2025/05/07-13:20:27.960 7620 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Extension State/MANIFEST-000001
|
||||||
2025/05/07-13:18:33.690 46c4 Recovering log #3
|
2025/05/07-13:20:27.960 7620 Recovering log #3
|
||||||
2025/05/07-13:18:33.691 46c4 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Extension State/000003.log
|
2025/05/07-13:20:27.961 7620 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Extension State/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:20:27.930 7610 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
|
2025/05/09-17:15:51.261 7188 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
|
||||||
2025/05/07-13:20:27.935 7610 Recovering log #3
|
2025/05/09-17:15:51.267 7188 Recovering log #3
|
||||||
2025/05/07-13:20:27.937 7610 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
|
2025/05/09-17:15:51.269 7188 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:18:33.665 6d08 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
|
2025/05/07-13:20:27.930 7610 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001
|
||||||
2025/05/07-13:18:33.671 6d08 Recovering log #3
|
2025/05/07-13:20:27.935 7610 Recovering log #3
|
||||||
2025/05/07-13:18:33.673 6d08 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
|
2025/05/07-13:20:27.937 7610 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Local Storage\leveldb/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"net":{"http_server_properties":{"servers":[{"alternative_service":[{"advertised_alpns":["h3"],"expiration":"13391194714083705","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":34492},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:6f1:4e00:e890:7218:f4e4:5c86","used_quic":true},"version":5},"network_qualities":{"CAISABiAgICA+P////8B":"4G","CAYSABiAgICA+P////8B":"Offline"}}}
|
{"net":{"http_server_properties":{"servers":[{"alternative_service":[{"advertised_alpns":["h3"],"expiration":"13391381762942592","port":443,"protocol_str":"quic"}],"anonymization":["DAAAAAcAAABmaWxlOi8vAA==",false,0],"network_stats":{"srtt":24783},"server":"https://tile.openstreetmap.org","supports_spdy":true}],"supports_quic":{"address":"2804:d78:6f1:4e00:b579:b249:1565:b91b","used_quic":true},"version":5},"network_qualities":{"CAISABiAgICA+P////8B":"4G","CAYSABiAgICA+P////8B":"Offline"}}}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"sts":[{"expiry":1778170610.395793,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1746634610.395797}],"version":2}
|
{"sts":[{"expiry":1778357762.92396,"host":"bWGAftl61rqoc0YzqPncsLvQQh/iC2Bdp3ejUeGC83w=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1746821762.923964}],"version":2}
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:23:06.457 7610 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
|
2025/05/09-17:16:59.788 7188 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
|
||||||
2025/05/07-13:23:06.458 7610 Recovering log #3
|
2025/05/09-17:16:59.790 7188 Recovering log #3
|
||||||
2025/05/07-13:23:06.461 7610 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Session Storage/000003.log
|
2025/05/09-17:16:59.792 7188 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Session Storage/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:19:31.980 6d08 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
|
2025/05/07-13:23:06.457 7610 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Session Storage/MANIFEST-000001
|
||||||
2025/05/07-13:19:31.981 6d08 Recovering log #3
|
2025/05/07-13:23:06.458 7610 Recovering log #3
|
||||||
2025/05/07-13:19:31.983 6d08 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Session Storage/000003.log
|
2025/05/07-13:23:06.461 7610 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Session Storage/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:20:27.868 285c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
|
2025/05/09-17:15:51.194 5460 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
|
||||||
2025/05/07-13:20:27.869 285c Recovering log #3
|
2025/05/09-17:15:51.195 5460 Recovering log #3
|
||||||
2025/05/07-13:20:27.869 285c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Site Characteristics Database/000003.log
|
2025/05/09-17:15:51.195 5460 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Site Characteristics Database/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:18:33.600 5030 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
|
2025/05/07-13:20:27.868 285c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Site Characteristics Database/MANIFEST-000001
|
||||||
2025/05/07-13:18:33.601 5030 Recovering log #3
|
2025/05/07-13:20:27.869 285c Recovering log #3
|
||||||
2025/05/07-13:18:33.601 5030 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Site Characteristics Database/000003.log
|
2025/05/07-13:20:27.869 285c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Site Characteristics Database/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:20:27.867 7620 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Sync Data\LevelDB/MANIFEST-000001
|
2025/05/09-17:15:51.193 4c3c Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Sync Data\LevelDB/MANIFEST-000001
|
||||||
2025/05/07-13:20:27.869 7620 Recovering log #3
|
2025/05/09-17:15:51.195 4c3c Recovering log #3
|
||||||
2025/05/07-13:20:27.869 7620 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Sync Data\LevelDB/000003.log
|
2025/05/09-17:15:51.195 4c3c Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Sync Data\LevelDB/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:18:33.600 46c4 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Sync Data\LevelDB/MANIFEST-000001
|
2025/05/07-13:20:27.867 7620 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Sync Data\LevelDB/MANIFEST-000001
|
||||||
2025/05/07-13:18:33.601 46c4 Recovering log #3
|
2025/05/07-13:20:27.869 7620 Recovering log #3
|
||||||
2025/05/07-13:18:33.601 46c4 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Sync Data\LevelDB/000003.log
|
2025/05/07-13:20:27.869 7620 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\Sync Data\LevelDB/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:20:27.896 7010 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db/MANIFEST-000001
|
2025/05/09-17:15:51.224 5460 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db/MANIFEST-000001
|
||||||
2025/05/07-13:20:27.897 7010 Recovering log #3
|
2025/05/09-17:15:51.225 5460 Recovering log #3
|
||||||
2025/05/07-13:20:27.897 7010 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db/000003.log
|
2025/05/09-17:15:51.226 5460 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:18:33.627 3fa0 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db/MANIFEST-000001
|
2025/05/07-13:20:27.896 7010 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db/MANIFEST-000001
|
||||||
2025/05/07-13:18:33.628 3fa0 Recovering log #3
|
2025/05/07-13:20:27.897 7010 Recovering log #3
|
||||||
2025/05/07-13:18:33.628 3fa0 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db/000003.log
|
2025/05/07-13:20:27.897 7010 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:20:27.890 6e58 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db\metadata/MANIFEST-000001
|
2025/05/09-17:15:51.217 5460 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db\metadata/MANIFEST-000001
|
||||||
2025/05/07-13:20:27.891 6e58 Recovering log #3
|
2025/05/09-17:15:51.218 5460 Recovering log #3
|
||||||
2025/05/07-13:20:27.891 6e58 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db\metadata/000003.log
|
2025/05/09-17:15:51.218 5460 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db\metadata/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
2025/05/07-13:18:33.622 3fa0 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db\metadata/MANIFEST-000001
|
2025/05/07-13:20:27.890 6e58 Reusing MANIFEST C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db\metadata/MANIFEST-000001
|
||||||
2025/05/07-13:18:33.623 3fa0 Recovering log #3
|
2025/05/07-13:20:27.891 6e58 Recovering log #3
|
||||||
2025/05/07-13:18:33.623 3fa0 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db\metadata/000003.log
|
2025/05/07-13:20:27.891 6e58 Reusing old log C:\ZendionInc\agrobot_base\AgroBase\AgroMonitor\bin\Debug\AgroMonitor.exe.WebView2\EBWebView\Default\shared_proto_db\metadata/000003.log
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
136.0.3240.50
|
136.0.3240.64
|
||||||
BIN
AgroBase/AgroMonitor/bin/Debug/CefSharp.BrowserSubprocess.Core.dll (Stored with Git LFS)
BIN
AgroBase/AgroMonitor/bin/Debug/CefSharp.Core.Runtime.dll (Stored with Git LFS)
|
|
@ -1,29 +0,0 @@
|
||||||
// Copyright (c) 2008-2020 Marshall A. Greenblatt. Portions Copyright (c)
|
|
||||||
// 2006-2009 Google Inc. All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are
|
|
||||||
// met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above
|
|
||||||
// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
// in the documentation and/or other materials provided with the
|
|
||||||
// distribution.
|
|
||||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
|
||||||
// Framework nor the names of its contributors may be used to endorse
|
|
||||||
// or promote products derived from this software without specific prior
|
|
||||||
// written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
@ -1 +1,221 @@
|
||||||
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Id":"1","Name":"CidadeJardimTerreno2","Length":14.558011415731592,"Dist1":14.558011415731592,"Dist2":0.0},"geometry":{"id":"0","type":"LineString","coordinates":[[-47.395205344,-22.172559531333334],[-47.395212610166666,-22.172614638833334],[-47.395219157,-22.172656417833334],[-47.395223544833335,-22.1726892105],[-47.395224140984432,-22.172693691611649],[-47.395225326538004,-22.172702654611555]]}},{"type":"Feature","properties":{"Id":"2","Name":"CidadeJardimTerreno2","Length":14.771318274761821,"Dist1":14.558011415731592,"Dist2":0.0},"geometry":{"id":"1","type":"LineString","coordinates":[[-47.395210902333332,-22.172708800833334],[-47.395206943666665,-22.172679811],[-47.395202420666664,-22.1726491015],[-47.395198865666664,-22.172615782833333],[-47.395193255833334,-22.172577132833332],[-47.395192610024395,-22.172572657695412],[-47.395191325698136,-22.172563706509337]]}},{"type":"Feature","properties":{"Id":"3","Name":"CidadeJardimTerreno2","Length":14.827915524386164,"Dist1":14.558011415731592,"Dist2":0.0},"geometry":{"id":"2","type":"LineString","coordinates":[[-47.3951762925,-22.172561603],[-47.395180824166665,-22.172591686166665],[-47.395185745333336,-22.172623080166666],[-47.395190433,-22.172656367166667],[-47.395195199,-22.172693641833334],[-47.395195769044363,-22.172698125891035],[-47.395196902671593,-22.172707094716973]]}},{"type":"Feature","properties":{"Id":"4","Name":"CidadeJardimTerreno2","Length":14.785159385903514,"Dist1":14.558011415731592,"Dist2":0.0},"geometry":{"id":"3","type":"LineString","coordinates":[[-47.395182932166669,-22.1727127985],[-47.39517819266667,-22.172680514833335],[-47.3951732595,-22.172646752833334],[-47.395168805166669,-22.1726149155],[-47.395163812333337,-22.172581167166665],[-47.395163154299318,-22.172576693573966],[-47.395161845655842,-22.172567745443878]]}},{"type":"Feature","properties":{"Id":"5","Name":"CidadeJardimTerreno2","Length":14.801176921912329,"Dist1":14.558011415731592,"Dist2":0.0},"geometry":{"id":"4","type":"LineString","coordinates":[[-47.395147317833334,-22.172566031],[-47.395151503166666,-22.172595452333333],[-47.3951561855,-22.172628011166665],[-47.395161598666668,-22.172663757333332],[-47.395166727166668,-22.172697770833334],[-47.395167397572706,-22.172702242832194],[-47.39516873082615,-22.172711187810091]]}}]}
|
{
|
||||||
|
"type": "FeatureCollection",
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"Id": "1",
|
||||||
|
"Name": "CidadeJardimTerreno2",
|
||||||
|
"Length": 14.558011415731592,
|
||||||
|
"Dist1": 14.558011415731592,
|
||||||
|
"Dist2": 0.0
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"id": null,
|
||||||
|
"type": "LineString",
|
||||||
|
"coordinates": [
|
||||||
|
[
|
||||||
|
-47.395205344,
|
||||||
|
-22.172559531333334
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395212610166666,
|
||||||
|
-22.172614638833334
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395219157,
|
||||||
|
-22.172656417833334
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395223544833335,
|
||||||
|
-22.1726892105
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39522414098443,
|
||||||
|
-22.17269369161165
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395225326538004,
|
||||||
|
-22.172702654611555
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"Id": "2",
|
||||||
|
"Name": "CidadeJardimTerreno2",
|
||||||
|
"Length": 14.771318274761821,
|
||||||
|
"Dist1": 14.558011415731592,
|
||||||
|
"Dist2": 0.0
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"id": null,
|
||||||
|
"type": "LineString",
|
||||||
|
"coordinates": [
|
||||||
|
[
|
||||||
|
-47.39521090233333,
|
||||||
|
-22.172708800833334
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395206943666665,
|
||||||
|
-22.172679811
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395202420666664,
|
||||||
|
-22.1726491015
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395198865666664,
|
||||||
|
-22.172615782833333
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395193255833334,
|
||||||
|
-22.172577132833332
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395192610024395,
|
||||||
|
-22.17257265769541
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395191325698136,
|
||||||
|
-22.172563706509337
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"Id": "3",
|
||||||
|
"Name": "CidadeJardimTerreno2",
|
||||||
|
"Length": 14.827915524386164,
|
||||||
|
"Dist1": 14.558011415731592,
|
||||||
|
"Dist2": 0.0
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"id": null,
|
||||||
|
"type": "LineString",
|
||||||
|
"coordinates": [
|
||||||
|
[
|
||||||
|
-47.3951762925,
|
||||||
|
-22.172561603
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395180824166665,
|
||||||
|
-22.172591686166665
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395185745333336,
|
||||||
|
-22.172623080166666
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395190433,
|
||||||
|
-22.172656367166667
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395195199,
|
||||||
|
-22.172693641833334
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39519576904436,
|
||||||
|
-22.172698125891035
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39519690267159,
|
||||||
|
-22.172707094716973
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"Id": "4",
|
||||||
|
"Name": "CidadeJardimTerreno2",
|
||||||
|
"Length": 14.785159385903514,
|
||||||
|
"Dist1": 14.558011415731592,
|
||||||
|
"Dist2": 0.0
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"id": null,
|
||||||
|
"type": "LineString",
|
||||||
|
"coordinates": [
|
||||||
|
[
|
||||||
|
-47.39518293216667,
|
||||||
|
-22.1727127985
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39517819266667,
|
||||||
|
-22.172680514833335
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.3951732595,
|
||||||
|
-22.172646752833334
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39516880516667,
|
||||||
|
-22.1726149155
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39516381233334,
|
||||||
|
-22.172581167166665
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39516315429932,
|
||||||
|
-22.172576693573966
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39516184565584,
|
||||||
|
-22.172567745443878
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"Id": "5",
|
||||||
|
"Name": "CidadeJardimTerreno2",
|
||||||
|
"Length": 14.80117692191233,
|
||||||
|
"Dist1": 14.558011415731592,
|
||||||
|
"Dist2": 0.0
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"id": null,
|
||||||
|
"type": "LineString",
|
||||||
|
"coordinates": [
|
||||||
|
[
|
||||||
|
-47.395147317833334,
|
||||||
|
-22.172566031
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395151503166666,
|
||||||
|
-22.172595452333333
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.3951561855,
|
||||||
|
-22.172628011166665
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39516159866667,
|
||||||
|
-22.172663757333332
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39516672716667,
|
||||||
|
-22.172697770833334
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.395167397572706,
|
||||||
|
-22.172702242832194
|
||||||
|
],
|
||||||
|
[
|
||||||
|
-47.39516873082615,
|
||||||
|
-22.17271118781009
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<meta name="viewport" content="width=device-width,
|
<meta name="viewport" content="width=device-width,
|
||||||
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
<style>
|
<style>
|
||||||
#map_8c2e81f97ab5e9fbcb5516e045773939 {
|
#map_1859e66a9b77d3d3fa3e0b06bc4b9e35 {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100.0%;
|
width: 100.0%;
|
||||||
height: 100.0%;
|
height: 100.0%;
|
||||||
|
|
@ -39,14 +39,14 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<div class="folium-map" id="map_8c2e81f97ab5e9fbcb5516e045773939" ></div>
|
<div class="folium-map" id="map_1859e66a9b77d3d3fa3e0b06bc4b9e35" ></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
var map_8c2e81f97ab5e9fbcb5516e045773939 = L.map(
|
var map_1859e66a9b77d3d3fa3e0b06bc4b9e35 = L.map(
|
||||||
"map_8c2e81f97ab5e9fbcb5516e045773939",
|
"map_1859e66a9b77d3d3fa3e0b06bc4b9e35",
|
||||||
{
|
{
|
||||||
center: [-22.172636164916668, -47.395186322185666],
|
center: [-22.172636164916668, -47.395186322185666],
|
||||||
crs: L.CRS.EPSG3857,
|
crs: L.CRS.EPSG3857,
|
||||||
|
|
@ -60,216 +60,136 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var tile_layer_adba5a6aad00ad0d204bd12b60f75b05 = L.tileLayer(
|
||||||
|
"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||||
|
{"attribution": "\u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 19, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
|
||||||
|
);
|
||||||
|
|
||||||
var trajetosSelecionados = {};
|
|
||||||
var RuasSelecionadas = [];
|
tile_layer_adba5a6aad00ad0d204bd12b60f75b05.addTo(map_1859e66a9b77d3d3fa3e0b06bc4b9e35);
|
||||||
function enviarSelecaoParaServidor() {
|
|
||||||
client.publish("selecao_ruas_mapa", JSON.stringify(RuasSelecionadas), function (err) {
|
|
||||||
/*if (!err) {
|
|
||||||
console.log("Mensagem publicada com sucesso");
|
|
||||||
} else {
|
|
||||||
console.error("Falha ao publicar mensagem", err);
|
|
||||||
}*/
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function geo_json_dac777806f79c601e6ab9543c7390803_onEachFeature(feature, layer) {
|
|
||||||
layer.on({
|
|
||||||
|
|
||||||
click: function(e) {
|
|
||||||
// Verificar se o trajeto já está selecionado
|
|
||||||
if (trajetosSelecionados[feature.id]) {
|
|
||||||
// Se já está selecionado, reverta para a cor original e remova da seleção
|
|
||||||
e.target.setStyle({
|
|
||||||
color: '#3388ff' // Cor original
|
|
||||||
});
|
|
||||||
delete trajetosSelecionados[feature.id];
|
|
||||||
RuasSelecionadas.splice(RuasSelecionadas.indexOf(feature.id), 1);
|
|
||||||
} else {
|
|
||||||
// Se não está selecionado, mude a cor para indicar seleção e adicione ao objeto de seleção
|
|
||||||
e.target.setStyle({
|
|
||||||
color: 'blue' // Cor de seleção
|
|
||||||
});
|
|
||||||
trajetosSelecionados[feature.id] = true;
|
|
||||||
RuasSelecionadas.push(feature.id);
|
|
||||||
}
|
|
||||||
enviarSelecaoParaServidor();
|
|
||||||
}/*, mouseover: function(e) {
|
|
||||||
// Mostrar tooltip com o ID da geometria quando o mouse passar sobre a linha
|
|
||||||
var tooltip = L.tooltip({
|
|
||||||
direction: 'auto', // Leaflet determina a melhor posição
|
|
||||||
sticky: true // Faz com que o tooltip siga o cursor do mouse
|
|
||||||
})
|
|
||||||
.setContent('Rua ' + feature.id); // Define o conteúdo do tooltip
|
|
||||||
|
|
||||||
// Abre o tooltip na posição atual do mouse
|
function geo_json_cf98f3c5430ff3ba35ee38eaee757045_onEachFeature(feature, layer) {
|
||||||
var latLng = e.latlng;
|
layer.on({
|
||||||
tooltip.setLatLng(latLng);
|
});
|
||||||
layer.bindTooltip(tooltip).openTooltip(latLng);
|
|
||||||
}*/
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
var geo_json_dac777806f79c601e6ab9543c7390803 = L.geoJson(null, {
|
var geo_json_cf98f3c5430ff3ba35ee38eaee757045 = L.geoJson(null, {
|
||||||
onEachFeature: geo_json_dac777806f79c601e6ab9543c7390803_onEachFeature,
|
onEachFeature: geo_json_cf98f3c5430ff3ba35ee38eaee757045_onEachFeature,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function geo_json_dac777806f79c601e6ab9543c7390803_add (data) {
|
function geo_json_cf98f3c5430ff3ba35ee38eaee757045_add (data) {
|
||||||
geo_json_dac777806f79c601e6ab9543c7390803
|
geo_json_cf98f3c5430ff3ba35ee38eaee757045
|
||||||
.addData(data);
|
.addData(data);
|
||||||
}
|
}
|
||||||
geo_json_dac777806f79c601e6ab9543c7390803_add({"features": [{"geometry": {"coordinates": [[-47.395205344, -22.172559531333334], [-47.395212610166666, -22.172614638833334], [-47.395219157, -22.172656417833334], [-47.395223544833335, -22.1726892105], [-47.39522414098443, -22.17269369161165], [-47.395225326538004, -22.172702654611555]], "id": "0", "type": "LineString"}, "id": 0, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "1", "Length": 14.558011415731592, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.39521090233333, -22.172708800833334], [-47.395206943666665, -22.172679811], [-47.395202420666664, -22.1726491015], [-47.395198865666664, -22.172615782833333], [-47.395193255833334, -22.172577132833332], [-47.395192610024395, -22.17257265769541], [-47.395191325698136, -22.172563706509337]], "id": "1", "type": "LineString"}, "id": 1, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "2", "Length": 14.771318274761821, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.3951762925, -22.172561603], [-47.395180824166665, -22.172591686166665], [-47.395185745333336, -22.172623080166666], [-47.395190433, -22.172656367166667], [-47.395195199, -22.172693641833334], [-47.39519576904436, -22.172698125891035], [-47.39519690267159, -22.172707094716973]], "id": "2", "type": "LineString"}, "id": 2, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "3", "Length": 14.827915524386164, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.39518293216667, -22.1727127985], [-47.39517819266667, -22.172680514833335], [-47.3951732595, -22.172646752833334], [-47.39516880516667, -22.1726149155], [-47.39516381233334, -22.172581167166665], [-47.39516315429932, -22.172576693573966], [-47.39516184565584, -22.172567745443878]], "id": "3", "type": "LineString"}, "id": 3, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "4", "Length": 14.785159385903514, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.395147317833334, -22.172566031], [-47.395151503166666, -22.172595452333333], [-47.3951561855, -22.172628011166665], [-47.39516159866667, -22.172663757333332], [-47.39516672716667, -22.172697770833334], [-47.395167397572706, -22.172702242832194], [-47.39516873082615, -22.17271118781009]], "id": "4", "type": "LineString"}, "id": 4, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "5", "Length": 14.80117692191233, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}], "type": "FeatureCollection"});
|
geo_json_cf98f3c5430ff3ba35ee38eaee757045_add({"features": [{"geometry": {"coordinates": [[-47.395205344, -22.172559531333334], [-47.395212610166666, -22.172614638833334], [-47.395219157, -22.172656417833334], [-47.395223544833335, -22.1726892105], [-47.39522414098443, -22.17269369161165], [-47.395225326538004, -22.172702654611555]], "id": null, "type": "LineString"}, "id": 0, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "1", "Length": 14.558011415731592, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.39521090233333, -22.172708800833334], [-47.395206943666665, -22.172679811], [-47.395202420666664, -22.1726491015], [-47.395198865666664, -22.172615782833333], [-47.395193255833334, -22.172577132833332], [-47.395192610024395, -22.17257265769541], [-47.395191325698136, -22.172563706509337]], "id": null, "type": "LineString"}, "id": 1, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "2", "Length": 14.771318274761821, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.3951762925, -22.172561603], [-47.395180824166665, -22.172591686166665], [-47.395185745333336, -22.172623080166666], [-47.395190433, -22.172656367166667], [-47.395195199, -22.172693641833334], [-47.39519576904436, -22.172698125891035], [-47.39519690267159, -22.172707094716973]], "id": null, "type": "LineString"}, "id": 2, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "3", "Length": 14.827915524386164, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.39518293216667, -22.1727127985], [-47.39517819266667, -22.172680514833335], [-47.3951732595, -22.172646752833334], [-47.39516880516667, -22.1726149155], [-47.39516381233334, -22.172581167166665], [-47.39516315429932, -22.172576693573966], [-47.39516184565584, -22.172567745443878]], "id": null, "type": "LineString"}, "id": 3, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "4", "Length": 14.785159385903514, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}, {"geometry": {"coordinates": [[-47.395147317833334, -22.172566031], [-47.395151503166666, -22.172595452333333], [-47.3951561855, -22.172628011166665], [-47.39516159866667, -22.172663757333332], [-47.39516672716667, -22.172697770833334], [-47.395167397572706, -22.172702242832194], [-47.39516873082615, -22.17271118781009]], "id": null, "type": "LineString"}, "id": 4, "properties": {"Dist1": 14.558011415731592, "Dist2": 0.0, "Id": "5", "Length": 14.80117692191233, "Name": "CidadeJardimTerreno2"}, "type": "Feature"}], "type": "FeatureCollection"});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
geo_json_dac777806f79c601e6ab9543c7390803.addTo(map_8c2e81f97ab5e9fbcb5516e045773939);
|
geo_json_cf98f3c5430ff3ba35ee38eaee757045.addTo(map_1859e66a9b77d3d3fa3e0b06bc4b9e35);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script src="folium/mqtt.min.js"></script>
|
||||||
|
<script src="folium/leaflet.rotatedMarker.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function trajeto_json_onEachFeature(feature, layer) {
|
var marcadores = {};
|
||||||
layer.on({
|
var trajetos = {};
|
||||||
});
|
|
||||||
};
|
function criarMarcador(id, coordenadas, orientacao) {
|
||||||
var trajeto_json = L.geoJson(null, {
|
var marcador;
|
||||||
onEachFeature: trajeto_json_onEachFeature,
|
|
||||||
|
if (id == 1) {
|
||||||
|
marcador = L.marker(coordenadas, {}).addTo(map_1859e66a9b77d3d3fa3e0b06bc4b9e35);
|
||||||
|
var icon = L.AwesomeMarkers.icon(
|
||||||
|
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
||||||
|
);
|
||||||
|
marcador.setIcon(icon);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var customIcon = L.icon({
|
||||||
|
iconUrl: 'folium/images/position_marker.png',
|
||||||
|
iconSize: [32, 32],
|
||||||
|
iconAnchor: [16, 16],
|
||||||
|
popupAnchor: [0, -16]
|
||||||
|
});
|
||||||
|
marcador = L.marker(coordenadas, { icon: customIcon }).addTo(map_1859e66a9b77d3d3fa3e0b06bc4b9e35);
|
||||||
|
marcador.setRotationAngle(orientacao);
|
||||||
|
}
|
||||||
|
|
||||||
|
var popup = L.popup({"maxWidth": "100%"});
|
||||||
|
var html = $(`<div id="html_${id}" style="width: 100.0%; height: 100.0%;">Endereco: ${id}</div>`)[0];
|
||||||
|
popup.setContent(html);
|
||||||
|
marcador.bindPopup(popup)
|
||||||
|
|
||||||
|
marcadores[id] = marcador;
|
||||||
|
}
|
||||||
|
|
||||||
|
function criarTrajeto(id) {
|
||||||
|
trajetos[id] = L.geoJson(null, {
|
||||||
style: function(feature) {
|
style: function(feature) {
|
||||||
return {color: 'red'};
|
return { color: 'red' };
|
||||||
|
}
|
||||||
|
}).addTo(map_1859e66a9b77d3d3fa3e0b06bc4b9e35);
|
||||||
|
}
|
||||||
|
|
||||||
|
function atualizarMarcador(id, coordenadas, orientacao) {
|
||||||
|
var marcador = marcadores[id];
|
||||||
|
if (marcador) {
|
||||||
|
marcador.setLatLng(coordenadas);
|
||||||
|
marcador.setRotationAngle(orientacao);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function atualizarTrajeto(id, coordenadas) {
|
||||||
|
var trajeto = trajetos[id];
|
||||||
|
if (trajeto) {
|
||||||
|
var feature = trajeto.toGeoJSON().features.find(f => f.id === id);
|
||||||
|
if (feature) {
|
||||||
|
var ultima = [0.0, 0.0];
|
||||||
|
if (feature.geometry.coordinates.length > 0) {
|
||||||
|
ultima = feature.geometry.coordinates[feature.geometry.coordinates.length - 1];
|
||||||
|
}
|
||||||
|
if (!saoCoordenadasIguais(ultima, coordenadas, 0.000001)) {
|
||||||
|
feature.geometry.coordinates.push(coordenadas);
|
||||||
|
trajeto.clearLayers();
|
||||||
|
trajeto.addData(feature);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
|
||||||
function trajeto_json_add (data) {
|
|
||||||
trajeto_json.addData(data);
|
|
||||||
}
|
|
||||||
trajeto_json_add({"features": []});
|
|
||||||
|
|
||||||
trajeto_json.addTo(map_8c2e81f97ab5e9fbcb5516e045773939);
|
|
||||||
|
|
||||||
function adicionarGeometria(novaGeometria) {
|
|
||||||
trajeto_json.addData(novaGeometria);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function saoCoordenadasIguais(coord1, coord2, tolerancia) {
|
function saoCoordenadasIguais(coord1, coord2, tolerancia) {
|
||||||
return Math.abs(coord1[0] - coord2[0]) < tolerancia && Math.abs(coord1[1] - coord2[1]) < tolerancia;
|
return Math.abs(coord1[0] - coord2[0]) < tolerancia && Math.abs(coord1[1] - coord2[1]) < tolerancia;
|
||||||
}
|
}
|
||||||
|
|
||||||
function adicionarCoordenada(idGeometria, novaCoordenada) {
|
function adicionarDados(id, coordenadas, orientacao, foco) {
|
||||||
var feature = trajeto_json.toGeoJSON().features.find(f => f.id === idGeometria);
|
if (!marcadores[id]) {
|
||||||
if (feature) {
|
criarMarcador(id, coordenadas, orientacao);
|
||||||
var ultima = [0.0,0.0];
|
criarTrajeto(id);
|
||||||
if (feature.geometry.coordinates.length > 0) {
|
trajetos[id].addData({
|
||||||
ultima = feature.geometry.coordinates[feature.geometry.coordinates.length - 1];
|
"type": "Feature",
|
||||||
}
|
"geometry": {
|
||||||
if (!saoCoordenadasIguais(ultima, novaCoordenada, 0.000001)) {
|
"type": "LineString",
|
||||||
feature.geometry.coordinates.push(novaCoordenada);
|
"coordinates": []
|
||||||
var ft = feature;
|
},
|
||||||
trajeto_json.clearLayers();
|
"properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": id, "Length": 0.0, "Name": "Trajeto"},
|
||||||
trajeto_json.addData(ft);
|
"id": id
|
||||||
}
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log("Feature com ID " + idGeometria + " não encontrada.");
|
atualizarMarcador(id, coordenadas, orientacao);
|
||||||
|
atualizarTrajeto(id, [coordenadas[1], coordenadas[0]]);
|
||||||
|
}
|
||||||
|
if (foco) {
|
||||||
|
map_1859e66a9b77d3d3fa3e0b06bc4b9e35.setView(coordenadas, map_1859e66a9b77d3d3fa3e0b06bc4b9e35.getZoom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
adicionarGeometria({
|
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexao segura
|
||||||
"type": "Feature",
|
|
||||||
"geometry": {
|
|
||||||
"type": "LineString",
|
|
||||||
"coordinates": []
|
|
||||||
},
|
|
||||||
"properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": 1517, "Length": 21.724783283, "Name": "Projeto"},
|
|
||||||
"id": "Tj"
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function trajeto_dinamico_json_onEachFeature(feature, layer) {
|
|
||||||
layer.on({
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var trajeto_dinamico_json = L.geoJson(null, {
|
|
||||||
onEachFeature: trajeto_dinamico_json_onEachFeature,
|
|
||||||
style: function(feature) {
|
|
||||||
return {color: 'green'};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
function trajeto_dinamico_json_add (data) {
|
|
||||||
trajeto_dinamico_json.addData(data);
|
|
||||||
}
|
|
||||||
trajeto_dinamico_json_add({"features": []});
|
|
||||||
|
|
||||||
trajeto_dinamico_json.addTo(map_8c2e81f97ab5e9fbcb5516e045773939);
|
|
||||||
|
|
||||||
function adicionarGeometriaDinamica(novaGeometria) {
|
|
||||||
trajeto_dinamico_json.addData(novaGeometria);
|
|
||||||
}
|
|
||||||
|
|
||||||
function adicionarCoordenadaDinamica(idGeometria, coordenadas) {
|
|
||||||
var feature = trajeto_dinamico_json.toGeoJSON().features.find(f => f.id === idGeometria);
|
|
||||||
if (feature) {
|
|
||||||
feature.geometry.coordinates = [];
|
|
||||||
coordenadas.forEach(x => feature.geometry.coordinates.push([x.longitude, x.latitude]));
|
|
||||||
var ft = feature;
|
|
||||||
trajeto_dinamico_json.clearLayers();
|
|
||||||
trajeto_dinamico_json.addData(ft);
|
|
||||||
} else {
|
|
||||||
console.log("Feature com ID " + idGeometria + " nao encontrada.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
adicionarGeometriaDinamica({
|
|
||||||
"type": "Feature",
|
|
||||||
"geometry": {
|
|
||||||
"type": "LineString",
|
|
||||||
"coordinates": []
|
|
||||||
},
|
|
||||||
"properties": {"Dist1": 0.0, "Dist2": 0.0, "Id": 1517, "Length": 21.724783283, "Name": "Projeto"},
|
|
||||||
"id": "TjD"
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script src="folium/mqtt.min.js"></script>
|
|
||||||
<script src="folium/leaflet.rotatedMarker.js"></script>
|
|
||||||
<script>
|
|
||||||
let posicaoAtualEquipamento = {
|
|
||||||
lat: 0,
|
|
||||||
long: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
let posicaoAtualBase = {
|
|
||||||
lat: 0,
|
|
||||||
long: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
var customIcon = L.icon({
|
|
||||||
iconUrl: 'folium/images/position_marker.png',
|
|
||||||
iconSize: [32, 32],
|
|
||||||
iconAnchor: [16, 16],
|
|
||||||
popupAnchor: [0, -16]
|
|
||||||
});
|
|
||||||
|
|
||||||
var marcadorEquipamento = L.marker([0, 0], {
|
|
||||||
icon: customIcon
|
|
||||||
}).addTo(map_8c2e81f97ab5e9fbcb5516e045773939);
|
|
||||||
|
|
||||||
var marcadorBase = L.marker([0, 0], {}).addTo(map_8c2e81f97ab5e9fbcb5516e045773939);
|
|
||||||
var icon = L.AwesomeMarkers.icon(
|
|
||||||
{"extraClasses": "fa-rotate-0", "icon": "info-sign", "iconColor": "white", "markerColor": "red", "prefix": "glyphicon"}
|
|
||||||
);
|
|
||||||
marcadorBase.setIcon(icon);
|
|
||||||
|
|
||||||
// Conectar ao broker MQTT
|
|
||||||
const client = mqtt.connect('ws://localhost:9001'); // Use wss para conexão segura
|
|
||||||
|
|
||||||
// Quando conectado, inscreva-se no tópico desejado
|
|
||||||
client.on('connect', function () {
|
client.on('connect', function () {
|
||||||
console.log('Conectado ao broker MQTT');
|
console.log('Conectado ao broker MQTT');
|
||||||
|
|
||||||
// Inscrever-se no tópico
|
|
||||||
client.subscribe('coordenadas_gps', function (err) {
|
client.subscribe('coordenadas_gps', function (err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
console.log("Inscricao bem-sucedida no topico");
|
console.log("Inscricao bem-sucedida no topico");
|
||||||
|
|
@ -277,116 +197,21 @@
|
||||||
console.error("Falha na inscricao do topico", err);
|
console.error("Falha na inscricao do topico", err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
client.subscribe('trajetoria_dinamica', function (err) {
|
|
||||||
if (!err) {
|
|
||||||
console.log("Inscricao bem-sucedida no topico");
|
|
||||||
} else {
|
|
||||||
console.error("Falha na inscricao do topico", err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
client.subscribe('selecao_ruas_mapa', function (err) {
|
|
||||||
if (!err) {
|
|
||||||
console.log("Inscricao bem-sucedida no topico");
|
|
||||||
} else {
|
|
||||||
console.error("Falha na inscricao do topico", err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Lidar com mensagens recebidas para o topico inscrito
|
|
||||||
client.on('message', function (topic, message) {
|
client.on('message', function (topic, message) {
|
||||||
var dados = JSON.parse(message);
|
var dados = JSON.parse(message);
|
||||||
if (topic === "trajetoria_dinamica") {
|
if (topic === 'coordenadas_gps') {
|
||||||
adicionarCoordenadaDinamica("TjD", dados); // "Tj" é o ID da feature no GeoJSON
|
|
||||||
}
|
|
||||||
else if (topic === "coordenadas_gps") {
|
|
||||||
// A mensagem e um Buffer, converta para string ou objeto conforme necessario
|
|
||||||
//console.log(`Mensagem recebida no topico '${topic}': ${message.toString()}`);
|
|
||||||
|
|
||||||
var id = dados.id;
|
var id = dados.id;
|
||||||
var novaLatitude = dados.latitude;
|
var novaLatitude = dados.latitude;
|
||||||
var novaLongitude = dados.longitude;
|
var novaLongitude = dados.longitude;
|
||||||
var novaPosicao = [novaLatitude, novaLongitude];
|
var novaPosicao = [novaLatitude, novaLongitude];
|
||||||
var orientacao = dados.orientacao;
|
var orientacao = dados.orientacao;
|
||||||
var foco = dados.foco;
|
var foco = dados.foco;
|
||||||
|
|
||||||
if (id == 1) {
|
|
||||||
marcadorBase.setLatLng(novaPosicao);
|
|
||||||
|
|
||||||
// Calcular angulo de rotacao
|
|
||||||
var angulo = dados.orientacao;
|
|
||||||
|
|
||||||
posicaoAtualBase.lat = novaPosicao[0];
|
adicionarDados(id, novaPosicao, orientacao, foco);
|
||||||
posicaoAtualBase.long = novaPosicao[1];
|
|
||||||
|
|
||||||
// Rotacionar o marcador para o angulo calculado
|
|
||||||
marcadorBase.setRotationAngle(angulo);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
marcadorEquipamento.setLatLng(novaPosicao);
|
|
||||||
|
|
||||||
// Calcular angulo de rotacao
|
|
||||||
var angulo = dados.orientacao;
|
|
||||||
|
|
||||||
posicaoAtualEquipamento.lat = novaPosicao[0];
|
|
||||||
posicaoAtualEquipamento.long = novaPosicao[1];
|
|
||||||
|
|
||||||
// Rotacionar o marcador para o angulo calculado
|
|
||||||
marcadorEquipamento.setRotationAngle(angulo);
|
|
||||||
|
|
||||||
adicionarCoordenada("Tj", [novaLongitude, novaLatitude]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foco) {
|
|
||||||
map_8c2e81f97ab5e9fbcb5516e045773939.setView(novaPosicao, map_8c2e81f97ab5e9fbcb5516e045773939.getZoom());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (topic === 'selecao_ruas_mapa') {
|
|
||||||
var selecionadas = dados;
|
|
||||||
if (selecionadas.length != RuasSelecionadas.length) {
|
|
||||||
atualizarSelecaoRuas(selecionadas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Função para atualizar a seleção das ruas e mudar a cor no mapa
|
|
||||||
function atualizarSelecaoRuas(selecionadas) {
|
|
||||||
selecionadas = JSON.parse(selecionadas);
|
|
||||||
RuasSelecionadas = Array.isArray(selecionadas) ? [...selecionadas] : [];
|
|
||||||
geo_json_dac777806f79c601e6ab9543c7390803.eachLayer(function (layer) {
|
|
||||||
if (RuasSelecionadas.includes(parseInt(layer.feature.id))) {
|
|
||||||
layer.setStyle({ color: 'blue' });
|
|
||||||
} else {
|
|
||||||
layer.setStyle({ color: '#3388ff' }); // Cor original
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function calcularOrientacao(P1latitude, P1longitude, P2latitude, P2longitude) {
|
|
||||||
// Converter latitudes e longitudes de graus para radianos
|
|
||||||
const latA = P1latitude * (Math.PI / 180.0);
|
|
||||||
const lonA = P1longitude * (Math.PI / 180.0);
|
|
||||||
const latB = P2latitude * (Math.PI / 180.0);
|
|
||||||
const lonB = P2longitude * (Math.PI / 180.0);
|
|
||||||
|
|
||||||
// Calcular a diferença de longitude
|
|
||||||
const deltaLon = lonB - lonA;
|
|
||||||
|
|
||||||
// Calcular a direção
|
|
||||||
const y = Math.sin(deltaLon) * Math.cos(latB);
|
|
||||||
const x = Math.cos(latA) * Math.sin(latB) - Math.sin(latA) * Math.cos(latB) * Math.cos(deltaLon);
|
|
||||||
const direcaoRadianos = Math.atan2(y, x);
|
|
||||||
|
|
||||||
// Converter a direção de radianos para graus
|
|
||||||
let direcaoGraus = direcaoRadianos * (180.0 / Math.PI);
|
|
||||||
|
|
||||||
// Normalizar a direção para que esteja no intervalo de 0 a 360 graus
|
|
||||||
direcaoGraus = (direcaoGraus + 360) % 360;
|
|
||||||
|
|
||||||
return direcaoGraus;
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -1,154 +0,0 @@
|
||||||
Chromium Embedded Framework (CEF) Standard Binary Distribution for Windows
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Date: November 16, 2023
|
|
||||||
|
|
||||||
CEF Version: 119.4.3+gc76a3b9+chromium-119.0.6045.159
|
|
||||||
CEF URL: https://bitbucket.org/chromiumembedded/cef.git
|
|
||||||
@c76a3b9f2e3fd582512e89fd0e901368bac1a822
|
|
||||||
|
|
||||||
Chromium Version: 119.0.6045.159
|
|
||||||
Chromium URL: https://chromium.googlesource.com/chromium/src.git
|
|
||||||
@eaa767197fa7dd412133d1b84f7eb60da43409c9
|
|
||||||
|
|
||||||
This distribution contains all components necessary to build and distribute an
|
|
||||||
application using CEF on the Windows platform. Please see the LICENSING
|
|
||||||
section of this document for licensing terms and conditions.
|
|
||||||
|
|
||||||
|
|
||||||
CONTENTS
|
|
||||||
--------
|
|
||||||
|
|
||||||
cmake Contains CMake configuration files shared by all targets.
|
|
||||||
|
|
||||||
Debug Contains libcef.dll, libcef.lib and other components required to
|
|
||||||
build and run the debug version of CEF-based applications. By
|
|
||||||
default these files should be placed in the same directory as the
|
|
||||||
executable and will be copied there as part of the build process.
|
|
||||||
|
|
||||||
include Contains all required CEF header files.
|
|
||||||
|
|
||||||
libcef_dll Contains the source code for the libcef_dll_wrapper static library
|
|
||||||
that all applications using the CEF C++ API must link against.
|
|
||||||
|
|
||||||
Release Contains libcef.dll, libcef.lib and other components required to
|
|
||||||
build and run the release version of CEF-based applications. By
|
|
||||||
default these files should be placed in the same directory as the
|
|
||||||
executable and will be copied there as part of the build process.
|
|
||||||
|
|
||||||
Resources Contains resources required by libcef.dll. By default these files
|
|
||||||
should be placed in the same directory as libcef.dll and will be
|
|
||||||
copied there as part of the build process.
|
|
||||||
|
|
||||||
tests/ Directory of tests that demonstrate CEF usage.
|
|
||||||
|
|
||||||
cefclient Contains the cefclient sample application configured to build
|
|
||||||
using the files in this distribution. This application demonstrates
|
|
||||||
a wide range of CEF functionalities.
|
|
||||||
|
|
||||||
cefsimple Contains the cefsimple sample application configured to build
|
|
||||||
using the files in this distribution. This application demonstrates
|
|
||||||
the minimal functionality required to create a browser window.
|
|
||||||
|
|
||||||
ceftests Contains unit tests that exercise the CEF APIs.
|
|
||||||
|
|
||||||
gtest Contains the Google C++ Testing Framework used by the ceftests
|
|
||||||
target.
|
|
||||||
|
|
||||||
shared Contains source code shared by the cefclient and ceftests targets.
|
|
||||||
|
|
||||||
|
|
||||||
USAGE
|
|
||||||
-----
|
|
||||||
|
|
||||||
Building using CMake:
|
|
||||||
CMake can be used to generate project files in many different formats. See
|
|
||||||
usage instructions at the top of the CMakeLists.txt file.
|
|
||||||
|
|
||||||
Please visit the CEF Website for additional usage information.
|
|
||||||
|
|
||||||
https://bitbucket.org/chromiumembedded/cef/
|
|
||||||
|
|
||||||
|
|
||||||
REDISTRIBUTION
|
|
||||||
--------------
|
|
||||||
|
|
||||||
This binary distribution contains the below components.
|
|
||||||
|
|
||||||
Required components:
|
|
||||||
|
|
||||||
The following components are required. CEF will not function without them.
|
|
||||||
|
|
||||||
* CEF core library.
|
|
||||||
* libcef.dll
|
|
||||||
|
|
||||||
* Crash reporting library.
|
|
||||||
* chrome_elf.dll
|
|
||||||
|
|
||||||
* Unicode support data.
|
|
||||||
* icudtl.dat
|
|
||||||
|
|
||||||
* V8 snapshot data.
|
|
||||||
* snapshot_blob.bin
|
|
||||||
* v8_context_snapshot.bin
|
|
||||||
|
|
||||||
Optional components:
|
|
||||||
|
|
||||||
The following components are optional. If they are missing CEF will continue to
|
|
||||||
run but any related functionality may become broken or disabled.
|
|
||||||
|
|
||||||
* Localized resources.
|
|
||||||
Locale file loading can be disabled completely using
|
|
||||||
CefSettings.pack_loading_disabled. The locales directory path can be
|
|
||||||
customized using CefSettings.locales_dir_path.
|
|
||||||
|
|
||||||
* locales/
|
|
||||||
Directory containing localized resources used by CEF, Chromium and Blink. A
|
|
||||||
.pak file is loaded from this directory based on the CefSettings.locale
|
|
||||||
value. Only configured locales need to be distributed. If no locale is
|
|
||||||
configured the default locale of "en-US" will be used. Without these files
|
|
||||||
arbitrary Web components may display incorrectly.
|
|
||||||
|
|
||||||
* Other resources.
|
|
||||||
Pack file loading can be disabled completely using
|
|
||||||
CefSettings.pack_loading_disabled. The resources directory path can be
|
|
||||||
customized using CefSettings.resources_dir_path.
|
|
||||||
|
|
||||||
* chrome_100_percent.pak
|
|
||||||
* chrome_200_percent.pak
|
|
||||||
* resources.pak
|
|
||||||
These files contain non-localized resources used by CEF, Chromium and Blink.
|
|
||||||
Without these files arbitrary Web components may display incorrectly.
|
|
||||||
|
|
||||||
* Direct3D support.
|
|
||||||
* d3dcompiler_47.dll
|
|
||||||
Support for GPU accelerated rendering of HTML5 content like 2D canvas, 3D CSS
|
|
||||||
and WebGL. Without this file the aforementioned capabilities may fail when GPU
|
|
||||||
acceleration is enabled (default in most cases). Use of this bundled version
|
|
||||||
is recommended instead of relying on the possibly old and untested system
|
|
||||||
installed version.
|
|
||||||
|
|
||||||
* ANGLE support.
|
|
||||||
* libEGL.dll
|
|
||||||
* libGLESv2.dll
|
|
||||||
Support for rendering of HTML5 content like 2D canvas, 3D CSS and WebGL.
|
|
||||||
Without these files the aforementioned capabilities may fail.
|
|
||||||
|
|
||||||
* SwANGLE support.
|
|
||||||
* vk_swiftshader.dll
|
|
||||||
* vk_swiftshader_icd.json
|
|
||||||
* vulkan-1.dll
|
|
||||||
Support for software rendering of HTML5 content like 2D canvas, 3D CSS and
|
|
||||||
WebGL using SwiftShader's Vulkan library as ANGLE's Vulkan backend. Without
|
|
||||||
these files the aforementioned capabilities may fail when GPU acceleration is
|
|
||||||
disabled or unavailable.
|
|
||||||
|
|
||||||
|
|
||||||
LICENSING
|
|
||||||
---------
|
|
||||||
|
|
||||||
The CEF project is BSD licensed. Please read the LICENSE.txt file included with
|
|
||||||
this binary distribution for licensing terms and conditions. Other software
|
|
||||||
included in this distribution is provided under other licenses. Please visit
|
|
||||||
"about:credits" in a CEF-based application for complete Chromium and third-party
|
|
||||||
licensing information.
|
|
||||||