criado repositorio

This commit is contained in:
Diego Note 2023-08-31 08:50:53 -03:00
parent 51b064f05e
commit 0223058948
1498 changed files with 1306745 additions and 0 deletions

Binary file not shown.

25
AgroBase/AgroBase.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32228.343
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgroBase", "AgroBase\AgroBase.csproj", "{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0CEDAB49-B5CE-4D85-BD98-4772897D6141}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C54B41C0-1D21-4E3E-949E-0F86BBC86A33}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AgroBase</RootNamespace>
<AssemblyName>AgroBase</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetPlatformVersion>10.0</TargetPlatformVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Windows.Gaming" />
</ItemGroup>
<ItemGroup>
<Compile Include="Forms\frmDiagnosticos.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmDiagnosticos.Designer.cs">
<DependentUpon>frmDiagnosticos.cs</DependentUpon>
</Compile>
<Compile Include="Forms\frmInstancial.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmInstancial.Designer.cs">
<DependentUpon>frmInstancial.cs</DependentUpon>
</Compile>
<Compile Include="Forms\frmJoystick.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmJoystick.Designer.cs">
<DependentUpon>frmJoystick.cs</DependentUpon>
</Compile>
<Compile Include="Models\DispositivosBaseModel.cs" />
<Compile Include="Models\Enuns.cs" />
<Compile Include="Models\Joystick.cs" />
<Compile Include="Models\MovimentacaoModel.cs" />
<Compile Include="Services\DispositivosService.cs" />
<Compile Include="Forms\frmPrincipal.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmPrincipal.Designer.cs">
<DependentUpon>frmPrincipal.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\SerialService.cs" />
<EmbeddedResource Include="Forms\frmDiagnosticos.resx">
<DependentUpon>frmDiagnosticos.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmPrincipal.resx">
<DependentUpon>frmPrincipal.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmInstancial.resx">
<DependentUpon>frmInstancial.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmJoystick.resx">
<DependentUpon>frmJoystick.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 e x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>pt-BR</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>

View File

@ -0,0 +1,201 @@

namespace AgroBase.Forms
{
partial class frmDiagnosticos
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmDiagnosticos));
this.imgRobo = new System.Windows.Forms.PictureBox();
this.dgvET = new System.Windows.Forms.DataGridView();
this.dgvEF = new System.Windows.Forms.DataGridView();
this.dgvDT = new System.Windows.Forms.DataGridView();
this.dgvDF = new System.Windows.Forms.DataGridView();
this.lblM1 = new System.Windows.Forms.Label();
this.lblM2 = new System.Windows.Forms.Label();
this.lblM3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.btnIniciar = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.imgRobo)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvET)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvEF)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvDT)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvDF)).BeginInit();
this.SuspendLayout();
//
// imgRobo
//
this.imgRobo.Image = ((System.Drawing.Image)(resources.GetObject("imgRobo.Image")));
this.imgRobo.Location = new System.Drawing.Point(424, 66);
this.imgRobo.Name = "imgRobo";
this.imgRobo.Size = new System.Drawing.Size(353, 486);
this.imgRobo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.imgRobo.TabIndex = 0;
this.imgRobo.TabStop = false;
//
// dgvET
//
this.dgvET.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvET.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvET.Location = new System.Drawing.Point(12, 66);
this.dgvET.Name = "dgvET";
this.dgvET.RowHeadersWidth = 51;
this.dgvET.RowTemplate.Height = 24;
this.dgvET.Size = new System.Drawing.Size(406, 187);
this.dgvET.TabIndex = 1;
//
// dgvEF
//
this.dgvEF.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvEF.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvEF.Location = new System.Drawing.Point(12, 365);
this.dgvEF.Name = "dgvEF";
this.dgvEF.RowHeadersWidth = 51;
this.dgvEF.RowTemplate.Height = 24;
this.dgvEF.Size = new System.Drawing.Size(406, 187);
this.dgvEF.TabIndex = 2;
//
// dgvDT
//
this.dgvDT.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvDT.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvDT.Location = new System.Drawing.Point(783, 66);
this.dgvDT.Name = "dgvDT";
this.dgvDT.RowHeadersWidth = 51;
this.dgvDT.RowTemplate.Height = 24;
this.dgvDT.Size = new System.Drawing.Size(406, 187);
this.dgvDT.TabIndex = 3;
//
// dgvDF
//
this.dgvDF.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvDF.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvDF.Location = new System.Drawing.Point(783, 365);
this.dgvDF.Name = "dgvDF";
this.dgvDF.RowHeadersWidth = 51;
this.dgvDF.RowTemplate.Height = 24;
this.dgvDF.Size = new System.Drawing.Size(406, 187);
this.dgvDF.TabIndex = 4;
//
// lblM1
//
this.lblM1.AutoSize = true;
this.lblM1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblM1.Location = new System.Drawing.Point(7, 38);
this.lblM1.Name = "lblM1";
this.lblM1.Size = new System.Drawing.Size(224, 25);
this.lblM1.TabIndex = 5;
this.lblM1.Text = "Motor 1 - Esquerda Trás";
//
// lblM2
//
this.lblM2.AutoSize = true;
this.lblM2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblM2.Location = new System.Drawing.Point(12, 337);
this.lblM2.Name = "lblM2";
this.lblM2.Size = new System.Drawing.Size(240, 25);
this.lblM2.TabIndex = 6;
this.lblM2.Text = "Motor 2 - Esquerda Frente";
//
// lblM3
//
this.lblM3.AutoSize = true;
this.lblM3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblM3.Location = new System.Drawing.Point(778, 38);
this.lblM3.Name = "lblM3";
this.lblM3.Size = new System.Drawing.Size(195, 25);
this.lblM3.TabIndex = 7;
this.lblM3.Text = "Motor 3 - Direita Trás";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(778, 337);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(211, 25);
this.label1.TabIndex = 8;
this.label1.Text = "Motor 4 - Direita Frente";
//
// btnIniciar
//
this.btnIniciar.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnIniciar.Location = new System.Drawing.Point(424, 558);
this.btnIniciar.Name = "btnIniciar";
this.btnIniciar.Size = new System.Drawing.Size(353, 48);
this.btnIniciar.TabIndex = 9;
this.btnIniciar.Text = "Iniciar Diagnósticos";
this.btnIniciar.UseVisualStyleBackColor = true;
this.btnIniciar.Click += new System.EventHandler(this.btnIniciar_Click);
//
// frmDiagnosticos
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1201, 618);
this.Controls.Add(this.btnIniciar);
this.Controls.Add(this.label1);
this.Controls.Add(this.lblM3);
this.Controls.Add(this.lblM2);
this.Controls.Add(this.lblM1);
this.Controls.Add(this.dgvDF);
this.Controls.Add(this.dgvDT);
this.Controls.Add(this.dgvEF);
this.Controls.Add(this.dgvET);
this.Controls.Add(this.imgRobo);
this.Name = "frmDiagnosticos";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Diagnósticos";
this.Load += new System.EventHandler(this.frmDiagnosticos_Load);
((System.ComponentModel.ISupportInitialize)(this.imgRobo)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvET)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvEF)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvDT)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvDF)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox imgRobo;
private System.Windows.Forms.DataGridView dgvET;
private System.Windows.Forms.DataGridView dgvEF;
private System.Windows.Forms.DataGridView dgvDT;
private System.Windows.Forms.DataGridView dgvDF;
private System.Windows.Forms.Label lblM1;
private System.Windows.Forms.Label lblM2;
private System.Windows.Forms.Label lblM3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnIniciar;
}
}

View File

