diff --git a/Simple_Raw_HID-Test/Program.cs b/Simple_Raw_HID-Test/Program.cs index 14f3c28..968169b 100644 --- a/Simple_Raw_HID-Test/Program.cs +++ b/Simple_Raw_HID-Test/Program.cs @@ -81,6 +81,7 @@ static int Main(string[] args) ConsoleKeyInfo cki = Console.ReadKey(true); if (cki.Key == ConsoleKey.Escape) { + srHID.Close(); return 0; } diff --git a/Simple_Raw_HID.vee b/Simple_Raw_HID.vee new file mode 100644 index 0000000..d26d618 --- /dev/null +++ b/Simple_Raw_HID.vee @@ -0,0 +1,482 @@ +(saveFormat "7.0") +(date "Fri 10/Feb/2017 11:11:54 ") +(veerev "9.32.17704.1") +(platform "PC") +(execMode v6) +(prefExecMode v9) +(filterNAN 0) +(workspaceStackingOrder M) +(sysconfig) +(SaveCF no) +(device 0 ROOTCONTEXT +(assemblyRefs +(assemblyRef 1 +(displayName +"mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") +(filename "C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\mscorlib.dll")) +(assemblyRef 2 +(displayName +"Simple_Raw_HID, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") +(desc "") +(filename +"C:\\Users\\Jan Henrik Sawatzki\\Documents\\GitHub\\Simple_Raw_HID\\Simple_Raw_HID\\bin\\Debug\\Simple_Raw_HID.dll" +)) +(selectedNamespaces "System,Simple_Raw_HID,")) +(properties +(variableName Main) +(variableScope glob) +(trigMode deg) +(nextID 22) +(popupTitleText "Untitled") +(popupMoveable 1)) +(deviceList +(device 0 DOTNETBUILDER +(properties +(name "Simple_Raw_HID.Simple_Raw_HID") +(variableScope cont) +(transactions 1 +"simple_Raw_HID = CreateInstance(\"Simple_Raw_HID\", \"Simple_Raw_HID.Simple_Raw_HID\")" +) +(parmInfo 4 "3" "F" "F" "T 0") +(memberInfos 1 "Void .ctor()") +(statics 1 "0") +(assemblyQualifiedName +"Simple_Raw_HID.Simple_Raw_HID, Simple_Raw_HID, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" +) +(objectName "simple_Raw_HID")) +(interface +(output 1 +(name "simple_Raw_HID") +(optional yes))) +(implementation)) +(device 1 DECLVAR +(properties +(name "Declare srHID") +(scope glob) +(globalName "srHID")) +(implementation +(value Object +(data ".NET OFF Simple_Raw_HID,Simple_Raw_HID.Simple_Raw_HID")))) +(device 2 TOGLOBAL +(properties +(name "Set srHID") +(variableScope cont) +(globalName "srHID")) +(interface +(input 1 +(name "Data") +(tag "Data") +(lock name)))) +(device 3 FROMGLOBAL +(properties +(name "Get srHID") +(variableScope cont) +(globalName "srHID")) +(interface +(output 1 +(name "Data") +(tag "Data") +(lock name constraints)))) +(device 4 DOTNETBUILDER +(properties +(name "Simple_Raw_HID.Simple_Raw_HID") +(variableScope cont) +(transactions 1 "return = simple_Raw_HID.Receive(0, ByRef buf, len, timeout)") +(parmInfo 6 "5" "F" "T 0" "T 0" "T 0" "T 0") +(memberInfos 1 "Int32 Receive(Int32, Byte[] ByRef, Int32, Int32)") +(statics 1 "0") +(assemblyQualifiedName +"Simple_Raw_HID.Simple_Raw_HID, Simple_Raw_HID, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" +) +(objectName "simple_Raw_HID")) +(interface +(input 1 +(name "simple_Raw_HID") +(optional yes)) +(input 2 +(name "buf") +(requires +(datatype UInt8) +(shape "Array 1D")) +(lock name constraints) +(optional yes)) +(input 3 +(name "len") +(requires +(datatype Int32) +(shape "Scalar")) +(lock name constraints) +(optional yes)) +(input 4 +(name "timeout") +(requires +(datatype Int32) +(shape "Scalar")) +(lock name constraints) +(optional yes)) +(output 1 +(name "buf") +(optional yes)) +(output 2 +(name "return") +(optional yes))) +(implementation)) +(device 5 DOTNETBUILDER +(properties +(name "Simple_Raw_HID.Simple_Raw_HID") +(variableScope cont) +(transactions 1 "return = simple_Raw_HID.Open(1, 5824, 1152, 65451, 512)") +(parmInfo 7 "6" "F" "F" "F" "F" "F" "T 0") +(memberInfos 1 "Int32 Open(Int32, Int32, Int32, Int32, Int32)") +(statics 1 "0") +(assemblyQualifiedName +"Simple_Raw_HID.Simple_Raw_HID, Simple_Raw_HID, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" +) +(objectName "simple_Raw_HID")) +(interface +(input 1 +(name "simple_Raw_HID") +(optional yes)) +(output 1 +(name "return") +(optional yes))) +(implementation)) +(device 6 FROMGLOBAL +(properties +(name "Get srHID") +(variableScope cont) +(globalName "srHID")) +(interface +(output 1 +(name "Data") +(tag "Data") +(lock name constraints)))) +(device 7 TEXTDISPLAY +(properties +(variableScope cont)) +(interface +(input 1 +(name "Data")))) +(device 8 DOTNETBUILDER +(properties +(name "Simple_Raw_HID.Simple_Raw_HID") +(variableScope cont) +(transactions 1 "simple_Raw_HID.Close()") +(parmInfo 1 "0") +(memberInfos 1 "Void Close()") +(statics 1 "0") +(assemblyQualifiedName +"Simple_Raw_HID.Simple_Raw_HID, Simple_Raw_HID, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" +) +(objectName "simple_Raw_HID")) +(interface +(input 1 +(name "simple_Raw_HID") +(optional yes))) +(implementation)) +(device 9 FROMGLOBAL +(properties +(name "Get srHID") +(variableScope cont) +(globalName "srHID")) +(interface +(output 1 +(name "Data") +(tag "Data") +(lock name constraints)))) +(device 11 ALLOCATEARRAY +(properties +(name "Alloc UInt8") +(variableScope cont)) +(interface +(output 1 +(name "Array") +(tag "Array"))) +(implementation +(numDims 1) +(dimSizes "64") +(type "UInt8") +(initEnum "Init Value") +(initialValue +(data 0)) +(from 1) +(thru 10))) +(device 13 FORMULA +(properties +(name "Result conversions") +(variableScope cont) +(expr 4 "A = asReal32(System.BitConverter.ToInt16(x, 4))/10.0;" +"temperature = asReal32(System.BitConverter.ToInt16(x, 4))/10.0;" "B = x[0];" +"C = x[1];")) +(interface +(input 1 +(name "x") +(requires +(datatype UInt8) +(shape "Array 1D")) +(optional yes)) +(output 1 +(name "temperature") +(optional yes)) +(output 2 +(name "sensorCount") +(optional yes)) +(output 3 +(name "sensorNum") +(optional yes)))) +(device 14 CONSTANT +(properties +(name "Int32") +(variableScope cont) +(enableEditing 1)) +(interface +(output 1 +(name "Int32") +(lock name constraints))) +(implementation +(value Int32 +(data 64)) +(initValue Int32 +(data 0)))) +(device 15 CONSTANT +(properties +(name "Int32") +(variableScope cont) +(enableEditing 1)) +(interface +(output 1 +(name "Int32") +(lock name constraints))) +(implementation +(value Int32 +(data 220)) +(initValue Int32 +(data 0)))) +(device 16 TEXTDISPLAY +(properties +(variableScope cont)) +(interface +(input 1 +(name "Data")))) +(device 17 TEXTDISPLAY +(properties +(variableScope cont)) +(interface +(input 1 +(name "Data")))) +(device 18 TEXTDISPLAY +(properties +(variableScope cont)) +(interface +(input 1 +(name "Data")))) +(device 19 TEXTDISPLAY +(properties +(variableScope cont)) +(interface +(input 1 +(name "Data")))) +(device 21 NOTE +(properties +(variableScope cont) +(text2 1 +"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Times New Roman;}}\r\n{\\colortbl ;\\red0\\green0\\blue0;}\r\n\\viewkind4\\uc1\\pard\\cf1\\f0\\fs24 Diesen Schritt hier in einer Loop oder im Programm an der gew\\\'fcnschten Stelle platzieren. Eventuell Timeout Wert erh\\\'f6hen.\\par\r\n}\r\n" +))) +(configuration +(connect D0:1 D2:1) +(connect D2:0 D3:0) +(connect D6:1 D4:1) +(connect D10:1 D4:2) +(connect D12:1 D4:3) +(connect D13:1 D4:4) +(connect D3:1 D5:1) +(connect D5:0 D6:0) +(connect D5:1 D7:1) +(connect D9:1 D8:1) +(connect D4:0 D9:0) +(connect D4:1 D11:1) +(connect D4:2 D14:1) +(connect D11:1 D15:1) +(connect D11:2 D16:1) +(connect D11:3 D17:1))) +(contextCarrier +(wndRestoredOrigin 2 2) +(wndRestoredExtent 702 386) +(wndState max) +(active detail) +(detail +(extent 1680 870) +(anchorPt 777 -160) +(configuration +(devCarrierFor 0 +(active open) +(icon) +(open +(extent 574 76)) +(terminals on) +(pinCenter 605 120)) +(devCarrierFor 1 +(active icon) +(icon +(extent 85 15)) +(open +(extent 348 124)) +(pinCenter 330 -30)) +(devCarrierFor 2 +(active open) +(icon +(extent 58 0)) +(open +(extent 73 51)) +(terminals on) +(pinCenter 1155 120)) +(devCarrierFor 3 +(active open) +(icon +(extent 59 0)) +(open +(extent 73 51)) +(terminals on) +(pinCenter 225 320)) +(devCarrierFor 4 +(active open) +(icon) +(open +(extent 364 86)) +(terminals on) +(pinCenter 685 570)) +(devCarrierFor 5 +(active open) +(icon) +(open +(extent 364 76)) +(terminals on) +(pinCenter 685 320)) +(devCarrierFor 6 +(active open) +(icon +(extent 59 0)) +(open +(extent 73 51)) +(terminals on) +(pinCenter 215 450)) +(devCarrierFor 7 +(active open) +(icon) +(open +(extent 121 22)) +(pinCenter 1150 320)) +(devCarrierFor 8 +(active open) +(icon) +(open +(extent 221 74)) +(terminals on) +(pinCenter 695 940)) +(devCarrierFor 9 +(active open) +(icon +(extent 59 0)) +(open +(extent 73 51)) +(terminals on) +(pinCenter 315 940)) +(devCarrierFor 11 +(active open) +(icon) +(open +(extent 194 121)) +(terminals on) +(pinCenter 155 570)) +(devCarrierFor 13 +(active open) +(icon +(extent 116 0)) +(open +(extent 204 82)) +(terminals on) +(pinCenter 1130 550)) +(devCarrierFor 14 +(active open) +(icon) +(open +(extent 67 29) +(showFormat int)) +(pinCenter 260 680)) +(devCarrierFor 15 +(active open) +(icon) +(open +(extent 67 29) +(showFormat int)) +(pinCenter 260 740)) +(devCarrierFor 16 +(active open) +(icon) +(open +(extent 121 22)) +(pinCenter 1060 640)) +(devCarrierFor 17 +(active open) +(icon) +(open +(extent 121 22)) +(pinCenter 1430 490)) +(devCarrierFor 18 +(active open) +(icon) +(open +(extent 121 22)) +(pinCenter 1430 550)) +(devCarrierFor 19 +(active open) +(icon) +(open +(extent 121 22)) +(pinCenter 1430 610)) +(devCarrierFor 21 +(active open) +(icon +(iconImage "notepad.icn")) +(open +(extent 410 180) +(editing enabled)) +(pinCenter -250 580)) +(connect D0:1 D2:1 +(points 2 1014 120 1076 120)) +(connect D2:0 D3:0 +(points 4 1150 148 1150 180 230 180 230 274)) +(connect D6:1 D4:1 +(points 4 294 450 310 450 310 540 380 540)) +(connect D10:1 D4:2 +(points 4 294 570 310 570 310 560 380 560)) +(connect D12:1 D4:3 +(points 4 296 680 320 680 320 580 380 580)) +(connect D13:1 D4:4 +(points 4 296 740 330 740 330 600 380 600)) +(connect D3:1 D5:1 +(points 2 304 320 380 320)) +(connect D5:0 D6:0 +(points 4 650 360 650 380 220 380 220 404)) +(connect D5:1 D7:1 +(points 2 919 320 1087 320)) +(connect D9:1 D8:1 +(points 2 394 940 462 940)) +(connect D4:0 D9:0 +(points 4 650 615 650 750 320 750 320 894)) +(connect D4:1 D11:1 +(points 2 919 550 995 550)) +(connect D4:2 D14:1 +(points 4 919 590 940 590 940 640 997 640)) +(connect D11:1 D15:1 +(points 4 1324 530 1340 530 1340 490 1367 490)) +(connect D11:2 D16:1 +(points 2 1324 550 1367 550)) +(connect D11:3 D17:1 +(points 4 1324 570 1340 570 1340 610 1367 610))) +(stackingOrder 0 1 2 3 5 4 6 10 12 13 7 11 14 15 16 17 8 9 18)) +(numberFormats +(realFormat standard) +(realSigDigits 4) +(realRadixSpec 4) +(integerBase decimal)))) diff --git a/Simple_Raw_HID/Simple_Raw_HID.cs b/Simple_Raw_HID/Simple_Raw_HID.cs index 5823bd3..ba01450 100644 --- a/Simple_Raw_HID/Simple_Raw_HID.cs +++ b/Simple_Raw_HID/Simple_Raw_HID.cs @@ -58,7 +58,7 @@ public class Simple_Raw_HID private static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); [StructLayout(LayoutKind.Sequential)] - public struct HIDD_ATTRIBUTES + private struct HIDD_ATTRIBUTES { public Int32 Size; public Int16 VendorID;