I've tried what you Bill told me, but still doesn't work...
i think it's not a big problem to slve this issue, but i am a real beginner
at this, and don't know where else to continue looking for the solution.
That's why i put the links for downloading the documentation of this device.
I hope you take a look at them and understand the problem, and realise it's
not big deal... or is it?
Next, i'll put the source code of the windows form where it is the button
that TESTS the device. All the data definition was made automatically by this
program i mentioned before, with the exception of the last attemps i made,
modifying the IP member of systemdata, following Bill's advice.
I am really thankful for all the help i got from this forum, and hope to get
to solve it; without your help... it'd be really impossible for me.
---------------
Public Class Form1
<System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential,
CharSet:=System.Runtime.InteropServices.CharSet.[Ansi])> _
Public Structure SYSTEMDATA
'''unsigned char
Public Version As Byte
<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)> _
Structure IPAddress
<System.Runtime.InteropServices.FieldOffset(0)> Public a As Byte
<System.Runtime.InteropServices.FieldOffset(1)> Public b As Byte
<System.Runtime.InteropServices.FieldOffset(2)> Public c As Byte
<System.Runtime.InteropServices.FieldOffset(3)> Public d As Byte
<System.Runtime.InteropServices.FieldOffset(0)> Public value As
Int32
Public Overrides Function ToString() As String
Return String.Format("{0}.{1}.{2}.{3}", a, b, c, d)
End Function
End Structure
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Struct,
SizeConst:=4, ArraySubType:=System.Runtime.InteropServices.UnmanagedType.U1)>
_
Public IP As IPAddress
'''unsigned char[4]
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=4)> _
Public NetMask As String
'''unsigned char[4]
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=4)> _
Public Gateway As String
'''unsigned char
Public BaudRate As Byte
'''unsigned char[3]
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=3)> _
Public DeviceID As Byte()
'''unsigned short
Public UserNo As UShort
'''unsigned int
Public LogNo As UInteger
'''unsigned char
Public AuthenMode As Byte
'''unsigned char
Public UartMode As Byte
'''unsigned char
Public VoiceEN As Byte
'''unsigned char[12]
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=12)> _
Public ServerIP As String
'''unsigned char
Public IDLength As Byte
'''unsigned char[20]
'''
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=20)> _
Public Reserved As String
'''DOORDATA->_DOORDATA
Public DoorData As DOORDATA
'''unsigned char[16]
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=16)> _
Public DeviceName As String
'''unsigned char
Public HasDevice As Byte
'''unsigned char
Public ProtocolPswd As Byte
'''unsigned char[7]
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=7)> _
Public Reserved1 As String
End Structure
<System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential,
CharSet:=System.Runtime.InteropServices.CharSet.[Ansi])> _
Public Structure DOORDATA
'''unsigned short
Public DoorOpenSec As UShort
'''unsigned short
Public DoorOverSec As UShort
'''unsigned short
Public AlarmTime As UShort
'''unsigned char
Public AlarmEnable As Byte
'''unsigned char[9]
<System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=9)> _
Public Reserved As String
End Structure
Partial Public Class NativeMethods
'''Return Type: int
'''pwd: unsigned char*
'''CurSystemData: SYSTEMDATA->_SYSTEMDATA
<System.Runtime.InteropServices.DllImportAttribute("WisClient.dll",
EntryPoint:="Wis_Diagnose")> _
Public Shared Function Wis_Diagnose(ByVal pwd As System.IntPtr,
ByVal CurSystemData As SYSTEMDATA) As Integer
End Function
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim systemdata1 As New Form1.SYSTEMDATA
Dim doordata1 As New Form1.DOORDATA
Dim a As System.IntPtr
With systemdata1
.ProtocolPswd = "00000000"
.IP.a = 192
.IP.b = 168
.IP.c = 10
.IP.d = 8
.NetMask = "255.255.255.0"
.ServerIP = "192.168.10.4"
.Reserved = "00000000"
.Reserved1 = "00000000"
.DeviceID = New Byte() {0, 0, 0}
.Gateway = "192.168.10.1"
.IDLength = 3
.HasDevice = 3
.DoorData.Reserved = "00000000"
End With
a = "00000000"
MsgBox(NativeMethods.Wis_Diagnose(0, systemdata1))
End Sub
End Class
---------------
For those who want to see the documentation and download the DLL i cant make
work, the links are below.
Best regards,
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
Advanced Specifications document:
http://www.fundesnoa.org.ar/wison/AdvancedDoor_Spec_02.pdf
WisClient library DLL:
http://www.fundesnoa.org.ar/wison/WisClient.dll
WisServer library DLL:
http://www.fundesnoa.org.ar/wison/WisServer.dll
User Manual:
http://www.fundesnoa.org.ar/wison/DR168_Eng.pdf