473,511 Members | 15,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

char[4] data type in c for storing IPs - VB.NET equivalence

Hi everyone:
i read from the documentation of a dll that there is a struct that uses
char[4] for storing an IP address. How can it be? and how come i can get to
representate the same value in a string VB.NET data type, knowing that this
is its equivalence (for char4)?
Next is the data type definition
'''unsigned char[4]

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, SizeConst:=4)_

Public IP As String

Thanks very much for your help!
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
Aug 12 '08 #1
20 2787
'unsigned char' is Byte in VB.
As an example, the equivalent to the following C++:
unsigned char test[4];
is:
Dim test(3) As Byte
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
VB & C# to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI
"emitojleyes" wrote:
Hi everyone:
i read from the documentation of a dll that there is a struct that uses
char[4] for storing an IP address. How can it be? and how come i can get to
representate the same value in a string VB.NET data type, knowing that this
is its equivalence (for char4)?
Next is the data type definition
'''unsigned char[4]

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, SizeConst:=4)_

Public IP As String

Thanks very much for your help!
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
Aug 13 '08 #2
Hi david, and thanks very muuch for your reply.
What i worte in vb.net, actually i didn't do it. I used an application
avaiable in
http://blogs.msdn.com/vbteam/archive...voke-easy.aspx,
that apparently helped me a lot, because, before this problem, i was getting
an error and couldn't find the solution.
Now, you say the data type must be byte... so, what value should i write for
the following ip address, for example: 192.168.010.008?
I tried replacing string for byte in:
<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, SizeConst:=4)>, but i got an error...
How can i continue? Thanks again david.
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
"David Anton" wrote:
'unsigned char' is Byte in VB.
As an example, the equivalent to the following C++:
unsigned char test[4];
is:
Dim test(3) As Byte
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
VB & C# to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI
"emitojleyes" wrote:
Hi everyone:
i read from the documentation of a dll that there is a struct that uses
char[4] for storing an IP address. How can it be? and how come i can get to
representate the same value in a string VB.NET data type, knowing that this
is its equivalence (for char4)?
Next is the data type definition
'''unsigned char[4]
<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, SizeConst:=4)_

Public IP As String

Thanks very much for your help!
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
Aug 13 '08 #3
emitojleyes wrote:
Hi david, and thanks very muuch for your reply.
What i worte in vb.net, actually i didn't do it. I used an application
avaiable in
http://blogs.msdn.com/vbteam/archive...voke-easy.aspx,
that apparently helped me a lot, because, before this problem, i was getting
an error and couldn't find the solution.
Now, you say the data type must be byte... so, what value should i write for
the following ip address, for example: 192.168.010.008?
New Byte() { 192, 168, 10, 8 }
I tried replacing string for byte in:
<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, SizeConst:=4)>, but i got an error...
How can i continue? Thanks again david.
You want a byte array with the size 4, so it should be something like:

<MarshalAsAttribute(UnmanagedType.LPArray, SizeConst:=4,
ArraySubType:=UnmanagedType.U1>

--
Göran Andersson
_____
http://www.guffa.com
Aug 13 '08 #4
"Göran Andersson" <gu***@guffa.comschrieb:
>Hi david, and thanks very muuch for your reply.
What i worte in vb.net, actually i didn't do it. I used an application
avaiable in
http://blogs.msdn.com/vbteam/archive...voke-easy.aspx,
that apparently helped me a lot, because, before this problem, i was
getting an error and couldn't find the solution.
Now, you say the data type must be byte... so, what value should i write
for the following ip address, for example: 192.168.010.008?

New Byte() { 192, 168, 10, 8 }
>I tried replacing string for byte in:
<System.Runtime.InteropServices.MarshalAsAttribut e(System.Runtime.InteropServices.UnmanagedType.ByV alTStr,
SizeConst:=4)>, but i got an error...
How can i continue? Thanks again david.

You want a byte array with the size 4, so it should be something like:

<MarshalAsAttribute(UnmanagedType.LPArray, SizeConst:=4,
ArraySubType:=UnmanagedType.U1>
Maybe 'ByValArray' is more suitable as 'LPArray' is not used to store the
array elements inside the structure.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 13 '08 #5
Thanks very much for the suggestions!
I'll be trying it tomorrow, and let you know, so, PLEASE don't lose track of
this thread.
Thanks again!

--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
Aug 13 '08 #6
As an alternative, I would suggest using an Int32 as that gives you the four
bytes. You can also use a struct or do explicit layout so as you have a
union of an Int32 and four bytes, e.g:
Structure IPAddress
Public a As Byte
Public b As Byte
Public c As Byte
Public d As Byte
End Structure
Or:

<StructLayout(LayoutKind.Explicit)_
Structure IPAddress
<FieldOffset(0)Public a As Byte
<FieldOffset(1)Public b As Byte
<FieldOffset(2)Public c As Byte
<FieldOffset(3)Public d As Byte

<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


"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:73**********************************@microsof t.com...
Thanks very much for the suggestions!
I'll be trying it tomorrow, and let you know, so, PLEASE don't lose track
of
this thread.
Thanks again!

--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
Aug 14 '08 #7
Hi everyone:
The problem is still there... i cannot solve it.
Goran, i have used the data type you suggest me:
<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lArray, SizeConst:=4)_
Public IP As Byte()
and assigned the values:
.IP = New Byte() {192, 168, 10, 8}
But it didn't work.
And still didn't try what bill told me to do, because i don't understand
much how to do it...
As this issue is beating me, i have taken extremes measures. Below are the
links to download the dlls flies, the advanced spectifications document, and
the user manual, i will really appreciate you look the technical specs doc,
becaouse maybe i'm having a mistake in other issue that you could notice
better than me.

Also i tried as Herfried told me:

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lArray,
SizeConst:=4, ArraySubType:=System.Runtime.InteropServices.Unman agedType.U1)>
_
Public IP As Byte()
but didn't work either.
Advanced Specifications document:
http://www.fundesnoa.org.ar/wison/Ad...or_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

Thanks very much in advance, for any comments about this issue.
Best regards,
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
Aug 14 '08 #8
Hi emitojleyes,

Define the structure as I showed (either one), e.g:
<StructLayout(LayoutKind.Explicit)_
Structure IPAddress
<FieldOffset(0)Public a As Byte
<FieldOffset(1)Public b As Byte
<FieldOffset(2)Public c As Byte
<FieldOffset(3)Public d As Byte

<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
Then declare the field or parameter as Byval ip As IPAddress


"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:1E**********************************@microsof t.com...
Hi everyone:
The problem is still there... i cannot solve it.
Goran, i have used the data type you suggest me:
<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lArray,
SizeConst:=4)_
Public IP As Byte()
and assigned the values:
.IP = New Byte() {192, 168, 10, 8}
But it didn't work.
And still didn't try what bill told me to do, because i don't understand
much how to do it...
As this issue is beating me, i have taken extremes measures. Below are the
links to download the dlls flies, the advanced spectifications document,
and
the user manual, i will really appreciate you look the technical specs
doc,
becaouse maybe i'm having a mistake in other issue that you could notice
better than me.

Also i tried as Herfried told me:

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lArray,
SizeConst:=4,
ArraySubType:=System.Runtime.InteropServices.Unman agedType.U1)>
_
Public IP As Byte()
but didn't work either.
Advanced Specifications document:
http://www.fundesnoa.org.ar/wison/Ad...or_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

Thanks very much in advance, for any comments about this issue.
Best regards,
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina

Aug 14 '08 #9

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.StructLayoutAttrib ute(System.Runtime.InteropServices.LayoutKind.Sequ ential,
CharSet:=System.Runtime.InteropServices.CharSet.[Ansi])_
Public Structure SYSTEMDATA

'''unsigned char
Public Version As Byte
<System.Runtime.InteropServices.StructLayout(Syste m.Runtime.InteropServices.LayoutKind.Explicit)_
Structure IPAddress
<System.Runtime.InteropServices.FieldOffset(0)Publ ic a As Byte
<System.Runtime.InteropServices.FieldOffset(1)Publ ic b As Byte
<System.Runtime.InteropServices.FieldOffset(2)Publ ic c As Byte
<System.Runtime.InteropServices.FieldOffset(3)Publ ic d As Byte
<System.Runtime.InteropServices.FieldOffset(0)Publ ic 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.Stru ct,
SizeConst:=4, ArraySubType:=System.Runtime.InteropServices.Unman agedType.U1)>
_
Public IP As IPAddress