@ -0,0 +1,101 @@
using AgroBase.Comum;
using AgroBase.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static AgroBase.Models.Enuns;
namespace AgroBase.Forms
{
public partial class frmDiagnosticos : Form
{
public static Timer tmrLeitura = new Timer() { Enabled = false, Interval = 500 };
public List<DataGridView> Tabelas = new List<DataGridView>();
public static DispositivosService DispMov;
List<string> ListaPinosDiagnosticar = new List<string>()
{
"DIR",
"BRK",
"STP",
"PWM",
"Sensor"
};
public frmDiagnosticos()
{
InitializeComponent();
}
private void frmDiagnosticos_Load(object sender, EventArgs e)
{
Tabelas = new List<DataGridView>() { dgvET, dgvEF, dgvDF, dgvDT };
tmrLeitura.Tick += tmrLeitura_Tick;
PopularGrids();
}
private void PopularGrids()
{
foreach (var dgv in Tabelas)
{
dgv.RowHeadersVisible = false;
dgv.Columns.Clear();
dgv.Rows.Clear();
dgv.Columns.Add("cl_Pino", "Pino");
for (int i = 1; i < 10; i++)
{
dgv.Columns.Add("cl_Teste" + i, "Teste " + i);
}
foreach (var pino in ListaPinosDiagnosticar)
{
dgv.Rows.Add(new string[] { pino });
}
}
}
private void PreencherDadosGrid(SensoriamentoMotor Motor)
{
DataGridView dgv = Tabelas.FirstOrDefault(x => x.Name == "dgv" + Motor.ID);
if (dgv != null)
{
SensoriamentoMotorTestes Log = Motor.LogTestes.OrderByDescending(x => x.Momento).FirstOrDefault();
int indexColuna = Motor.LogTestes.Count(x => x.Componente == Log.Componente);
int indexLinha = ListaPinosDiagnosticar.IndexOf(Log.Componente);
dgv.Rows[indexLinha].Cells[indexColuna].Value = Log.Resultado + " - " + Log.Comando + " - " + Log.Leitura;
}
}
private void btnIniciar_Click(object sender, EventArgs e)
{
DispMov = frmPrincipal.Dispositivos.FirstOrDefault(x => x._Porta.IsOpen && x.Dispositivo == T_Code.Mov);
if (DispMov == null)
{
return;
}
foreach (var Motor in ((MovimentacaoModel)DispMov.Dados).Motores)
{
string ProtocoloMotor = Motor.ProtocoloTeste();
DispMov.EnviarDadosSerial(ProtocoloMotor);
Task.Delay(10);
}
tmrLeitura.Enabled = true;
}
private void tmrLeitura_Tick(object sender, EventArgs e)
{
SensoriamentoMotor Motor = ((MovimentacaoModel)DispMov.Dados).Motores.FirstOrDefault(x => x.Conectado && x.Testando);
if (Motor != null)
{
PreencherDadosGrid(Motor);
}
tmrLeitura.Enabled = ((MovimentacaoModel)DispMov.Dados).Motores.Any(x => x.Testando);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@

namespace AgroBase.Forms
{
partial class frmInstancial
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// frmInstancial
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(371, 187);
this.Name = "frmInstancial";
this.Text = "frmInstancial";
this.Shown += new System.EventHandler(this.frmInstancial_Shown);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AgroBase.Forms
{
public partial class frmInstancial : Form
{
public static frmPrincipal frmPrincipal = new frmPrincipal();
public static frmJoystick frmJoystick = new frmJoystick();
public frmInstancial()
{
InitializeComponent();
}
private void frmInstancial_Shown(object sender, EventArgs e)
{
frmPrincipal.Show();
this.Hide();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,65 @@

namespace AgroBase.Forms
{
partial class frmJoystick
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblConsole = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblConsole
//
this.lblConsole.AutoSize = true;
this.lblConsole.Location = new System.Drawing.Point(12, 153);
this.lblConsole.Name = "lblConsole";
this.lblConsole.Size = new System.Drawing.Size(20, 17);
this.lblConsole.TabIndex = 0;
this.lblConsole.Text = "...";
//
// frmJoystick
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(475, 179);
this.Controls.Add(this.lblConsole);
this.Name = "frmJoystick";
this.Text = "Joystick";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmJoystick_FormClosing);
this.Shown += new System.EventHandler(this.frmJoystick_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.frmJoystick_KeyDown);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.frmJoystick_KeyUp);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public System.Windows.Forms.Label lblConsole;
}
}

View File

@ -0,0 +1,45 @@
using AgroBase.Comum;
using AgroBase.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static AgroBase.Models.Enuns;
namespace AgroBase.Forms
{
public partial class frmJoystick : Form
{
public frmJoystick()
{
InitializeComponent();
}
private void frmJoystick_KeyDown(object sender, KeyEventArgs e)
{
Joystick.EnviaComandoMotor(e.KeyCode);
}
private void frmJoystick_KeyUp(object sender, KeyEventArgs e)
{
Joystick.EnviaComandoMotor(Keys.Escape);
}
private void frmJoystick_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
this.Hide();
}
private void frmJoystick_Shown(object sender, EventArgs e)
{
Joystick.AtualizaDispositivo();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,531 @@

namespace AgroBase
{
partial class frmPrincipal
{
/// <summary>
/// Variável de designer necessária.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Limpar os recursos que estão sendo usados.
/// </summary>
/// <param name="disposing">true se for necessário descartar os recursos gerenciados; caso contrário, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Código gerado pelo Windows Form Designer
/// <summary>
/// Método necessário para suporte ao Designer - não modifique
/// o conteúdo deste método com o editor de código.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.gpbAcoes = new System.Windows.Forms.GroupBox();
this.erroStrip = new System.Windows.Forms.StatusStrip();
this.lblStripErro = new System.Windows.Forms.ToolStripStatusLabel();
this.pnlLateral = new System.Windows.Forms.Panel();
this.gpbDispositivos = new System.Windows.Forms.GroupBox();
this.lstDisponiveis = new System.Windows.Forms.ListView();
this.btnRemover = new System.Windows.Forms.Button();
this.lblDispositivos = new System.Windows.Forms.Label();
this.cmbDispositivos = new System.Windows.Forms.ComboBox();
this.gpbNovoDispositivo = new System.Windows.Forms.GroupBox();
this.cmbTipos = new System.Windows.Forms.ComboBox();
this.btnSalvar = new System.Windows.Forms.Button();
this.txtDescricao = new System.Windows.Forms.TextBox();
this.lblDescricao = new System.Windows.Forms.Label();
this.lblTipo = new System.Windows.Forms.Label();
this.btnNovoDispositivo = new System.Windows.Forms.Button();
this.joystickStrip = new System.Windows.Forms.StatusStrip();
this.lblStripJoystick = new System.Windows.Forms.ToolStripStatusLabel();
this.gpbJoysticks = new System.Windows.Forms.GroupBox();
this.lblRPM = new System.Windows.Forms.Label();
this.trkRPM = new System.Windows.Forms.TrackBar();
this.lblPrecisao = new System.Windows.Forms.Label();
this.tkbPrecisao = new System.Windows.Forms.TrackBar();
this.tkbRampa = new System.Windows.Forms.TrackBar();
this.lblRampa = new System.Windows.Forms.Label();
this.lblPotencia = new System.Windows.Forms.Label();
this.tkbPotencia = new System.Windows.Forms.TrackBar();
this.btnVer = new System.Windows.Forms.Button();
this.btnJoyAtt = new System.Windows.Forms.Button();
this.btnJoyEdt = new System.Windows.Forms.Button();
this.cmbJoysticks = new System.Windows.Forms.ComboBox();
this.timerDispositivos = new System.Windows.Forms.Timer(this.components);
this.gpbSensoriamento = new System.Windows.Forms.GroupBox();
this.lblSenMotores = new System.Windows.Forms.Label();
this.gridSenMotores = new System.Windows.Forms.DataGridView();
this.btnDiagnosticos = new System.Windows.Forms.Button();
this.gpbAcoes.SuspendLayout();
this.erroStrip.SuspendLayout();
this.pnlLateral.SuspendLayout();
this.gpbDispositivos.SuspendLayout();
this.gpbNovoDispositivo.SuspendLayout();
this.joystickStrip.SuspendLayout();
this.gpbJoysticks.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trkRPM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tkbPrecisao)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tkbRampa)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tkbPotencia)).BeginInit();
this.gpbSensoriamento.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridSenMotores)).BeginInit();
this.SuspendLayout();
//
// gpbAcoes
//
this.gpbAcoes.Controls.Add(this.erroStrip);
this.gpbAcoes.Controls.Add(this.pnlLateral);
this.gpbAcoes.Dock = System.Windows.Forms.DockStyle.Right;
this.gpbAcoes.Location = new System.Drawing.Point(582, 0);
this.gpbAcoes.Name = "gpbAcoes";
this.gpbAcoes.Size = new System.Drawing.Size(829, 677);
this.gpbAcoes.TabIndex = 0;
this.gpbAcoes.TabStop = false;
this.gpbAcoes.Text = "Conexão";
//
// erroStrip
//
this.erroStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.erroStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblStripErro});
this.erroStrip.Location = new System.Drawing.Point(3, 648);
this.erroStrip.Name = "erroStrip";
this.erroStrip.Size = new System.Drawing.Size(823, 26);
this.erroStrip.TabIndex = 1;
this.erroStrip.Text = "statusStrip1";
//
// lblStripErro
//
this.lblStripErro.Name = "lblStripErro";
this.lblStripErro.Size = new System.Drawing.Size(62, 20);
this.lblStripErro.Text = "Iniciado";
//
// pnlLateral
//
this.pnlLateral.AutoScroll = true;
this.pnlLateral.Controls.Add(this.gpbDispositivos);
this.pnlLateral.Controls.Add(this.btnRemover);
this.pnlLateral.Controls.Add(this.lblDispositivos);
this.pnlLateral.Controls.Add(this.cmbDispositivos);
this.pnlLateral.Controls.Add(this.gpbNovoDispositivo);
this.pnlLateral.Controls.Add(this.btnNovoDispositivo);
this.pnlLateral.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlLateral.Location = new System.Drawing.Point(3, 18);
this.pnlLateral.Name = "pnlLateral";
this.pnlLateral.Size = new System.Drawing.Size(823, 656);
this.pnlLateral.TabIndex = 0;
//
// gpbDispositivos
//
this.gpbDispositivos.Controls.Add(this.lstDisponiveis);
this.gpbDispositivos.Location = new System.Drawing.Point(215, 96);
this.gpbDispositivos.Name = "gpbDispositivos";
this.gpbDispositivos.Size = new System.Drawing.Size(599, 164);
this.gpbDispositivos.TabIndex = 3;
this.gpbDispositivos.TabStop = false;
this.gpbDispositivos.Text = "Dispositivos disponíveis";
//
// lstDisponiveis
//
this.lstDisponiveis.HideSelection = false;
this.lstDisponiveis.Location = new System.Drawing.Point(15, 25);
this.lstDisponiveis.Name = "lstDisponiveis";
this.lstDisponiveis.Size = new System.Drawing.Size(334, 124);
this.lstDisponiveis.TabIndex = 0;
this.lstDisponiveis.UseCompatibleStateImageBehavior = false;
this.lstDisponiveis.View = System.Windows.Forms.View.List;
//
// btnRemover
//
this.btnRemover.Location = new System.Drawing.Point(116, 62);
this.btnRemover.Name = "btnRemover";
this.btnRemover.Size = new System.Drawing.Size(83, 28);
this.btnRemover.TabIndex = 12;
this.btnRemover.Text = "Remover";
this.btnRemover.UseVisualStyleBackColor = true;
this.btnRemover.Click += new System.EventHandler(this.btnRemover_Click);
//
// lblDispositivos
//
this.lblDispositivos.AutoSize = true;
this.lblDispositivos.Location = new System.Drawing.Point(27, 12);
this.lblDispositivos.Name = "lblDispositivos";
this.lblDispositivos.Size = new System.Drawing.Size(83, 17);
this.lblDispositivos.TabIndex = 11;
this.lblDispositivos.Text = "Dispositivos";
//
// cmbDispositivos
//
this.cmbDispositivos.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbDispositivos.FormattingEnabled = true;
this.cmbDispositivos.Location = new System.Drawing.Point(30, 32);
this.cmbDispositivos.Name = "cmbDispositivos";
this.cmbDispositivos.Size = new System.Drawing.Size(169, 24);
this.cmbDispositivos.TabIndex = 10;
//
// gpbNovoDispositivo
//
this.gpbNovoDispositivo.Controls.Add(this.cmbTipos);
this.gpbNovoDispositivo.Controls.Add(this.btnSalvar);
this.gpbNovoDispositivo.Controls.Add(this.txtDescricao);
this.gpbNovoDispositivo.Controls.Add(this.lblDescricao);
this.gpbNovoDispositivo.Controls.Add(this.lblTipo);
this.gpbNovoDispositivo.Enabled = false;
this.gpbNovoDispositivo.Location = new System.Drawing.Point(21, 96);
this.gpbNovoDispositivo.Name = "gpbNovoDispositivo";
this.gpbNovoDispositivo.Size = new System.Drawing.Size(188, 164);
this.gpbNovoDispositivo.TabIndex = 9;
this.gpbNovoDispositivo.TabStop = false;
this.gpbNovoDispositivo.Text = "Novo Dispositivo";
//
// cmbTipos
//
this.cmbTipos.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbTipos.FormattingEnabled = true;
this.cmbTipos.Location = new System.Drawing.Point(9, 45);
this.cmbTipos.Name = "cmbTipos";
this.cmbTipos.Size = new System.Drawing.Size(169, 24);
this.cmbTipos.TabIndex = 2;
//
// btnSalvar
//
this.btnSalvar.Location = new System.Drawing.Point(9, 124);
this.btnSalvar.Name = "btnSalvar";
this.btnSalvar.Size = new System.Drawing.Size(169, 25);
this.btnSalvar.TabIndex = 9;
this.btnSalvar.Text = "Salvar";
this.btnSalvar.UseVisualStyleBackColor = true;
this.btnSalvar.Click += new System.EventHandler(this.btnSalvar_Click);
//
// txtDescricao
//
this.txtDescricao.Location = new System.Drawing.Point(9, 94);
this.txtDescricao.Name = "txtDescricao";
this.txtDescricao.Size = new System.Drawing.Size(169, 22);
this.txtDescricao.TabIndex = 3;
//
// lblDescricao
//
this.lblDescricao.AutoSize = true;
this.lblDescricao.Location = new System.Drawing.Point(6, 74);
this.lblDescricao.Name = "lblDescricao";
this.lblDescricao.Size = new System.Drawing.Size(71, 17);
this.lblDescricao.TabIndex = 2;
this.lblDescricao.Text = "Descrição";
//
// lblTipo
//
this.lblTipo.AutoSize = true;
this.lblTipo.Location = new System.Drawing.Point(6, 25);
this.lblTipo.Name = "lblTipo";
this.lblTipo.Size = new System.Drawing.Size(36, 17);
this.lblTipo.TabIndex = 0;
this.lblTipo.Text = "Tipo";
//
// btnNovoDispositivo
//
this.btnNovoDispositivo.Location = new System.Drawing.Point(30, 62);
this.btnNovoDispositivo.Name = "btnNovoDispositivo";
this.btnNovoDispositivo.Size = new System.Drawing.Size(80, 28);
this.btnNovoDispositivo.TabIndex = 8;
this.btnNovoDispositivo.Text = "Novo dispositivo";
this.btnNovoDispositivo.UseVisualStyleBackColor = true;
this.btnNovoDispositivo.Click += new System.EventHandler(this.btnNovoDispositivo_Click);
//
// joystickStrip
//
this.joystickStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.joystickStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblStripJoystick});
this.joystickStrip.Location = new System.Drawing.Point(0, 651);
this.joystickStrip.Name = "joystickStrip";
this.joystickStrip.Size = new System.Drawing.Size(582, 26);
this.joystickStrip.TabIndex = 1;
this.joystickStrip.Text = "statusStrip1";
//
// lblStripJoystick
//
this.lblStripJoystick.Name = "lblStripJoystick";
this.lblStripJoystick.Size = new System.Drawing.Size(161, 20);
this.lblStripJoystick.Text = "Joystick: Desconectado";
//
// gpbJoysticks
//
this.gpbJoysticks.Controls.Add(this.lblRPM);
this.gpbJoysticks.Controls.Add(this.trkRPM);
this.gpbJoysticks.Controls.Add(this.lblPrecisao);
this.gpbJoysticks.Controls.Add(this.tkbPrecisao);
this.gpbJoysticks.Controls.Add(this.tkbRampa);
this.gpbJoysticks.Controls.Add(this.lblRampa);
this.gpbJoysticks.Controls.Add(this.lblPotencia);
this.gpbJoysticks.Controls.Add(this.tkbPotencia);
this.gpbJoysticks.Controls.Add(this.btnVer);
this.gpbJoysticks.Controls.Add(this.btnJoyAtt);
this.gpbJoysticks.Controls.Add(this.btnJoyEdt);
this.gpbJoysticks.Controls.Add(this.cmbJoysticks);
this.gpbJoysticks.Location = new System.Drawing.Point(12, 12);
this.gpbJoysticks.Name = "gpbJoysticks";
this.gpbJoysticks.Size = new System.Drawing.Size(372, 408);
this.gpbJoysticks.TabIndex = 2;
this.gpbJoysticks.TabStop = false;
this.gpbJoysticks.Text = "Controle";
//
// lblRPM
//
this.lblRPM.AutoSize = true;
this.lblRPM.Location = new System.Drawing.Point(12, 328);
this.lblRPM.Name = "lblRPM";
this.lblRPM.Size = new System.Drawing.Size(62, 17);
this.lblRPM.TabIndex = 21;
this.lblRPM.Text = "RPM: 50";
//
// trkRPM
//
this.trkRPM.Location = new System.Drawing.Point(15, 348);
this.trkRPM.Maximum = 200;
this.trkRPM.Minimum = 5;
this.trkRPM.Name = "trkRPM";
this.trkRPM.Size = new System.Drawing.Size(334, 56);
this.trkRPM.TabIndex = 20;
this.trkRPM.TickFrequency = 5;
this.trkRPM.Value = 50;
this.trkRPM.Scroll += new System.EventHandler(this.trkRPM_Scroll);
//
// lblPrecisao
//
this.lblPrecisao.AutoSize = true;
this.lblPrecisao.Location = new System.Drawing.Point(12, 249);
this.lblPrecisao.Name = "lblPrecisao";
this.lblPrecisao.Size = new System.Drawing.Size(79, 17);
this.lblPrecisao.TabIndex = 19;
this.lblPrecisao.Text = "Precisão: 4";
//
// tkbPrecisao
//
this.tkbPrecisao.Location = new System.Drawing.Point(15, 269);
this.tkbPrecisao.Minimum = 1;
this.tkbPrecisao.Name = "tkbPrecisao";
this.tkbPrecisao.Size = new System.Drawing.Size(334, 56);
this.tkbPrecisao.TabIndex = 18;
this.tkbPrecisao.Value = 4;
this.tkbPrecisao.Scroll += new System.EventHandler(this.tkbPrecisao_Scroll);
//
// tkbRampa
//
this.tkbRampa.Location = new System.Drawing.Point(15, 196);
this.tkbRampa.Minimum = 1;
this.tkbRampa.Name = "tkbRampa";
this.tkbRampa.Size = new System.Drawing.Size(334, 56);
this.tkbRampa.TabIndex = 17;
this.tkbRampa.Value = 7;
this.tkbRampa.Scroll += new System.EventHandler(this.tkbRampa_Scroll);
//
// lblRampa
//
this.lblRampa.AutoSize = true;
this.lblRampa.Location = new System.Drawing.Point(12, 176);
this.lblRampa.Name = "lblRampa";
this.lblRampa.Size = new System.Drawing.Size(99, 17);
this.lblRampa.TabIndex = 16;
this.lblRampa.Text = "Rampa: 70 ms";
//
// lblPotencia
//
this.lblPotencia.AutoSize = true;
this.lblPotencia.Location = new System.Drawing.Point(12, 102);
this.lblPotencia.Name = "lblPotencia";
this.lblPotencia.Size = new System.Drawing.Size(107, 17);
this.lblPotencia.TabIndex = 15;
this.lblPotencia.Text = "Potência: 100%";
//
// tkbPotencia
//
this.tkbPotencia.Location = new System.Drawing.Point(15, 122);
this.tkbPotencia.Minimum = 1;
this.tkbPotencia.Name = "tkbPotencia";
this.tkbPotencia.Size = new System.Drawing.Size(334, 56);
this.tkbPotencia.TabIndex = 14;
this.tkbPotencia.Value = 10;
this.tkbPotencia.Scroll += new System.EventHandler(this.tkbPotencia_Scroll);
//
// btnVer
//
this.btnVer.Location = new System.Drawing.Point(265, 60);
this.btnVer.Name = "btnVer";
this.btnVer.Size = new System.Drawing.Size(84, 25);
this.btnVer.TabIndex = 13;
this.btnVer.Text = "Ver";
this.btnVer.UseVisualStyleBackColor = true;
this.btnVer.Click += new System.EventHandler(this.btnVer_Click);
//
// btnJoyAtt
//
this.btnJoyAtt.Location = new System.Drawing.Point(175, 29);
this.btnJoyAtt.Name = "btnJoyAtt";
this.btnJoyAtt.Size = new System.Drawing.Size(84, 25);
this.btnJoyAtt.TabIndex = 12;
this.btnJoyAtt.Text = "Atualizar";
this.btnJoyAtt.UseVisualStyleBackColor = true;
this.btnJoyAtt.Click += new System.EventHandler(this.btnJoyAtt_Click);
//
// btnJoyEdt
//
this.btnJoyEdt.Location = new System.Drawing.Point(265, 29);
this.btnJoyEdt.Name = "btnJoyEdt";
this.btnJoyEdt.Size = new System.Drawing.Size(84, 25);
this.btnJoyEdt.TabIndex = 11;
this.btnJoyEdt.Text = "Editar";
this.btnJoyEdt.UseVisualStyleBackColor = true;
this.btnJoyEdt.Click += new System.EventHandler(this.btnJoyEdt_Click);
//
// cmbJoysticks
//
this.cmbJoysticks.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbJoysticks.FormattingEnabled = true;
this.cmbJoysticks.Location = new System.Drawing.Point(15, 30);
this.cmbJoysticks.Name = "cmbJoysticks";
this.cmbJoysticks.Size = new System.Drawing.Size(154, 24);
this.cmbJoysticks.TabIndex = 3;
//
// timerDispositivos
//
this.timerDispositivos.Interval = 5000;
this.timerDispositivos.Tick += new System.EventHandler(this.timerDispositivos_Tick);
//
// gpbSensoriamento
//
this.gpbSensoriamento.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gpbSensoriamento.Controls.Add(this.lblSenMotores);
this.gpbSensoriamento.Controls.Add(this.gridSenMotores);
this.gpbSensoriamento.Location = new System.Drawing.Point(12, 426);
this.gpbSensoriamento.Name = "gpbSensoriamento";
this.gpbSensoriamento.Size = new System.Drawing.Size(564, 222);
this.gpbSensoriamento.TabIndex = 13;
this.gpbSensoriamento.TabStop = false;
this.gpbSensoriamento.Text = "Sensoriamento";
//
// lblSenMotores
//
this.lblSenMotores.AutoSize = true;
this.lblSenMotores.Location = new System.Drawing.Point(12, 23);
this.lblSenMotores.Name = "lblSenMotores";
this.lblSenMotores.Size = new System.Drawing.Size(59, 17);
this.lblSenMotores.TabIndex = 1;
this.lblSenMotores.Text = "Motores";
//
// gridSenMotores
//
this.gridSenMotores.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gridSenMotores.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridSenMotores.Location = new System.Drawing.Point(6, 43);
this.gridSenMotores.Name = "gridSenMotores";
this.gridSenMotores.RowHeadersWidth = 51;
this.gridSenMotores.RowTemplate.Height = 24;
this.gridSenMotores.Size = new System.Drawing.Size(552, 173);
this.gridSenMotores.TabIndex = 0;
//
// btnDiagnosticos
//
this.btnDiagnosticos.Location = new System.Drawing.Point(390, 41);
this.btnDiagnosticos.Name = "btnDiagnosticos";
this.btnDiagnosticos.Size = new System.Drawing.Size(112, 25);
this.btnDiagnosticos.TabIndex = 14;
this.btnDiagnosticos.Text = "Diagnósticos";
this.btnDiagnosticos.UseVisualStyleBackColor = true;
this.btnDiagnosticos.Click += new System.EventHandler(this.btnDiagnosticos_Click);
//
// frmPrincipal
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1411, 677);
this.Controls.Add(this.btnDiagnosticos);
this.Controls.Add(this.gpbJoysticks);
this.Controls.Add(this.gpbSensoriamento);
this.Controls.Add(this.joystickStrip);
this.Controls.Add(this.gpbAcoes);
this.Name = "frmPrincipal";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Agro Base";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmPrincipal_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
this.gpbAcoes.ResumeLayout(false);
this.gpbAcoes.PerformLayout();
this.erroStrip.ResumeLayout(false);
this.erroStrip.PerformLayout();
this.pnlLateral.ResumeLayout(false);
this.pnlLateral.PerformLayout();
this.gpbDispositivos.ResumeLayout(false);
this.gpbNovoDispositivo.ResumeLayout(false);
this.gpbNovoDispositivo.PerformLayout();
this.joystickStrip.ResumeLayout(false);
this.joystickStrip.PerformLayout();
this.gpbJoysticks.ResumeLayout(false);
this.gpbJoysticks.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trkRPM)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tkbPrecisao)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tkbRampa)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tkbPotencia)).EndInit();
this.gpbSensoriamento.ResumeLayout(false);
this.gpbSensoriamento.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.gridSenMotores)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox gpbAcoes;
private System.Windows.Forms.Panel pnlLateral;
private System.Windows.Forms.Button btnNovoDispositivo;
private System.Windows.Forms.GroupBox gpbNovoDispositivo;
private System.Windows.Forms.Button btnSalvar;
private System.Windows.Forms.TextBox txtDescricao;
private System.Windows.Forms.Label lblDescricao;
private System.Windows.Forms.Label lblTipo;
private System.Windows.Forms.Button btnRemover;
private System.Windows.Forms.Label lblDispositivos;
private System.Windows.Forms.ComboBox cmbDispositivos;
private System.Windows.Forms.StatusStrip erroStrip;
private System.Windows.Forms.StatusStrip joystickStrip;
private System.Windows.Forms.GroupBox gpbJoysticks;
private System.Windows.Forms.Button btnJoyEdt;
private System.Windows.Forms.ComboBox cmbJoysticks;
public System.Windows.Forms.ToolStripStatusLabel lblStripErro;
public System.Windows.Forms.ToolStripStatusLabel lblStripJoystick;
private System.Windows.Forms.Button btnJoyAtt;
private System.Windows.Forms.Button btnVer;
private System.Windows.Forms.GroupBox gpbDispositivos;
private System.Windows.Forms.Timer timerDispositivos;
public System.Windows.Forms.ListView lstDisponiveis;
private System.Windows.Forms.ComboBox cmbTipos;
private System.Windows.Forms.Label lblPotencia;
private System.Windows.Forms.TrackBar tkbPotencia;
private System.Windows.Forms.Label lblPrecisao;
private System.Windows.Forms.TrackBar tkbPrecisao;
private System.Windows.Forms.TrackBar tkbRampa;
private System.Windows.Forms.Label lblRampa;
private System.Windows.Forms.GroupBox gpbSensoriamento;
private System.Windows.Forms.Label lblSenMotores;
public System.Windows.Forms.DataGridView gridSenMotores;
private System.Windows.Forms.Label lblRPM;
private System.Windows.Forms.Button btnDiagnosticos;
public System.Windows.Forms.TrackBar trkRPM;
}
}

