B
Bill McCarthy
Hi Emilio,
Okay, I could get to that link. In reading the definition for the Diagnose
test, it seems that it is expecting you to send it 24 bytes. It receives 26
bytes but doesn't look like the method actually returns that. Still, I'd
allocate 26 bytes and maybe have a look at them afterwards to see if that
buffer is changed. I'm not sure what the password parameter is meant to be.
If you don't have a password, try replacing that with Nothing or ""
#Region "Diagnose"
'1) Wis_Disgnose
' Device test.
' Ex, PC test if the device is ready.
' <Transmitted Data>
'Packet Data Byte Value
'OPCode Packet[0] 1 0x30
'Device Id Packet[1..3] 3 0x00
'Reserved Packet[4..11] 8 Access code
'HEADER
'Data Length Packet[12..13] 2 0x0008
'Descriptor Packet[14..21] 8 0x00 DATA BODY
'Content --- 0 ---
'CHECKSUM Packet[22..23] 2 0xXX
' <Received Data>
'Packet Data Byte Value
'OPCode Packet[0] 1 0x30
'Device Id Packet[1..3] 3 0x00
'Reserved Packet[4..11] 8 0x00
'HEADER
'Data Length Packet[12..13] 2 0x000A
'Packet[14] 1 0x02
'(result length)
'Descriptor
'Packet[15..21] 7 0x00
'DATA BODY
'Content Packet[22..23] 2 0/-1
'(result)
'CHECKSUM Packet[24..25] 2 0xXX
' § CHECKSUM
' This value is calculated by summing the value of the first byte
(Packet[0]) to
' the value of 573rd
' byte (Packet[573]) and ‘mod’ by 256 x 256. This is to confirm the
' full packet be received correctly.
' extern int WINAPI Wis_Diagnose
' (unsigned char *pwd, SYSTEMDATA CurSystemData);
Private Declare Ansi Function Wis_Diagnose Lib "WisClinet.dll" (ByVal pwd
As String, ByVal CurSystemData As IntPtr) As Int32
Private Sub Diagnose()
Dim pwd As String = "secret"
Dim buf As IntPtr = Marshal.AllocHGlobal(26)
'OPCode Packet[0] 1 0x30
Marshal.WriteByte(buf, &H30)
'Data Length Packet[12..13] 2 0x0008
Marshal.WriteByte(buf, 13, &H8)
'checksum
Marshal.WriteByte(buf, 23, &H38)
Dim result As Int32 = Wis_Diagnose(pwd, buf)
Marshal.FreeHGlobal(buf)
MsgBox("result was :" & If(result = 0, "OK", "NG"))
End Sub
#End Region
emitojleyes said:Ok, this is THE link; i've uploaded the pdf to skydrive from MSN.com; it's
microsoft, so, it HAS to work... jeje
This is the link:
http://cid-72b8582b2be58e34.skydrive.live.com/self.aspx/Público/AdvancedDoor|_Spec|_02.pdf
Okay, I could get to that link. In reading the definition for the Diagnose
test, it seems that it is expecting you to send it 24 bytes. It receives 26
bytes but doesn't look like the method actually returns that. Still, I'd
allocate 26 bytes and maybe have a look at them afterwards to see if that
buffer is changed. I'm not sure what the password parameter is meant to be.
If you don't have a password, try replacing that with Nothing or ""
#Region "Diagnose"
'1) Wis_Disgnose
' Device test.
' Ex, PC test if the device is ready.
' <Transmitted Data>
'Packet Data Byte Value
'OPCode Packet[0] 1 0x30
'Device Id Packet[1..3] 3 0x00
'Reserved Packet[4..11] 8 Access code
'HEADER
'Data Length Packet[12..13] 2 0x0008
'Descriptor Packet[14..21] 8 0x00 DATA BODY
'Content --- 0 ---
'CHECKSUM Packet[22..23] 2 0xXX
' <Received Data>
'Packet Data Byte Value
'OPCode Packet[0] 1 0x30
'Device Id Packet[1..3] 3 0x00
'Reserved Packet[4..11] 8 0x00
'HEADER
'Data Length Packet[12..13] 2 0x000A
'Packet[14] 1 0x02
'(result length)
'Descriptor
'Packet[15..21] 7 0x00
'DATA BODY
'Content Packet[22..23] 2 0/-1
'(result)
'CHECKSUM Packet[24..25] 2 0xXX
' § CHECKSUM
' This value is calculated by summing the value of the first byte
(Packet[0]) to
' the value of 573rd
' byte (Packet[573]) and ‘mod’ by 256 x 256. This is to confirm the
' full packet be received correctly.
' extern int WINAPI Wis_Diagnose
' (unsigned char *pwd, SYSTEMDATA CurSystemData);
Private Declare Ansi Function Wis_Diagnose Lib "WisClinet.dll" (ByVal pwd
As String, ByVal CurSystemData As IntPtr) As Int32
Private Sub Diagnose()
Dim pwd As String = "secret"
Dim buf As IntPtr = Marshal.AllocHGlobal(26)
'OPCode Packet[0] 1 0x30
Marshal.WriteByte(buf, &H30)
'Data Length Packet[12..13] 2 0x0008
Marshal.WriteByte(buf, 13, &H8)
'checksum
Marshal.WriteByte(buf, 23, &H38)
Dim result As Int32 = Wis_Diagnose(pwd, buf)
Marshal.FreeHGlobal(buf)
MsgBox("result was :" & If(result = 0, "OK", "NG"))
End Sub
#End Region