'''unsigned char[4]

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, SizeConst:=4)_
Public NetMask As String

'''unsigned char[4]

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, SizeConst:=4)_
Public Gateway As String

'''unsigned char
Public BaudRate As Byte

'''unsigned char[3]

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lArray, 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.ByVa lTStr, SizeConst:=12)_
Public ServerIP As String

'''unsigned char
Public IDLength As Byte

'''unsigned char[20]
'''

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, SizeConst:=20)_
Public Reserved As String

'''DOORDATA->_DOORDATA
Public DoorData As DOORDATA

'''unsigned char[16]

<System.Runtime.InteropServices.MarshalAsAttribute (System.Runtime.InteropServices.UnmanagedType.ByVa lTStr, 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.ByVa lTStr, SizeConst:=7)_
Public Reserved1 As String
End Structure
<System.Runtime.InteropServices.StructLayoutAttrib ute(System.Runtime.InteropServices.LayoutKind.Sequ ential,
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.ByVa lTStr, 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/Ad...or_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
Aug 15 '08 #10
Hi Emilio,

This is roughly what I meant. You'll need to check which are IP addresses and which aren't:

Imports System.Runtime.InteropServices

Public Class Form1

<StructLayout(LayoutKind.Explicit)_

Structure IPAddress

<FieldOffset(0)Public a As Byte

<FieldOffset(1)Public b As Byte

<FieldOffset(2)Public c As Byte

<FieldOffset(3)Public d As Byte

<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



<StructLayoutAttribute(LayoutKind.Sequential, CharSet:=CharSet.[Ansi])_

Public Structure SYSTEMDATA

'''unsigned char