View File

@ -0,0 +1,150 @@
using AgroBase.Comum;
using AgroBase.Forms;
using AgroBase.Models;
using AgroBase.Services;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Windows.Gaming.Input;
using static AgroBase.Models.Enuns;
using Timer = System.Windows.Forms.Timer;
namespace AgroBase
{
public partial class frmPrincipal : Form
{
public static List<DispositivosService> Dispositivos = new List<DispositivosService>();
public frmPrincipal()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
timerDispositivos.Enabled = true;
btnJoyAtt_Click(sender, e);
}
private void btnNovoDispositivo_Click(object sender, EventArgs e)
{
gpbNovoDispositivo.Enabled = true;
cmbTipos.Items.Clear();
cmbTipos.Items.AddRange(Enum.GetNames(typeof(T_Code)));
txtDescricao.Text = "";
cmbTipos.Focus();
}
private void btnSalvar_Click(object sender, EventArgs e)
{
Dispositivos.Add(new DispositivosService()
{
Dispositivo = (T_Code)Enum.Parse(typeof(T_Code), cmbTipos.Text),
_Nome = cmbTipos.Text,
_Descricao = txtDescricao.Text,
_Porta = new SerialPort()
});
pnlLateral.Controls.Add(Dispositivos[Dispositivos.Count - 1].InstanciarDispositivo(Dispositivos.Count - 1));
cmbDispositivos.Items.Add(Dispositivos[Dispositivos.Count - 1]._Descricao);
gpbNovoDispositivo.Enabled = false;
cmbDispositivos.SelectedIndex = Dispositivos.Count - 1;
}
private void btnRemover_Click(object sender, EventArgs e)
{
pnlLateral.Controls.Remove(Dispositivos[cmbDispositivos.SelectedIndex].gpbItem);
Dispositivos.RemoveAt(cmbDispositivos.SelectedIndex);
cmbDispositivos.Items.RemoveAt(cmbDispositivos.SelectedIndex);
cmbDispositivos.SelectedIndex = Dispositivos.Count - 1;
int idx = 0;
Dispositivos.ForEach(Dispositivo =>
{
Dispositivo.AtualizaIndex(idx);
idx++;
});
}
private void btnJoyAtt_Click(object sender, EventArgs e)
{
Joystick.AtualizaDispositivo();
}
private void btnJoyEdt_Click(object sender, EventArgs e)
{
}
private void btnVer_Click(object sender, EventArgs e)
{
frmInstancial.frmJoystick.Show();
}
private void timerDispositivos_Tick(object sender, EventArgs e)
{
lstDisponiveis.Items.Clear();
lstDisponiveis.Items.AddRange(
SerialService.DispositivosConectados
.Select(x => new ListViewItem()
{
Text = x.PortaCOM + " - " + Enum.GetName(typeof(T_Code), x.Dispositivo) + " - " + (Dispositivos.FirstOrDefault(y => y.PortaCOM() == x.PortaCOM)?.StatusPorta() ?? "Desconectado")
}).ToArray()
);
SerialService.AtualizarDispositivos();
}
private void tkbPotencia_Scroll(object sender, EventArgs e)
{
Joystick.Potencia = tkbPotencia.Value * 10;
lblPotencia.Text = "Potência: " + Joystick.Potencia + "%";
}
private void tkbRampa_Scroll(object sender, EventArgs e)
{
Joystick.Rampa = tkbRampa.Value * 10;
lblRampa.Text = "Rampa: " + Joystick.Rampa + " ms";
}
private void tkbPrecisao_Scroll(object sender, EventArgs e)
{
Joystick.Precisao = tkbPrecisao.Value;
lblPrecisao.Text = "Precisão: " + Joystick.Precisao;
}
private void trkRPM_Scroll(object sender, EventArgs e)
{
AtualizaRPM(((TrackBar)sender).Value);
}
private void frmPrincipal_FormClosed(object sender, FormClosedEventArgs e)
{
Environment.Exit(0);
}
private void btnDiagnosticos_Click(object sender, EventArgs e)
{
frmDiagnosticos frm = new frmDiagnosticos();
frm.ShowDialog();
}
public void AtualizaRPM(int valor)
{
if (valor >= trkRPM.Minimum && valor <= trkRPM.Maximum)
{
trkRPM.Value = valor;
Joystick.RPM = trkRPM.Value;
lblRPM.Text = "RPM: " + Joystick.RPM;
}
}
}
}

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="erroStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>14, 13</value>
</metadata>
<metadata name="erroStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>14, 13</value>
</metadata>
<metadata name="joystickStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 13</value>
</metadata>
<metadata name="timerDispositivos.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>284, 16</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>59</value>
</metadata>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgroBase.Models
{
public interface DispositivosBaseModel
{
void RecebeProtocoloSerial(string Protocolo);
string GetTaxaAmostragem();
void SetTaxaAmostragem(int TaxaAmostragem);
string ProtocoloConfiguracao(bool Conectar);
void PopulaGridSensoriamento();
void AtualizaGridSensoriamento();
}
}

