diff --git a/CanMonitor/CanMonitor.sln b/CanMonitor/CanMonitor.sln index d4687c4..3bf6355 100644 --- a/CanMonitor/CanMonitor.sln +++ b/CanMonitor/CanMonitor.sln @@ -49,6 +49,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "can_null_win32", "..\libCan EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "can_nanomsg_win32", "..\libCanOpenSimple2\canfestivaldrivers\can_nanomsg_win32\can_nanomsg_win32.vc10.vcxproj", "{D9B806EB-CF03-4410-9678-5D2C5F470BA1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDOInjector", "PDOInjector\PDOInjector.csproj", "{5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug UNICODE|Any CPU = Debug UNICODE|Any CPU @@ -417,6 +419,30 @@ Global {D9B806EB-CF03-4410-9678-5D2C5F470BA1}.Release|Mixed Platforms.Build.0 = Release|Win32 {D9B806EB-CF03-4410-9678-5D2C5F470BA1}.Release|x86.ActiveCfg = Release|Win32 {D9B806EB-CF03-4410-9678-5D2C5F470BA1}.Release|x86.Build.0 = Release|Win32 + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug UNICODE|Any CPU.ActiveCfg = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug UNICODE|Any CPU.Build.0 = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug UNICODE|Mixed Platforms.ActiveCfg = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug UNICODE|Mixed Platforms.Build.0 = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug UNICODE|x86.ActiveCfg = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug UNICODE|x86.Build.0 = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug|x86.ActiveCfg = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Debug|x86.Build.0 = Debug|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release UNICODE|Any CPU.ActiveCfg = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release UNICODE|Any CPU.Build.0 = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release UNICODE|Mixed Platforms.ActiveCfg = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release UNICODE|Mixed Platforms.Build.0 = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release UNICODE|x86.ActiveCfg = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release UNICODE|x86.Build.0 = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release|Any CPU.Build.0 = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release|x86.ActiveCfg = Release|Any CPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -434,6 +460,7 @@ Global {16C74D91-F858-4A70-9641-9228D80A24C0} = {B9AE808B-52B4-48EC-B38D-C8EFB2C567C6} {D8A23079-A479-4E0E-9777-32EEF436549D} = {B9AE808B-52B4-48EC-B38D-C8EFB2C567C6} {D9B806EB-CF03-4410-9678-5D2C5F470BA1} = {B9AE808B-52B4-48EC-B38D-C8EFB2C567C6} + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621} = {99749F1B-19E6-4731-BA65-728BBEFF16E7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4E770007-ED1C-460D-ACFC-9DD702614DA7} diff --git a/CanMonitor/CanMonitor/autoload.txt b/CanMonitor/CanMonitor/autoload.txt index 1f5e543..d028c97 100644 --- a/CanMonitor/CanMonitor/autoload.txt +++ b/CanMonitor/CanMonitor/autoload.txt @@ -1,3 +1,4 @@ NMTPlugin.dll eeprom_plugin.dll SDOEditorPlugin.dll +PDOInjector.dll diff --git a/CanMonitor/PDOInjector/PDOForm.Designer.cs b/CanMonitor/PDOInjector/PDOForm.Designer.cs new file mode 100644 index 0000000..1f4b7cc --- /dev/null +++ b/CanMonitor/PDOInjector/PDOForm.Designer.cs @@ -0,0 +1,208 @@ +namespace PDOInjector +{ + partial class PDOForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pdoValue1 = new PDOValue(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.pdoValue2 = new PDOValue(); + this.pdoValue3 = new PDOValue(); + this.pdoValue4 = new PDOValue(); + this.SuspendLayout(); + // + // pdoValue1 + // + this.pdoValue1.Location = new System.Drawing.Point(44, 61); + this.pdoValue1.Name = "pdoValue1"; + this.pdoValue1.Size = new System.Drawing.Size(950, 54); + this.pdoValue1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(75, 41); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(37, 17); + this.label1.TabIndex = 1; + this.label1.Text = "COB"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(159, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(64, 17); + this.label2.TabIndex = 2; + this.label2.Text = "No bytes"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(267, 41); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(25, 17); + this.label3.TabIndex = 3; + this.label3.Text = "B0"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(344, 41); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(25, 17); + this.label4.TabIndex = 4; + this.label4.Text = "B1"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(422, 41); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(25, 17); + this.label5.TabIndex = 5; + this.label5.Text = "B2"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(496, 41); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(25, 17); + this.label6.TabIndex = 6; + this.label6.Text = "B3"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(568, 41); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(25, 17); + this.label7.TabIndex = 7; + this.label7.Text = "B4"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(635, 41); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(25, 17); + this.label8.TabIndex = 8; + this.label8.Text = "B5"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(707, 41); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(25, 17); + this.label9.TabIndex = 9; + this.label9.Text = "B6"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(783, 41); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(25, 17); + this.label10.TabIndex = 10; + this.label10.Text = "B7"; + // + // pdoValue2 + // + this.pdoValue2.Location = new System.Drawing.Point(44, 107); + this.pdoValue2.Name = "pdoValue2"; + this.pdoValue2.Size = new System.Drawing.Size(950, 54); + this.pdoValue2.TabIndex = 11; + // + // pdoValue3 + // + this.pdoValue3.Location = new System.Drawing.Point(44, 158); + this.pdoValue3.Name = "pdoValue3"; + this.pdoValue3.Size = new System.Drawing.Size(950, 54); + this.pdoValue3.TabIndex = 12; + // + // pdoValue4 + // + this.pdoValue4.Location = new System.Drawing.Point(44, 218); + this.pdoValue4.Name = "pdoValue4"; + this.pdoValue4.Size = new System.Drawing.Size(950, 54); + this.pdoValue4.TabIndex = 13; + // + // PDOForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1074, 450); + this.Controls.Add(this.pdoValue4); + this.Controls.Add(this.pdoValue3); + this.Controls.Add(this.pdoValue2); + this.Controls.Add(this.label10); + this.Controls.Add(this.label9); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.pdoValue1); + this.Name = "PDOForm"; + this.Text = "PDOForm"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private PDOValue pdoValue1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private PDOValue pdoValue2; + private PDOValue pdoValue3; + private PDOValue pdoValue4; + } +} \ No newline at end of file diff --git a/CanMonitor/PDOInjector/PDOForm.cs b/CanMonitor/PDOInjector/PDOForm.cs new file mode 100644 index 0000000..fe60eb3 --- /dev/null +++ b/CanMonitor/PDOInjector/PDOForm.cs @@ -0,0 +1,35 @@ +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 libCanopenSimple; + +namespace PDOInjector +{ + public partial class PDOForm : Form + { + libCanopenSimple.libCanopenSimple lco; + public PDOForm(libCanopenSimple.libCanopenSimple lco) + { + this.lco = lco; + + InitializeComponent(); + pdoValue1.sendpdo += PdoValue_sendpdo; + pdoValue2.sendpdo += PdoValue_sendpdo; + pdoValue3.sendpdo += PdoValue_sendpdo; + pdoValue4.sendpdo += PdoValue_sendpdo; + + } + + private void PdoValue_sendpdo(object sender, EventArgs e) + { + PDOValue p = (PDOValue)sender; + lco.writePDO(p.cob, p.data); + } + } +} diff --git a/CanMonitor/PDOInjector/PDOForm.resx b/CanMonitor/PDOInjector/PDOForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CanMonitor/PDOInjector/PDOForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CanMonitor/PDOInjector/PDOInjector.cs b/CanMonitor/PDOInjector/PDOInjector.cs new file mode 100644 index 0000000..366de81 --- /dev/null +++ b/CanMonitor/PDOInjector/PDOInjector.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using PDOInterface; +using libCanopenSimple; + +namespace PDOInjector +{ + public class PDOInjector : InterfaceService, IPDOParser + { + + PDOForm frm; + + public PDOInjector() + { + addverb("PDO Injector", "Tools", openform); + } + + public string decodesdo(int node, int index, int sub, byte[] payload) + { + return ""; + } + + public void registerPDOS() + { + + } + + public void openform(object sender, System.EventArgs e) + { + if(frm==null || frm.IsDisposed) + { + frm = new PDOForm(_lco); + } + frm.Show(); + } + } +} diff --git a/CanMonitor/PDOInjector/PDOInjector.csproj b/CanMonitor/PDOInjector/PDOInjector.csproj new file mode 100644 index 0000000..f7bca0c --- /dev/null +++ b/CanMonitor/PDOInjector/PDOInjector.csproj @@ -0,0 +1,80 @@ + + + + + Debug + AnyCPU + {5D2E0351-CFCF-4D32-8602-FC6CEB5F0621} + Library + Properties + PDOInjector + PDOInjector + v4.6.1 + 512 + true + + + true + full + false + ..\bin\Debug\plugins\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\Release\plugins\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + PDOForm.cs + + + UserControl + + + PDOValue.cs + + + + + + {2fb81add-258f-4135-a9b9-17e2aca2448e} + libCanopenSimple + + + {1f61b56a-0bdc-45f6-8954-cf2550775cbd} + PDOInterface + + + + + PDOForm.cs + + + PDOValue.cs + + + + \ No newline at end of file diff --git a/CanMonitor/PDOInjector/PDOValue.Designer.cs b/CanMonitor/PDOInjector/PDOValue.Designer.cs new file mode 100644 index 0000000..632f355 --- /dev/null +++ b/CanMonitor/PDOInjector/PDOValue.Designer.cs @@ -0,0 +1,257 @@ +namespace PDOInjector +{ + partial class PDOValue + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.numericUpDown_byte7 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown_byte6 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown_byte5 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown_byte4 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown_byte3 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown_byte2 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown_byte1 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown_bytes = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown_cob = new System.Windows.Forms.NumericUpDown(); + this.button_send = new System.Windows.Forms.Button(); + this.numericUpDown_byte8 = new System.Windows.Forms.NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_bytes)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_cob)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte8)).BeginInit(); + this.SuspendLayout(); + // + // numericUpDown_byte7 + // + this.numericUpDown_byte7.Enabled = false; + this.numericUpDown_byte7.Hexadecimal = true; + this.numericUpDown_byte7.Location = new System.Drawing.Point(657, 15); + this.numericUpDown_byte7.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numericUpDown_byte7.Name = "numericUpDown_byte7"; + this.numericUpDown_byte7.Size = new System.Drawing.Size(55, 22); + this.numericUpDown_byte7.TabIndex = 19; + // + // numericUpDown_byte6 + // + this.numericUpDown_byte6.Enabled = false; + this.numericUpDown_byte6.Hexadecimal = true; + this.numericUpDown_byte6.Location = new System.Drawing.Point(583, 15); + this.numericUpDown_byte6.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numericUpDown_byte6.Name = "numericUpDown_byte6"; + this.numericUpDown_byte6.Size = new System.Drawing.Size(55, 22); + this.numericUpDown_byte6.TabIndex = 18; + // + // numericUpDown_byte5 + // + this.numericUpDown_byte5.Enabled = false; + this.numericUpDown_byte5.Hexadecimal = true; + this.numericUpDown_byte5.Location = new System.Drawing.Point(511, 15); + this.numericUpDown_byte5.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numericUpDown_byte5.Name = "numericUpDown_byte5"; + this.numericUpDown_byte5.Size = new System.Drawing.Size(55, 22); + this.numericUpDown_byte5.TabIndex = 17; + // + // numericUpDown_byte4 + // + this.numericUpDown_byte4.Enabled = false; + this.numericUpDown_byte4.Hexadecimal = true; + this.numericUpDown_byte4.Location = new System.Drawing.Point(441, 15); + this.numericUpDown_byte4.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numericUpDown_byte4.Name = "numericUpDown_byte4"; + this.numericUpDown_byte4.Size = new System.Drawing.Size(55, 22); + this.numericUpDown_byte4.TabIndex = 16; + // + // numericUpDown_byte3 + // + this.numericUpDown_byte3.Enabled = false; + this.numericUpDown_byte3.Hexadecimal = true; + this.numericUpDown_byte3.Location = new System.Drawing.Point(369, 15); + this.numericUpDown_byte3.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numericUpDown_byte3.Name = "numericUpDown_byte3"; + this.numericUpDown_byte3.Size = new System.Drawing.Size(55, 22); + this.numericUpDown_byte3.TabIndex = 15; + // + // numericUpDown_byte2 + // + this.numericUpDown_byte2.Enabled = false; + this.numericUpDown_byte2.Hexadecimal = true; + this.numericUpDown_byte2.Location = new System.Drawing.Point(291, 15); + this.numericUpDown_byte2.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numericUpDown_byte2.Name = "numericUpDown_byte2"; + this.numericUpDown_byte2.Size = new System.Drawing.Size(55, 22); + this.numericUpDown_byte2.TabIndex = 14; + // + // numericUpDown_byte1 + // + this.numericUpDown_byte1.Enabled = false; + this.numericUpDown_byte1.Hexadecimal = true; + this.numericUpDown_byte1.Location = new System.Drawing.Point(215, 15); + this.numericUpDown_byte1.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numericUpDown_byte1.Name = "numericUpDown_byte1"; + this.numericUpDown_byte1.Size = new System.Drawing.Size(55, 22); + this.numericUpDown_byte1.TabIndex = 13; + // + // numericUpDown_bytes + // + this.numericUpDown_bytes.Location = new System.Drawing.Point(124, 15); + this.numericUpDown_bytes.Maximum = new decimal(new int[] { + 8, + 0, + 0, + 0}); + this.numericUpDown_bytes.Name = "numericUpDown_bytes"; + this.numericUpDown_bytes.Size = new System.Drawing.Size(60, 22); + this.numericUpDown_bytes.TabIndex = 12; + this.numericUpDown_bytes.ValueChanged += new System.EventHandler(this.numericUpDown_bytes_ValueChanged); + // + // numericUpDown_cob + // + this.numericUpDown_cob.Hexadecimal = true; + this.numericUpDown_cob.Location = new System.Drawing.Point(12, 15); + this.numericUpDown_cob.Maximum = new decimal(new int[] { + 1407, + 0, + 0, + 0}); + this.numericUpDown_cob.Minimum = new decimal(new int[] { + 384, + 0, + 0, + 0}); + this.numericUpDown_cob.Name = "numericUpDown_cob"; + this.numericUpDown_cob.Size = new System.Drawing.Size(94, 22); + this.numericUpDown_cob.TabIndex = 11; + this.numericUpDown_cob.Value = new decimal(new int[] { + 384, + 0, + 0, + 0}); + // + // button_send + // + this.button_send.Location = new System.Drawing.Point(817, 8); + this.button_send.Name = "button_send"; + this.button_send.Size = new System.Drawing.Size(110, 35); + this.button_send.TabIndex = 10; + this.button_send.Text = "Send"; + this.button_send.UseVisualStyleBackColor = true; + this.button_send.Click += new System.EventHandler(this.button_send_Click); + // + // numericUpDown_byte8 + // + this.numericUpDown_byte8.Enabled = false; + this.numericUpDown_byte8.Hexadecimal = true; + this.numericUpDown_byte8.Location = new System.Drawing.Point(730, 15); + this.numericUpDown_byte8.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.numericUpDown_byte8.Name = "numericUpDown_byte8"; + this.numericUpDown_byte8.Size = new System.Drawing.Size(55, 22); + this.numericUpDown_byte8.TabIndex = 20; + // + // PDOValue + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.numericUpDown_byte8); + this.Controls.Add(this.numericUpDown_byte7); + this.Controls.Add(this.numericUpDown_byte6); + this.Controls.Add(this.numericUpDown_byte5); + this.Controls.Add(this.numericUpDown_byte4); + this.Controls.Add(this.numericUpDown_byte3); + this.Controls.Add(this.numericUpDown_byte2); + this.Controls.Add(this.numericUpDown_byte1); + this.Controls.Add(this.numericUpDown_bytes); + this.Controls.Add(this.numericUpDown_cob); + this.Controls.Add(this.button_send); + this.Name = "PDOValue"; + this.Size = new System.Drawing.Size(950, 54); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_bytes)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_cob)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_byte8)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.NumericUpDown numericUpDown_byte7; + private System.Windows.Forms.NumericUpDown numericUpDown_byte6; + private System.Windows.Forms.NumericUpDown numericUpDown_byte5; + private System.Windows.Forms.NumericUpDown numericUpDown_byte4; + private System.Windows.Forms.NumericUpDown numericUpDown_byte3; + private System.Windows.Forms.NumericUpDown numericUpDown_byte2; + private System.Windows.Forms.NumericUpDown numericUpDown_byte1; + private System.Windows.Forms.NumericUpDown numericUpDown_bytes; + private System.Windows.Forms.NumericUpDown numericUpDown_cob; + private System.Windows.Forms.Button button_send; + private System.Windows.Forms.NumericUpDown numericUpDown_byte8; + } +} diff --git a/CanMonitor/PDOInjector/PDOValue.cs b/CanMonitor/PDOInjector/PDOValue.cs new file mode 100644 index 0000000..d4b9bd9 --- /dev/null +++ b/CanMonitor/PDOInjector/PDOValue.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace PDOInjector +{ + public partial class PDOValue : UserControl + { + public UInt16 cob; + public byte len; + public byte[] data; + + public delegate void SendPDOEvent(object sender, EventArgs e); + public event SendPDOEvent sendpdo; + + public PDOValue() + { + InitializeComponent(); + + + } + + private void button_send_Click(object sender, EventArgs e) + { + len = (byte)numericUpDown_bytes.Value; + data = new byte[len]; + cob = (UInt16) numericUpDown_cob.Value; + + if(len > 0) + data[0] = (byte)numericUpDown_byte1.Value; + + if (len > 1) + data[1] = (byte)numericUpDown_byte2.Value; + + if (len > 2) + data[2] = (byte)numericUpDown_byte3.Value; + + if (len > 3) + data[3] = (byte)numericUpDown_byte4.Value; + + if (len > 4) + data[4] = (byte)numericUpDown_byte5.Value; + + if (len > 5) + data[5] = (byte)numericUpDown_byte6.Value; + + if (len > 6) + data[6] = (byte)numericUpDown_byte7.Value; + + if (len > 7) + data[7] = (byte)numericUpDown_byte8.Value; + + if(sendpdo != null) + { + sendpdo(this, new EventArgs()); + } + + } + + private void numericUpDown_bytes_ValueChanged(object sender, EventArgs e) + { + len = (byte)numericUpDown_bytes.Value; + + numericUpDown_byte1.Enabled = len > 0; + numericUpDown_byte2.Enabled = len > 1; + numericUpDown_byte3.Enabled = len > 2; + numericUpDown_byte4.Enabled = len > 3; + numericUpDown_byte5.Enabled = len > 4; + numericUpDown_byte6.Enabled = len > 5; + numericUpDown_byte7.Enabled = len > 6; + numericUpDown_byte8.Enabled = len > 7; + + + } + } +} diff --git a/CanMonitor/PDOInjector/PDOValue.resx b/CanMonitor/PDOInjector/PDOValue.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CanMonitor/PDOInjector/PDOValue.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CanMonitor/PDOInjector/Properties/AssemblyInfo.cs b/CanMonitor/PDOInjector/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c4e29b7 --- /dev/null +++ b/CanMonitor/PDOInjector/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("PDOInjector")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PDOInjector")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5d2e0351-cfcf-4d32-8602-fc6ceb5f0621")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]