Public Version As Byte

'''unsigned char[4]

Public IP As IPAddress

'''unsigned char[4]

Public NetMask As IPAddress

'''unsigned char[4]

Public Gateway As IPAddress

'''unsigned char

Public BaudRate As Byte

'''unsigned char[3]

Public DeviceID As Int32

'''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]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=12)_

Public ServerIP As String

'''unsigned char

Public IDLength As Byte

'''unsigned char[20]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=20)_

Public Reserved As String

'''DOORDATA->_DOORDATA

Public DoorData As DOORDATA

'''unsigned char[16]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=16)_

Public DeviceName As String

'''unsigned char

Public HasDevice As Byte

'''unsigned char

Public ProtocolPswd As Byte

'''unsigned char[7]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=7)_

Public Reserved1 As String

End Structure

<StructLayoutAttribute(LayoutKind.Sequential, CharSet:=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]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=9)_

Public Reserved As String

End Structure


"emitojleyes" <em*********@discussions.microsoft.comwrote in message news:DA**********************************@microsof t.com...
Aug 17 '08 #11
Thanks very much for keeping up poasting in this thread; after this issue, if
i solve it, i'll dedicate to interop... hehe...
Yes, the data structure definition has another variables that store IP
address; so i'll define them as my new data structure IpAddress, as you
indicated me.
But, if you an see in page 8 of AdvancedDoor_Spec_02.pdf, in "transmitted
data", it only asks for DeviceId and "Reserved" (the password). So, in tHe
wis_diagnose function, the pwd parameter must be this "reserved" value. And i
only give the DeviceID and the IpAddress in the SystemData structure; i don't
think i have to enter values for all the variables (netmask, ipserver,
baudrate, voiceEn, etc.). That's how i am trying so far, and doesn't work...
Do u think i must assign values to all the systemdata members? No that i
think it, the big question is... the error is in the IP Address? Damn!
Thanks VERY MUCH for your help

--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
"Bill McCarthy" wrote:
Hi Emilio,

This is roughly what I meant. You'll need to check which are IP addresses
and which aren't:

Imports System.Runtime.InteropServices

Public Class Form1

<StructLayout(LayoutKind.Explicit)_

Structure IPAddress

<FieldOffset(0)Public a As Byte

<FieldOffset(1)Public b As Byte

<FieldOffset(2)Public c As Byte

<FieldOffset(3)Public d As Byte

<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



<StructLayoutAttribute(LayoutKind.Sequential, CharSet:=CharSet.[Ansi])>
_

Public Structure SYSTEMDATA

'''unsigned char

Public Version As Byte

'''unsigned char[4]

Public IP As IPAddress

'''unsigned char[4]

Public NetMask As IPAddress

'''unsigned char[4]

Public Gateway As IPAddress

'''unsigned char

Public BaudRate As Byte

'''unsigned char[3]

Public DeviceID As Int32

'''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]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=12)_

Public ServerIP As String

'''unsigned char

Public IDLength As Byte

'''unsigned char[20]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=20)_

Public Reserved As String

'''DOORDATA->_DOORDATA

Public DoorData As DOORDATA

'''unsigned char[16]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=16)_

Public DeviceName As String

'''unsigned char

Public HasDevice As Byte

'''unsigned char

Public ProtocolPswd As Byte

