Need Help On Win64 SDK C# Integration
Posted: May 15th, 2024, 2:46 am
Need help on the pm-connection-initialization problem encountered while using the msvc2022_64 SDK provided by Concept2 support. Upon integration with my C# application, which is designed to interface with a PM5 device connected via USB, the SDK returns an error code -10151.
The error is identified as "TKDDI_NOT_IMPLEMENTED_ERR" with the message "Feature not implemented." when calling the "tkcmdsetDDI_discover_pm3s". The behavior is consistent with an undetected PM5 device, despite it being properly connected.
My example code and .dll files are attached as follows. Please advise on any known resolutions or further steps to address this error.
The error is identified as "TKDDI_NOT_IMPLEMENTED_ERR" with the message "Feature not implemented." when calling the "tkcmdsetDDI_discover_pm3s". The behavior is consistent with an undetected PM5 device, despite it being properly connected.
My example code and .dll files are attached as follows. Please advise on any known resolutions or further steps to address this error.
Code: Select all
using System.Runtime.InteropServices;
if (PM3DDICPd.tkcmdsetDDI_init() == 0 && PM3CSAFECPd.tkcmdsetCSAFE_init_protocol() == 0)
{
const string PM5_PRODUCT_NAME = "Concept2 Performance Monitor 5 (PM5)";
ushort startingAddress = 0;
// errorCode = -10151
// errorName = TKDDI_NOT_IMPLEMENTED_ERR
// errorText = Feature not implemented
// numUnits = 0
short errorCode = PM3DDICPd.tkcmdsetDDI_discover_pm3s(PM5_PRODUCT_NAME, startingAddress, out ushort numUnits);
}
public static class PM3DDICPd
{
public static short tkcmdsetDDI_discover_pm3s(string productName, ushort startingAddress, out ushort numUnits)
{
IntPtr sbyteArray = Marshal.StringToHGlobalAnsi(productName);
short result = tkcmdsetDDI_discover_pm3s(sbyteArray, startingAddress, out numUnits);
Marshal.FreeHGlobal(sbyteArray);
return result;
}
[DllImport(nameof(PM3DDICPd), CallingConvention = CallingConvention.Cdecl)]
public static extern short tkcmdsetDDI_init();
[DllImport(nameof(PM3DDICPd), CallingConvention = CallingConvention.Cdecl)]
private static extern short tkcmdsetDDI_discover_pm3s([In] IntPtr sbyteArray, [In] ushort startingAddress, [Out] out ushort numUnits);
}
public static class PM3CSAFECPd
{
[DllImport(nameof(PM3CSAFECPd), CallingConvention = CallingConvention.Cdecl)]
public static extern short tkcmdsetCSAFE_init_protocol([In] ushort timeout = 100);
}