View File

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AgroBase.Models
{
public class Enuns
{
public enum Estado
{
Desligado,
Ligado,
Reset
}
public enum Direcao
{
Parado,
Frente,
Tras,
Esquerda,
Direita,
Cima,
Baixo,
EsquerdaBaixo,
EsquerdaCima,
DireitaBaixo,
DireitaCima
}
public enum Sentido
{
Parado,
Horario,
Antihorario
}
public enum Comando
{
Vazio,
Motor,
Camera,
Laser,
Iluminacao,
BrilhoMais,
BrilhoMenos,
Embreagem,
MudaCamera,
CaputrarImagem,
Marcador,
IniciaOdometroParcial,
VelocidadeMais,
VelocidadeMenos
}
public enum T_Code
{
Vzo = 200,
Mov = 100,
Dir = 101,
Sen = 102,
Atu = 103,
}
public enum F_Code
{
Nda = 200,
Chk = 244,
Cfg = 258,
Tst = 288,
Cmd = 293,
}
public enum S_Code
{
sRPM,
sTST
}
}
}

View File

@ -0,0 +1,146 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System;
using AgroBase.Comum;
using static AgroBase.Models.Enuns;
using AgroBase.Forms;
using AgroBase.Models;
using System.Threading.Tasks;
using Windows.Gaming.Input;
namespace AgroBase
{
class Joystick
{
public static Direcao UltimaDirecao = Direcao.Parado;
public static bool Pressionado = false;
public static DispositivosService DispMov;
public static int Potencia { get; set; } = 100;
public static int Rampa { get; set; } = 70;
public static int Precisao { get; set; } = 4;
public static int RPM { get; set; } = 50;
public static Timer tmrJoystick = new Timer() { Interval = 100, Enabled = false };
public static Gamepad JoystickConectado = null;
public static void AtualizaDispositivo()
{
DispMov = frmPrincipal.Dispositivos.FirstOrDefault(x => x._Porta.IsOpen && x.Dispositivo == T_Code.Mov);
if (Gamepad.Gamepads.Count() > 0)
{
JoystickConectado = Gamepad.Gamepads.First();
tmrJoystick.Enabled = true;
tmrJoystick.Tick += TmrJoystick_Tick;
}
else
{
tmrJoystick.Enabled = false;
JoystickConectado = null;tmrJoystick.Tick -= TmrJoystick_Tick;
}
}
private static void TmrJoystick_Tick(object sender, EventArgs e)
{
var Leitura = JoystickConectado.GetCurrentReading();
AtualizaConsole("Botao " + Leitura.Buttons + " pressionado");
switch (Leitura.Buttons)
{
case GamepadButtons.DPadUp:
EnviaComandoMotor(Keys.Up);
break;
case GamepadButtons.DPadDown:
EnviaComandoMotor(Keys.Down);
break;
case GamepadButtons.DPadLeft:
EnviaComandoMotor(Keys.Left);
break;
case GamepadButtons.DPadRight:
EnviaComandoMotor(Keys.Right);
break;
case GamepadButtons.None:
EnviaComandoMotor(Keys.Escape);
break;
case GamepadButtons.RightShoulder:
EnviaComandoMotor(Keys.Add);
break;
case GamepadButtons.LeftShoulder:
EnviaComandoMotor(Keys.Subtract);
break;
}
}
public static void EnviaComandoMotor(Keys Tecla)
{
if (DispMov == null)
{
return;
}
if (Tecla == Keys.Escape)
{
UltimaDirecao = Direcao.Parado;
Pressionado = true;
}
else if (Tecla == Keys.Add)
{
frmInstancial.frmPrincipal.AtualizaRPM(frmInstancial.frmPrincipal.trkRPM.Value + 1);
Pressionado = true;
}
else if (Tecla == Keys.Subtract)
{
frmInstancial.frmPrincipal.AtualizaRPM(frmInstancial.frmPrincipal.trkRPM.Value - 1);
Pressionado = true;
}
else if (Tecla == Keys.Up && UltimaDirecao != Direcao.Frente)
{
UltimaDirecao = Direcao.Frente;
Pressionado = true;
}
else if (Tecla == Keys.Down && UltimaDirecao != Direcao.Tras)
{
UltimaDirecao = Direcao.Tras;
Pressionado = true;
}
else if (Tecla == Keys.Left && UltimaDirecao != Direcao.Esquerda)
{
UltimaDirecao = Direcao.Esquerda;
Pressionado = true;
}
else if (Tecla == Keys.Right && UltimaDirecao != Direcao.Direita)
{
UltimaDirecao = Direcao.Direita;
Pressionado = true;
}
else
{
Pressionado = false;
}
if (Pressionado)
{
for (int i = 0; i < 2; i++)
{
foreach (var Motor in ((MovimentacaoModel)DispMov.Dados).Motores)
{
string ProtocoloMotor = Motor.ProtocoloComando(UltimaDirecao);
DispMov.EnviarDadosSerial(ProtocoloMotor);
Task.Delay(10);
}
Task.Delay(100);
}
AtualizaConsole(Enum.GetName(typeof(Direcao), UltimaDirecao));
}
}
private static void AtualizaConsole(string Mensagem)
{
frmInstancial.frmJoystick.lblConsole.Text = Mensagem;
}
}
}