'''unsigned char[7]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=7)_

Public Reserved1 As String

End Structure

<StructLayoutAttribute(LayoutKind.Sequential, CharSet:=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]

<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=9)_

Public Reserved As String

End Structure


"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:DA**********************************@microsof t.com...
Aug 18 '08 #12
Hi emitojleyes,
But, if you an see in page 8 of AdvancedDoor_Spec_02.pdf, in "transmitted
data", it only asks for DeviceId and "Reserved" (the password)
That url you posted doesn't work from here, so I can't see the document. If
you have the C++ definition, please post it here. (or perhaps a different
URL)

Aug 18 '08 #13
I'm posting you this link to the documentation:
http://www.fundesnoa.org.ar/wison/wison.html
Anyway, i'll try to transalte the pdf so i can post the info in the forum...
thanks
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
"Bill McCarthy" wrote:
Hi emitojleyes,
But, if you an see in page 8 of AdvancedDoor_Spec_02.pdf, in "transmitted
data", it only asks for DeviceId and "Reserved" (the password)

That url you posted doesn't work from here, so I can't see the document. If
you have the C++ definition, please post it here. (or perhaps a different
URL)

Aug 18 '08 #14

"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:E1**********************************@microsof t.com...
I'm posting you this link to the documentation:
http://www.fundesnoa.org.ar/wison/wison.html

Can't reach that site from here for some reason.
Anyway, i'll try to transalte the pdf so i can post the info in the
forum...
thanks
--

Cool .

Aug 18 '08 #15
Hi
I think i made it! (putting the manual avaiable in the web, not making work
the device...)
The url is http://www.fundesnoa.org.ar/wison/ad...r_spec_02.html
There is all the document content; the taiwanese people who sells this
device told me that with this document is enough, and that many people could
do it... I hope all this issue is due to my ignorance, so i learn and the
problem is solved....
Thanks very much!
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
"Bill McCarthy" wrote:
>
"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:E1**********************************@microsof t.com...
I'm posting you this link to the documentation:
http://www.fundesnoa.org.ar/wison/wison.html


Can't reach that site from here for some reason.
Anyway, i'll try to transalte the pdf so i can post the info in the
forum...
thanks
--


Cool .

Aug 18 '08 #16

"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:1A**********************************@microsof t.com...
Hi
I think i made it! (putting the manual avaiable in the web, not making
work
the device...)
The url is http://www.fundesnoa.org.ar/wison/ad...r_spec_02.html

I still can't get to that site or any of http://www.fundesnoa.org.ar/

Google doesn't seem to have it cached either.

Aug 18 '08 #17
Ok, i think this will work... finally... hope so. This is another server.
http://www.albolocura.com.ar/wison/a...r_spec_02.html

--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
Aug 18 '08 #18

"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:9E**********************************@microsof t.com...
Ok, i think this will work... finally... hope so. This is another server.
http://www.albolocura.com.ar/wison/a...r_spec_02.html
That appears to be hosted by the same domain server and also can't be
reached from here :(

Aug 18 '08 #19
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...Spec%7C_02.pdf
--
Emilio Javier Leyes
Técnico Universitario en Informática
Sistema de Emergencias 911
Salta, Argentina
"Bill McCarthy" wrote:
>
"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:9E**********************************@microsof t.com...
Ok, i think this will work... finally... hope so. This is another server.
http://www.albolocura.com.ar/wison/a...r_spec_02.html

That appears to be hosted by the same domain server and also can't be
reached from here :(

Aug 18 '08 #20
Hi Emilio,

"emitojleyes" <em*********@discussions.microsoft.comwrote in message
news:3D**********************************@microsof t.com...
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...Spec%7C_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

Aug 19 '08 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2531
by: David Garamond | last post by:
Is it the 4+N (aka. same as VARCHAR(n)) or is it N? Sorry, it was 100% not clear for me after reading the docs, though the docs imply the first: "The storage requirement for data of these types is...
11
11845
by: aruna | last post by:
How is a character stored in a word aligned machine? Assuming on 64bit machine, 1 byte is reserved for a char, is it the case that only 1 byte is used to store the character and the rest 7 bytes...
7
5562
by: techno | last post by:
Dear all, Our bitmap has some x00 values ( '\0' ) and i am storing it in char* array. the problem is that the '\0' is treated as eos character in c and it is truncating it so the characters...
10
5304
by: fei.liu | last post by:
Consider the following sample code char * ptr = "hello"; char carray = "hello"; int main(void){ } What does the standard have to say about the storage requirement about ptr and carray? Is...
42
7336
by: sarathy | last post by:
Hi, I need clarification regarding signed characters in the C language. In C, char is 1 byte. So 1. Unsigned char - ASCII CHARACTER SET - EXTENDED CHARACTER SET
18
10386
by: planetzoom | last post by:
Given the following code: #include <stdio.h> int main(void) { char array = "What is your favorite car?"; void *vp = &array; printf("%s\n", vp);
6
4814
by: Ws | last post by:
Ok, so I have a question reguarding compilers and placing strings into the .rdata section of the PE. I was working on a program and couldn't figure out why I was getting a 0xc0000005 error...
11
2923
by: john | last post by:
Hi, at first the code doesn't seem to work. Any ideas?: #include <iostream> #include <cstdlib> int main() { using namespace std;
12
1753
by: s0suk3 | last post by:
I've seen a lot of functions in the standard library that deal with characters, but a lot them return/take parameters of type int (which is usually the integer that represents the character code in...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
445
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.