46 lines
1.8 KiB
Plaintext
46 lines
1.8 KiB
Plaintext
I have done a bit of interop mapping, here is the basic mappings.
|
|
|
|
[DllImport("Prodave6.dll",EntryPoint="LoadConnection_ex6",ExactSpelling=true,CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]
|
|
|
|
private static extern int LoadConnection_ex6(ushort ConNr,char[] pAccessPoint, int ConTableLen,byte[] ConTable);
|
|
|
|
[DllImport("Prodave6.dll",EntryPoint="UnloadConnection_ex6",ExactSpelling=true,CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]
|
|
|
|
private static extern int UnloadConnection_ex6(ushort ConNr);
|
|
|
|
[DllImport("Prodave6.dll",EntryPoint="SetActiveConnection_ex6",ExactSpelling=true,CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]
|
|
|
|
private static extern int SetActiveConnection_ex6(ushort ConNr);
|
|
|
|
[DllImport("Prodave6.dll",EntryPoint="db_read_ex6",ExactSpelling=true,CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]
|
|
|
|
private static extern int db_read_ex6(ushort no_of_db,byte datatype,ushort startaddr, ref uint read_request_length,uint bufferlength, byte[] buffer,ref uint returnlength);
|
|
|
|
[DllImport("Prodave6.dll",EntryPoint="db_write_ex6",ExactSpelling=true,CharSet=CharSet.Ansi,CallingConvention=CallingConvention.Cdecl)]
|
|
|
|
private static extern int db_write_ex6(ushort no_of_db,byte datatype,ushort startaddr, ref uint write_request_length,uint bufferlength, byte[] buffer);
|
|
|
|
|
|
//Connection creation
|
|
|
|
char[] pAccessPoint={'S','7','O','N','L','I','N','E'};
|
|
|
|
byte[] conn = new byte[] {10,140,132,6,0,0,2,3,0};
|
|
|
|
int length = (int)conn.Length;
|
|
|
|
res=LoadConnection_ex6((ushort)0, pAccessPoint,length,conn);
|
|
|
|
|
|
//Simple read operation - buffer is a byte array
|
|
|
|
int res = 0;
|
|
|
|
uint amount_to_read = (uint)buffer.Length;
|
|
|
|
try{
|
|
|
|
res = db_read_ex6(no_of_db,type,start_address_in_db,ref amount_to_read,(ushort)buffer.Length,buffer,ref realread);
|
|
|
|
}
|