From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-19-2023 05:24 PM
uint32 mxfASCBRxSamplingRead ( HMXF_BUFFER buffer,
// allocate buffer
if (rc == MAXT_SUCCESS)
{
rc = mxfRxSamplingBufferAlloc(channel, (UInt64)rxBufferSize, out sampBuf, IntPtr.Zero);
if (rc == MAXT_ERROR_BUFFER_ALLOCATED)
rc = mxfRxSamplingBufferGet(channel, out sampBuf);
}
// Host allocation
if (rc == MAXT_SUCCESS)
{
try
{
rxBuffer = Marshal.AllocHGlobal((int)rxBufferSize);
}
catch (OutOfMemoryException)
{
rc = MAXT_ERROR_MEM;
}
}
// Read and display recv records (1000 times)
while ((rc == MAXT_SUCCESS) && (c < 1000))
{
rc = mxfASCBRxSamplingRead(sampBuf, MXF_RXSAMPLING_FLAG_DEFAULT, 0, rxBufferSize, out msgCount, out byteCount, rxBuffer);
if ((rc == MAXT_SUCCESS) && (msgCount != 0))
{
p = rxBuffer;
for (i = 0; i < (Int32)msgCount; i++)
{
rec = (MXF_ASCB_SAMPREC)Marshal.PtrToStructure(p, typeof(MXF_ASCB_SAMPREC));
/* Extract Data, Log and Display Here */
rc = mxfASCBNextSamplingRecordPtrGet(p, out p);
}
}
}
Solved! Go to Solution.
01-19-2023 05:32 PM
The vendor has the API documentation and the installation files available on their website, so clearly not protected by NDA. I am therefore attaching the DLL and the .net node to this post for anyone who wants to try to crack this nut.
01-20-2023 08:02 AM
Disclaimer: I have very little experience with C#
The documentation says the methode expects a void* https://www.maxt.com/mxf/group__group___rx_sampling.html#gad8126b455c79d5faf31f575f63a2e78a
I imagine you can create the target object and pass a pointer to it to the library.
Stackoverflow says it works like this https://stackoverflow.com/questions/17339928/c-sharp-how-to-convert-object-to-intptr-and-back
So in LabVIEW
mscorlib
Maybe you can work with that.
01-20-2023 12:38 PM
That looks great!
I'm having an issue making the System.Runtime.InteropServices constructor. When I select that assembly in the constructor, I get no public classes that can be created. Any ideas what is causing that? I'm running 32 bit LV for this project.
01-20-2023 01:03 PM
@ChrisLudwig wrote:
That looks great!
I'm having an issue making the System.Runtime.InteropServices constructor. When I select that assembly in the constructor, I get no public classes that can be created. Any ideas what is causing that? I'm running 32 bit LV for this project.
That's not the assembly. "mscorlib" is the assembly, "System.Runtime.InteropServices" is the namespace within that assembly.
01-23-2023 02:29 PM