View File

@ -0,0 +1,296 @@
using AgroBase.Forms;
using AgroBase.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static AgroBase.Models.Enuns;
namespace AgroBase.Models
{
public class MovimentacaoModel : DispositivosBaseModel
{
public int _TaxaAmostragem { get; set; }
public double DiametroRoda { get; set; } = 0.3556;
public List<SensoriamentoMotor> Motores = new List<SensoriamentoMotor>()
{
new SensoriamentoMotor() {
Canal = 0,
ID = "ET",
Descricao = "Esquerdo Trás",
ConfigSentidos = new ConfiguracaoSentidoMotor() {
Direita = Sentido.Antihorario,
Esquerda = Sentido.Horario,
Frente = Sentido.Horario,
Tras = Sentido.Antihorario
}
},
new SensoriamentoMotor() {
Canal = 1,
ID = "EF",
Descricao = "Esquerdo Frente",
ConfigSentidos = new ConfiguracaoSentidoMotor() {
Direita = Sentido.Antihorario,
Esquerda = Sentido.Horario,
Frente = Sentido.Horario,
Tras = Sentido.Antihorario
}
},
new SensoriamentoMotor() {
Canal = 2,
ID = "DT",
Descricao = "Direito Trás",
ConfigSentidos = new ConfiguracaoSentidoMotor() {
Direita = Sentido.Antihorario,
Esquerda = Sentido.Horario,
Frente = Sentido.Antihorario,
Tras = Sentido.Horario
}
},
new SensoriamentoMotor() {
Canal = 3,
ID = "DF",
Descricao = "Direito Frente",
ConfigSentidos = new ConfiguracaoSentidoMotor() {
Direita = Sentido.Antihorario,
Esquerda = Sentido.Horario,
Frente = Sentido.Antihorario,
Tras = Sentido.Horario
}
}
};
public string ProtocoloConfiguracao(bool Conectar)
{
return ((int)F_Code.Cfg).ToString() +
(Conectar ? "1" : "0") + ";" +
GetTaxaAmostragem() + ";" +
string.Join(";", Motores.OrderBy(x => x.Canal).Select(x => x.Conectado ? "1" : "1").ToArray());
}
public void RecebeProtocoloSerial(string Protocolo)
{
// #ET;00000;00000;00000;000
if (!string.IsNullOrEmpty(Protocolo) && Protocolo[0].ToString() == SerialService.BeginSensor)
{
S_Code TipoSensor = (S_Code)(int.Parse(Protocolo[1].ToString()));
string[] Dados = Protocolo.Substring(2, Protocolo.Length - 3).Split(';');
SensoriamentoMotor Motor = Motores.FirstOrDefault(x => x.ID == Dados[0]);
if (Motor == null)
{
return;
}
try
{
switch (TipoSensor)
{
case S_Code.sRPM:
{
int nPulsos = 0;
int.TryParse(Dados[1], out nPulsos);
Motor.NumeroPulsos = nPulsos;
int intervalo = 0;
int.TryParse(Dados[2], out intervalo);
Motor.Intervalo = intervalo;
double rpm = 0;
double.TryParse(Dados[3].Replace(".", ","), out rpm);
Motor.RPM = rpm;
int potencia = 0;
int.TryParse(Dados[4], out potencia);
Motor.Potencia = potencia;
break;
}
case S_Code.sTST:
{
bool testando = Dados[1] == "1";
if (!Motor.Testando && testando)
{
Motor.LogTestes = new List<SensoriamentoMotorTestes>();
}
Motor.Testando = testando;
if (Motor.Testando && Dados.Length >= 4)
{
string componente = Dados[2];
string resultado = Dados[3];
string comando = Dados[4];
string leitura = Dados[5];
Motor.LogTestes.Add(new SensoriamentoMotorTestes()
{
Componente = componente,
Sucesso = resultado == "SUCESSO",
Resultado = resultado,
Comando = comando,
Leitura = leitura,
Momento = DateTime.Now
});
}
break;
}
}
}
catch (Exception ex)
{
}
}
}
public string GetTaxaAmostragem()
{
return _TaxaAmostragem.ToString("00000");
}
public void SetTaxaAmostragem(int TaxaAmostragem)
{
_TaxaAmostragem = TaxaAmostragem;
}
public void PopulaGridSensoriamento()
{
frmInstancial.frmPrincipal.gridSenMotores.Rows.Clear();
frmInstancial.frmPrincipal.gridSenMotores.Columns.Clear();
frmInstancial.frmPrincipal.gridSenMotores.Columns.Add("clMotor", "Motor");
frmInstancial.frmPrincipal.gridSenMotores.Columns.Add("clInicializado", "Inicializado");
frmInstancial.frmPrincipal.gridSenMotores.Columns.Add("clSentido", "Sentido");
frmInstancial.frmPrincipal.gridSenMotores.Columns.Add("clPotencia", "Potencia");
frmInstancial.frmPrincipal.gridSenMotores.Columns.Add("clRPM", "RPM");
frmInstancial.frmPrincipal.gridSenMotores.Columns.Add("clVelocidade", "Velocidade");
foreach (var Motor in Motores)
{
frmInstancial.frmPrincipal.gridSenMotores.Rows.Add(new string[]
{
Motor.Descricao,
Motor.Inicializado ? "Sim" : "Não",
Enum.GetName(typeof(Sentido), Motor.Sentido),
Motor.Potencia.ToString(),
Motor.RPM.ToString(),
Motor.VelocidadeInstantanea.ToString()
});
}
}
public void AtualizaGridSensoriamento()
{
double RPM_Medio = Motores.Average(x => x.RPM);
foreach (var Motor in Motores)
{
Motor.CalculaVelocidadeInstantanea(DiametroRoda);
frmInstancial.frmPrincipal.gridSenMotores.Rows[Motor.Canal].Cells[1].Value = Motor.Inicializado ? "Sim" : "Não";
frmInstancial.frmPrincipal.gridSenMotores.Rows[Motor.Canal].Cells[2].Value = Enum.GetName(typeof(Sentido), Motor.Sentido);
frmInstancial.frmPrincipal.gridSenMotores.Rows[Motor.Canal].Cells[3].Value = Motor.Potencia.ToString();
frmInstancial.frmPrincipal.gridSenMotores.Rows[Motor.Canal].Cells[4].Value = Motor.RPM.ToString();
frmInstancial.frmPrincipal.gridSenMotores.Rows[Motor.Canal].Cells[5].Value = Motor.VelocidadeInstantanea.ToString();
}
}
}
public class SensoriamentoMotor
{
public int Canal { get; set; }
public string ID { get; set; }
public string Descricao { get; set; }
public bool Conectado { get; set; }
public bool Inicializado { get; set; }
public int RPM_SP { get; set; } = 0;
public int Potencia { get; set; } = 0;
public int Rampa { get; set; } = 0;
public int Precisao { get; set; } = 0;
public Sentido Sentido { get; set; }
public int NumeroPulsos { get; set; } = 0;
public int Intervalo { get; set; } = 0;
public double RPM { get; set; } = 0;
public double VelocidadeInstantanea { get; set; } = 0;
public ConfiguracaoSentidoMotor ConfigSentidos { get; set; }
public bool Testando { get; set; } = false;
public List<SensoriamentoMotorTestes> LogTestes { get; set; } = new List<SensoriamentoMotorTestes>();
public string ProtocoloComando(Direcao UltimaDirecao)
{
if (Conectado)
{
Potencia = Joystick.Potencia;
Rampa = Joystick.Rampa;
Precisao = Joystick.Precisao;
RPM_SP = Joystick.RPM;
switch (UltimaDirecao)
{
case Direcao.Frente:
Sentido = ConfigSentidos.Frente;
break;
case Direcao.Tras:
Sentido = ConfigSentidos.Tras;
break;
case Direcao.Esquerda:
Sentido = ConfigSentidos.Esquerda;
break;
case Direcao.Direita:
Sentido = ConfigSentidos.Direita;
break;
case Direcao.Parado:
default:
Sentido = ConfigSentidos.Parado;
break;
}
string ProtocoloMotor =
((int)F_Code.Cmd).ToString() +
Canal.ToString("0") + ";" +
Potencia.ToString("000") + ";" +
((int)Sentido).ToString() + ";" +
Rampa.ToString("000") + ";" +
Precisao.ToString("000") + ";" +
RPM_SP.ToString("000");
return ProtocoloMotor;
}
return "";
}
public string ProtocoloTeste()
{
if (Conectado)
{
string ProtocoloMotor =
((int)F_Code.Tst).ToString() +
Canal.ToString("0");
return ProtocoloMotor;
}
return "";
}
public void CalculaVelocidadeInstantanea(double Diametro)
{
VelocidadeInstantanea = (Math.PI * Diametro * 60 * RPM) / 1000; // Km/h
}
}
public class ConfiguracaoSentidoMotor
{
public Sentido Frente { get; set; }
public Sentido Tras { get; set; }
public Sentido Esquerda { get; set; }
public Sentido Direita { get; set; }
public Sentido Parado { get; set; } = Sentido.Parado;
}
public class SensoriamentoMotorTestes
{
public DateTime Momento { get; set; }
public string Componente { get; set; }
public bool Sucesso { get; set; }
public string Resultado { get; set; }
public string Comando { get; set; }
public string Leitura { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using AgroBase.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AgroBase
{
static class Program
{
/// <summary>
/// Ponto de entrada principal para o aplicativo.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmInstancial());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// As informações gerais sobre um assembly são controladas por
// conjunto de atributos. Altere estes valores de atributo para modificar as informações
// associadas a um assembly.
[assembly: AssemblyTitle("AgroBase")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AgroBase")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Definir ComVisible como false torna os tipos neste assembly invisíveis
// para componentes COM. Caso precise acessar um tipo neste assembly de
// COM, defina o atributo ComVisible como true nesse tipo.
[assembly: ComVisible(false)]
// O GUID a seguir será destinado à ID de typelib se este projeto for exposto para COM
[assembly: Guid("c54b41c0-1d21-4e3e-949e-0f86bbc86a33")]
// As informações da versão de um assembly consistem nos quatro valores a seguir:
//
// Versão Principal
// Versão Secundária
// Número da Versão
// Revisão
//
// É possível especificar todos os valores ou usar como padrão os Números de Build e da Revisão
// usando o "*" como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// O código foi gerado por uma ferramenta.
// Versão de Tempo de Execução:4.0.30319.42000
//
// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se
// o código for gerado novamente.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AgroBase.Properties {
using System;
/// <summary>
/// Uma classe de recurso de tipo de alta segurança, para pesquisar cadeias de caracteres localizadas etc.
/// </summary>
// Essa classe foi gerada automaticamente pela classe StronglyTypedResourceBuilder
// através de uma ferramenta como ResGen ou Visual Studio.
// Para adicionar ou remover um associado, edite o arquivo .ResX e execute ResGen novamente
// com a opção /str, ou recrie o projeto do VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Retorna a instância de ResourceManager armazenada em cache usada por essa classe.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AgroBase.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Substitui a propriedade CurrentUICulture do thread atual para todas as
/// pesquisas de recursos que usam essa classe de recurso de tipo de alta segurança.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// O código foi gerado por uma ferramenta.
// Versão de Tempo de Execução:4.0.30319.42000
//
// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se
// o código for gerado novamente.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AgroBase.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,471 @@
using AgroBase.Forms;
using AgroBase.Models;
using AgroBase.Services;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static AgroBase.Models.Enuns;
namespace AgroBase.Comum
{
public class DispositivosService
{
public T_Code Dispositivo { get; set; } = T_Code.Vzo;
public string _Nome { get; set; }
public string _Descricao { get; set; }
public SerialPort _Porta { get; set; }
public GroupBox gpbItem { get; set; }
public ComboBox cmbPorta { get; set; }
public ComboBox cmbBaudRate { get; set; }
public Label lblStatus { get; set; }
public Button btnConectar { get; set; }
public Button btnAtualizar { get; set; }
public TextBox txtEnvios { get; set; }
public RichTextBox txaConsole { get; set; }
public int _index { get; set; }
public List<string> DadosEnviados { get; set; } = new List<string>();
public List<string> DadosRecebidos { get; set; } = new List<string>();
public DispositivosBaseModel Dados { get; set; } = default(DispositivosBaseModel);
public int BaudRate()
{
if (cmbBaudRate.SelectedIndex < 0)
{
return 0;
}
return Convert.ToInt32(cmbBaudRate.SelectedItem.ToString());
}
public string PortaCOM()
{
if (cmbPorta.SelectedIndex < 0)
{
return "";
}
return cmbPorta.SelectedItem.ToString();
}
public string StatusPorta()
{
string _status = _Porta.IsOpen ? "Conectado" : "Desconectado";
frmInstancial.frmPrincipal.lblStripErro.Text = _status;
return _status;
}
public void AtualizarPortas()
{
cmbPorta.Items.Clear();
cmbPorta.Text = "";
var DispositivosTipo = SerialService.DispositivosConectados.Where(x => x.Dispositivo == Dispositivo).ToList();
for (int i = 0; i < DispositivosTipo.Count(); i++)
{
String PortaCom = DispositivosTipo[i].PortaCOM;
SerialPort _Porta = new SerialPort() { PortName = PortaCom };
try
{
_Porta.Open();
_Porta.Close();
cmbPorta.Items.Add(PortaCom);
}
catch (Exception ex)
{
}
}
if (cmbPorta.Items.Count > 1)
cmbPorta.SelectedIndex = 1;
else if (cmbPorta.Items.Count > 0)
cmbPorta.SelectedIndex = 0;
}
public void AtualizarBauds()
{
cmbBaudRate.Items.Clear();
cmbBaudRate.Text = "";
cmbBaudRate.Items.Add("9600");
cmbBaudRate.Items.Add("34800");
cmbBaudRate.Items.Add("115200");
cmbBaudRate.SelectedIndex = 2;
}
public bool ConectarPortaSerial()
{
try
{
_Porta.PortName = PortaCOM();
_Porta.BaudRate = BaudRate();
if (_Porta.IsOpen)
{
return false;
}
_Porta.Open();
lblStatus.Text = StatusPorta();
return _Porta.IsOpen;
}
catch (Exception ex)
{
frmInstancial.frmPrincipal.lblStripErro.Text = "Erro ao conectar na porta '" + PortaCOM() + "' - " + ex.Message;
return false;
}
}
public bool DesconectarPortaSerial()
{
try
{
if (!_Porta.IsOpen)
{
return false;
}
_Porta.Close();
lblStatus.Text = StatusPorta();
return !_Porta.IsOpen;
}
catch (Exception ex)
{
frmInstancial.frmPrincipal.lblStripErro.Text = "Erro ao desconectar da porta '" + PortaCOM() + "' - " + ex.Message;
return false;
}
}
public void EnviarDadosSerial(string Dados)
{
if (!_Porta.IsOpen || string.IsNullOrEmpty(Dados))
{
return;
}
_Porta.Write(Dados + SerialService.EndLine);
DadosEnviados.Add("> " + DateTime.Now.ToString("HH:mm:ss:fff") + " - " + Dados);
AtualizarConsole(DadosEnviados[DadosEnviados.Count - 1]);
}
public Control InstanciarDispositivo(int index)
{
switch (Dispositivo)
{
case T_Code.Mov:
Dados = new MovimentacaoModel();
((MovimentacaoModel)Dados)._TaxaAmostragem = 2000;
Dados.PopulaGridSensoriamento();
break;
default:
Dados = default(DispositivosBaseModel);
break;
}
_Porta.DataReceived += _Porta_DataReceived;
gpbItem = new GroupBox()
{
Name = "gpb" + _Nome,
Text = _Descricao,
Location = new System.Drawing.Point() { X = 13, Y = 0 },
Size = new System.Drawing.Size() { Height = 251, Width = 580 },
};
AtualizaIndex(index);
Label lblPorta = new Label()
{
Name = "lbl" + _Nome + "Por",
Text = "Porta",
Location = new System.Drawing.Point() { X = 28, Y = 27 },
Size = new System.Drawing.Size() { Height = 17, Width = 42 }
};
cmbPorta = new ComboBox()
{
Name = "cmb" + _Nome + "Por",
Text = "",
Location = new System.Drawing.Point() { X = 31, Y = 47 },
Size = new System.Drawing.Size() { Height = 24, Width = 89 },
DropDownStyle = ComboBoxStyle.DropDownList
};
AtualizarPortas();
Label lblBaudRate = new Label()
{
Name = "lbl" + _Nome + "Bau",
Text = "Baud Rate",
Location = new System.Drawing.Point() { X = 28, Y = 74 },
Size = new System.Drawing.Size() { Height = 17, Width = 75 }
};
cmbBaudRate = new ComboBox()
{
Name = "cmb" + _Nome + "Bau",
Text = "",
Location = new System.Drawing.Point() { X = 31, Y = 94 },
Size = new System.Drawing.Size() { Height = 24, Width = 89 },
DropDownStyle = ComboBoxStyle.DropDownList
};
AtualizarBauds();
Label lblAmostragem = new Label()
{
Name = "lbl" + _Nome + "Amo",
Text = "Amostragem (ms)",
Location = new System.Drawing.Point() { X = 31, Y = 124 },
Size = new System.Drawing.Size() { Height = 17, Width = 100 }
};
NumericUpDown nudAmostragem = new NumericUpDown()
{
Name = "nud" + _Nome + "Amo",
Minimum = 0,
Maximum = 99999,
Value = decimal.Parse(Dados.GetTaxaAmostragem()),
Location = new System.Drawing.Point() { X = 31, Y = 144 },
Size = new System.Drawing.Size() { Height = 24, Width = 89 }
};
nudAmostragem.ValueChanged += nudAmostragem_ValueChanged;
btnAtualizar = new Button()
{
Name = "btn" + _Nome + "Att",
Text = "Atualizar",
Location = new System.Drawing.Point() { X = 31, Y = 170 },
Size = new System.Drawing.Size() { Height = 24, Width = 89 }
};
btnAtualizar.Click += btnAtualizar_Click;
btnConectar = new Button()
{
Name = "btn" + _Nome + "Con",
Text = "Conectar",
Location = new System.Drawing.Point() { X = 31, Y = 201 },
Size = new System.Drawing.Size() { Height = 24, Width = 89 }
};
btnConectar.Click += btnConectar_Click;
lblStatus = new Label()
{
Name = "lbl" + _Nome + "Sta",
Text = _Porta.IsOpen ? "Conectado" : "Desconectado",
Location = new System.Drawing.Point() { X = 28, Y = 231 },
Size = new System.Drawing.Size() { Height = 17, Width = 100 }
};
Label lblMotores = new Label()
{
Name = "lbl" + _Nome + "Mot",
Text = "Motores",
Location = new System.Drawing.Point() { X = 135, Y = 27 },
Size = new System.Drawing.Size() { Height = 17, Width = 100 }
};
CheckedListBox clbMotores = new CheckedListBox()
{
Name = "clb" + _Nome,
Location = new System.Drawing.Point() { X = 135, Y = 45 },
Size = new System.Drawing.Size() { Height = 205, Width = 100 }
};
if (SerialService.DispositivosMotores.Contains(Dispositivo))
{
clbMotores.Items.Clear();
clbMotores.Items.AddRange(((MovimentacaoModel)Dados).Motores.Select(x => x.ID).ToArray());
}
clbMotores.ItemCheck += clbMotores_ItemCheck;
Label lblEnvio = new Label()
{
Name = "lbl" + _Nome + "Env",
Text = "Enviar dados",
Location = new System.Drawing.Point() { X = 255, Y = 27 },
Size = new System.Drawing.Size() { Height = 17, Width = 75 }
};
txtEnvios = new TextBox()
{
Name = "txt" + _Nome,
Text = "",
Location = new System.Drawing.Point() { X = 255, Y = 47 },
Size = new System.Drawing.Size() { Height = 24, Width = 215 },
ReadOnly = true
};
txtEnvios.KeyDown += txtEnvios_KeyDown;
Button btnLimpar = new Button()
{
Name = "btn" + _Nome + "Lim",
Text = "Limpar",
Location = new System.Drawing.Point() { X = 480, Y = 47 },
Size = new System.Drawing.Size() { Height = 24, Width = 70 },
};
btnLimpar.Click += btnLimpar_Click;
Label lblRecebidos = new Label()
{
Name = "lbl" + _Nome + "Rec",
Text = "Dados recebidos",
Location = new System.Drawing.Point() { X = 255, Y = 74 },
Size = new System.Drawing.Size() { Height = 17, Width = 100 }
};
txaConsole = new RichTextBox()
{
Name = "txa" + _Nome,
Text = "",
Location = new System.Drawing.Point() { X = 255, Y = 94 },
Size = new System.Drawing.Size() { Height = 141, Width = 300 },
ReadOnly = true
};
gpbItem.Controls.Add(lblPorta);
gpbItem.Controls.Add(cmbPorta);
gpbItem.Controls.Add(lblBaudRate);
gpbItem.Controls.Add(cmbBaudRate);
gpbItem.Controls.Add(lblAmostragem);
gpbItem.Controls.Add(nudAmostragem);
gpbItem.Controls.Add(lblMotores);
gpbItem.Controls.Add(clbMotores);
gpbItem.Controls.Add(btnAtualizar);
gpbItem.Controls.Add(btnConectar);
gpbItem.Controls.Add(lblStatus);
gpbItem.Controls.Add(lblEnvio);
gpbItem.Controls.Add(txtEnvios);
gpbItem.Controls.Add(btnLimpar);
gpbItem.Controls.Add(lblRecebidos);
gpbItem.Controls.Add(txaConsole);
return gpbItem;
}
private void clbMotores_ItemCheck(object sender, ItemCheckEventArgs e)
{
((CheckedListBox)sender).ItemCheck -= clbMotores_ItemCheck;
((CheckedListBox)sender).SetItemCheckState(e.Index, e.NewValue);
((CheckedListBox)sender).ItemCheck += clbMotores_ItemCheck;
switch (Dispositivo)
{
case T_Code.Mov:
((MovimentacaoModel)Dados).Motores.ForEach(x => x.Conectado = false);
foreach (var Item in ((CheckedListBox)sender).CheckedItems)
{
((MovimentacaoModel)Dados).Motores.First(x => x.ID == Item.ToString()).Conectado = true;
}
break;
}
frmInstancial.frmPrincipal.lblStripErro.Text = Dados.ProtocoloConfiguracao(true);
}
private void nudAmostragem_ValueChanged(object sender, EventArgs e)
{
Dados.SetTaxaAmostragem((Convert.ToInt32(((NumericUpDown)sender).Value)));
}
private void btnLimpar_Click(object sender, EventArgs e)
{
txaConsole.Text = "";
}
private void txtEnvios_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter && txtEnvios.Text != "")
{
EnviarDadosSerial(txtEnvios.Text);
txtEnvios.Text = "";
txtEnvios.Focus();
}
}
public void AtualizaIndex(int index)
{
_index = index;
gpbItem.Location = new System.Drawing.Point() { X = gpbItem.Location.X, Y = (220 + (_index * 210)) };
}
private void _Porta_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
string Recebido = _Porta.ReadLine();
if (Dispositivo == T_Code.Vzo)
{
Dispositivo = (T_Code)(int.Parse(Recebido.Substring(0, 3)));
lblStatus.Invoke((Action)(() => lblStatus.Text = StatusPorta() + " - " + Enum.GetName(typeof(T_Code), Dispositivo)));
}
DadosRecebidos.Add("< " + DateTime.Now.ToString("HH:mm:ss:fff") + " - " + Recebido);
AtualizarConsole(DadosRecebidos[DadosRecebidos.Count - 1]);
if (Recebido[0].ToString() == SerialService.BeginSensor && Dados != default(DispositivosBaseModel))
{
switch (Dispositivo)
{
case T_Code.Mov:
Dados.RecebeProtocoloSerial(Recebido);
Dados.AtualizaGridSensoriamento();
break;
}
}
}
private void btnConectar_Click(object sender, EventArgs e)
{
string ProtocoloConfiguracao = "";
if (_Porta.IsOpen)
{
ProtocoloConfiguracao = Dados.ProtocoloConfiguracao(false);
if (ProtocoloConfiguracao != "")
{
EnviarDadosSerial(ProtocoloConfiguracao);
}
if (DesconectarPortaSerial())
{
cmbPorta.Enabled = true;
cmbBaudRate.Enabled = true;
btnAtualizar.Enabled = true;
txtEnvios.ReadOnly = true;
txtEnvios.Text = "";
btnConectar.Text = "Conectar";
}
}
else
{
if (ConectarPortaSerial())
{
ProtocoloConfiguracao = Dados.ProtocoloConfiguracao(true);
if (ProtocoloConfiguracao != "")
{
EnviarDadosSerial(ProtocoloConfiguracao);
}
cmbPorta.Enabled = false;
cmbBaudRate.Enabled = false;
btnAtualizar.Enabled = false;
txtEnvios.ReadOnly = false;
txtEnvios.Focus();
btnConectar.Text = "Desconectar";
}
}
}
private void btnAtualizar_Click(object sender, EventArgs e)
{
AtualizarPortas();
}
delegate void AtualizarConsoleDelegate(string Texto);
private void AtualizarConsole(string Texto)
{
Texto += Environment.NewLine;
if (txaConsole.InvokeRequired)
{
txaConsole.Invoke(new AtualizarConsoleDelegate(AtualizarConsole), Texto);
}
else
{
txaConsole.Text += Texto;
}
}
}
}

View File

@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static AgroBase.Models.Enuns;
namespace AgroBase.Services
{
public class SerialService
{
public static string EndLine = "$";
public static string BeginSensor = "#";
public static List<T_Code> DispositivosMotores = new List<T_Code>() { T_Code.Mov, T_Code.Dir };
public class DispositivoDetalhesModel
{
public string PortaCOM { get; set; }
public T_Code Dispositivo { get; set; }
}
public static List<DispositivoDetalhesModel> DispositivosConectados = new List<DispositivoDetalhesModel>();
public static void AtualizarDispositivos()
{
var Portas = SerialPort.GetPortNames();
var PortasNaoMapeadas = Portas.Where(x => !DispositivosConectados.Select(y => y.PortaCOM).Contains(x)).ToList();
for (int i = 0; i < PortasNaoMapeadas.Count(); i++)
{
string PortaCom = PortasNaoMapeadas[i].ToString();
SerialPort _Porta = new SerialPort() { PortName = PortaCom, BaudRate = 115200 };
_Porta.DataReceived += _Porta_DataReceived;
string CodigoTest = ((int)F_Code.Chk).ToString() + "check";
try
{
_Porta.Open();
_Porta.Write(CodigoTest);
}
catch (Exception ex)
{
}
}
var DispositivosRemovidos = DispositivosConectados.Where(x => !Portas.Contains(x.PortaCOM)).ToList();
foreach (var Dispositivo in DispositivosRemovidos)
{
DispositivosConectados.Remove(Dispositivo);
}
}
private static void _Porta_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
var Porta = ((SerialPort)sender);
string Recebido = Porta.ReadLine();
if (Recebido.Length > 2)
{
int code = 0;
int.TryParse(Recebido.Substring(0, 3), out code);
if (code == 0)
{
return;
}
T_Code Dispositivo = (T_Code)(int.Parse(Recebido.Substring(0, 3)));
DispositivosConectados.Add(new DispositivoDetalhesModel()
{
PortaCOM = Porta.PortName,
Dispositivo = Dispositivo
});
Porta.Close();
}
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@ -0,0 +1 @@
40b85b555fb13fca6b2ce43b2b7651dd44597212

View File

@ -0,0 +1,13 @@
C:\Agro\AgroBase\AgroBase\bin\Debug\AgroBase.exe.config
C:\Agro\AgroBase\AgroBase\bin\Debug\AgroBase.exe
C:\Agro\AgroBase\AgroBase\bin\Debug\AgroBase.pdb
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.csproj.AssemblyReference.cache
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.Properties.Resources.resources
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.csproj.GenerateResource.cache
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.csproj.CoreCompileInputs.cache
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.exe
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.pdb
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.Forms.frmJoystick.resources
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.frmPrincipal.resources
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.Forms.frmInstancial.resources
C:\Agro\AgroBase\AgroBase\obj\Debug\AgroBase.Forms.frmDiagnosticos.resources

Binary file not shown.

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Runtime" version="4.3.1" targetFramework="net472" />
</packages>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,31 @@
This Microsoft .NET Library may incorporate components from the projects listed
below. Microsoft licenses these components under the Microsoft .NET Library
software license terms. The original copyright notices and the licenses under
which Microsoft received such components are set forth below for informational
purposes only. Microsoft reserves all rights not expressly granted herein,
whether by implication, estoppel or otherwise.
1. .NET Core (https://github.com/dotnet/core/)
.NET Core
Copyright (c) .NET Foundation and Contributors
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,128 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT .NET LIBRARY
These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft
· updates,
· supplements,
· Internet-based services, and
· support services
for this software, unless other terms accompany those items. If so, those terms apply.
BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.
IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.
1. INSTALLATION AND USE RIGHTS.
a. Installation and Use. You may install and use any number of copies of the software to design, develop and test your programs.
b. Third Party Programs. The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.
2. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
a. DISTRIBUTABLE CODE. The software is comprised of Distributable Code. “Distributable Code” is code that you are permitted to distribute in programs you develop if you comply with the terms below.
i. Right to Use and Distribute.
· You may copy and distribute the object code form of the software.
· Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.
ii. Distribution Requirements. For any Distributable Code you distribute, you must
· add significant primary functionality to it in your programs;
· require distributors and external end users to agree to terms that protect it at least as much as this agreement;
· display your valid copyright notice on your programs; and
· indemnify, defend, and hold harmless Microsoft from any claims, including attorneys fees, related to the distribution or use of your programs.
iii. Distribution Restrictions. You may not
· alter any copyright, trademark or patent notice in the Distributable Code;
· use Microsofts trademarks in your programs names or in a way that suggests your programs come from or are endorsed by Microsoft;
· include Distributable Code in malicious, deceptive or unlawful programs; or
· modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that
· the code be disclosed or distributed in source code form; or
· others have the right to modify it.
3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not
· work around any technical limitations in the software;
· reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;
· publish the software for others to copy;
· rent, lease or lend the software;
· transfer the software or this agreement to any third party; or
· use the software for commercial software hosting services.
4. BACKUP COPY. You may make one backup copy of the software. You may use it only to reinstall the software.
5. DOCUMENTATION. Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.
6. EXPORT RESTRICTIONS. The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see www.microsoft.com/exporting.
7. SUPPORT SERVICES. Because this software is “as is,” we may not provide support services for it.
8. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.
9. APPLICABLE LAW.
a. United States. If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.
b. Outside the United States. If you acquired the software in any other country, the laws of that country apply.
10. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.
11. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED “AS-IS.” YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
FOR AUSTRALIA YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.
12. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
This limitation applies to
· anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and
· claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.
It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.
Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.
Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français.
EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Microsoft naccorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, dadéquation à un usage particulier et dabsence de contrefaçon sont exclues.
LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices.
Cette limitation concerne :
· tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et
· les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou dune autre faute dans la limite autorisée par la loi en vigueur.
Elle sapplique également, même si Microsoft connaissait ou devrait connaître léventualité dun tel dommage. Si votre pays nautorise pas lexclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou lexclusion ci-dessus ne sappliquera pas à votre égard.
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir dautres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas.

View File

View File

View File

View File

View File

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More