Code: Select all
public class Ligacao
{
public Int16 num_units = 0;
public string ver_ptr;
public ushort ecode = 0;
public ushort ecode0 = 0;
public ushort ecode3 = 10;
public ushort rsp_size = new ushort();
public ulong[] rsp_data = new ulong[3];
[DllImport("RPPM3DDI.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void tkcmdsetDDI_init();
[ DllImport("RPPM3DDI.dll", CallingConvention=CallingConvention.Cdecl) ]
public static extern ushort tkcmdsetDDI_discover_pm3s(String product_name, ushort starting_address, ref Int16 num_units);
[ DllImport("RPPM3DDI.dll", CallingConvention=CallingConvention.Cdecl) ]
public static extern ushort tkcmdsetDDI_fw_version(ushort unit_address, ref string ver_ptr);
[ DllImport("RPPM3Csafe.dll", CallingConvention=CallingConvention.Cdecl) ]
public static extern ushort tkcmdsetCSAFE_command(ushort unit_address, ushort cmd_data_size, ulong[] cmd_data, ushort rsp_data_size, ulong[] rsp_data);
public Ligacao()
{
//
// TODO: Add constructor logic here
//
}
public short teste()
{
tkcmdsetDDI_init();
this.ecode = tkcmdsetDDI_discover_pm3s("Concept2 Performance Monitor 3 (PM3)", 0, ref num_units);
return num_units;
}
public string fw()
{
ushort ecode1 = 111;
ecode1 = tkcmdsetDDI_fw_version(0, ref ver_ptr);
if (ecode1 == 0)
{
return ver_ptr;
}
else
return ecode1.ToString();
}
}
But when i try sending a comand to the pm3 (any comand), instead of returnig 0 wich means there was no error, it returns the error 55382.
This happens always and i cant find the problem.
This is the class where i send the comand:
Code: Select all
public class Ligacao2
{
ushort ecode2 = 0;
Int16 num_units = 12;
public Ligacao2()
{
//
// TODO: Add constructor logic here
//
}
[ DllImport("RPPM3Csafe.dll", CallingConvention=CallingConvention.Cdecl) ]
public static extern ushort tkcmdsetCSAFE_command(ushort unit_address, ushort cmd_data_size, ulong[] cmd_data, ushort rsp_data_size, ulong[] rsp_data);
public ulong teste()
{
ushort rsp_size = new ushort();
ulong[] rsp_data = new ulong[1];
ulong[] cmd_data = {0x80};
ushort ecode3 = tkcmdsetCSAFE_command(0, 1, cmd_data, rsp_size, rsp_data);
if (ecode3 == 0)
{
return rsp_data[0];
}
else
return ecode3;
}
I´m probabily sending the comand the wrong way but i really dont know.