-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUSBTC08Imports.vb
130 lines (111 loc) · 3.86 KB
/
USBTC08Imports.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
'/**************************************************************************
'*
'* Filename: TC08Imports.cs
'*
'* Copyright: Pico Technology Limited 2011
'*
'* Author: CPY
'*
'* Description:
'* This file contains all the .NET wrapper calls needed to support
'* the console example. It also has the enums and structs required
'* by the (wrapped) function calls.
'*
'* History:
'* 23/05/2011 CPY Created
'*
'* Revision Info: "file %n date %f revision %v"
'* ""
'*
'***************************************************************************/
Imports System
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.IO
Namespace picotech
Public Class USBTC08API
#Region "Constants"
Private Const _DRIVER_FILENAME As String = "usbtc08.dll"
Public Const MAX_INFO_CHARS As Short = 256
Public ReadOnly TC_Type As String() = {"X", "B", "E", "J", "K", "N", "R", "S", "T"}
Public Const MAX_CHANNELS As Integer = 8
Public Const TC_TYPE_K As Char = "K"
Public Const PICO_OK As Integer = 1
#End Region
#Region "Driver enums"
Public Enum TempUnit As Short
CENTIGRADE
FAHRENHEIT
KELVIN
RANKINE
End Enum
#End Region
#Region "Structs"
Public Structure UnitInfo
Public size As Short
Public DriverVersion As Short
Public PicoppVersion As Short
Public HardwareVersion As Short
Public picoVar As Short
Public szSerial As String
Public szCalDate As String
End Structure
#End Region
#Region "Driver Imports"
#Region "Callback delegates"
#End Region
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_open_unit")>
Public Shared Function OpenUnit() As Short
'
End Function
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_close_unit")>
Public Shared Function CloseUnit( _
ByVal handle As Short) As Short
'
End Function
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_run")>
Public Shared Function Run( _
ByVal handle As Short, _
interval As Integer) As Short
'
End Function
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_stop")>
Public Shared Function StopUnit( _
ByVal handle As Short) As Short
'
End Function
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_get_last_error")>
Public Shared Function GetLastError( _
ByVal handle As Short) As Short
'
End Function
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_get_unit_info")>
Public Shared Function GetUnitInfo( _
ByVal handle As Short, _
ByRef unit_info As UnitInfo) As Short
'
End Function
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_get_formatted_info")>
Public Shared Function GetFormattedInfo( _
ByVal handle As Short, _
unit_info As StringBuilder, _
string_length As Short) As Short
'
End Function
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_set_channel")>
Public Shared Function SetChannel( _
ByVal handle As Short, _
ByVal channel As Short, _
ByVal tc_type As Char) As Short
'
End Function
<DllImport(_DRIVER_FILENAME, EntryPoint:="usb_tc08_get_single")>
Public Shared Function GetSingle( _
ByVal handle As Short, _
ByVal temp As Single(), _
ByRef overflow_flags As Short, _
ByVal units As TempUnit) As Short
End Function
#End Region
End Class
End Namespace