Hi all,
I have been working on a VB.net wrapper for the MachIPC.dll interface, and have made good progress by scouring the forum, reading the API help file, and a lot of trial and error, way more error than good trials

. My goal is interfacing a probing application of mine written in .Net to Mach4 thorough the IPC interface.
I have a decent amount of functionality working in a test app, except for a few problems I want to see if I can get some input or help on.
For starters on where I’m at with success: I can jog, read DRO positions, get probe position data and hit status from a G31, read the controller state, send MDI move commands, etc. That all worked relatively straight forwards without much hassle, and creating the wrapper functions was not much of an issue.
What is currently giving me issue is trying to get status of signals (such as probe input active or not), so I can display the equivalent of a status LED.
As I take it, first you have to poll Mach 4 to receive the signal’s current handle, then get the status of the signal using the handle in a second call.
My issue is I can’t get past the first call to get the handle, I get an error response of -28 (MERROR_IPC_NOT_READY).
For reference, my wrapper function definition is:
<DllImport("mach4ipc-x64.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Ansi)>
Public Shared Function mcSignalGetHandle(ByVal mInst As Integer, ByVal sigid As UInteger, <Out> ByRef handle As UInteger) As Integer
End Function
And function call is:
Dim sig As UInteger
err = CType(Signal.mcSignalGetHandle(0, 164, sig), mc.mcError)
The above assumes I’m trying to get the handle of signal #164 (which I’m hoping is the probe input, but I’m probably off a few…)
When my demo app loads, I do call mcIpcInit(127.0.0.1) , and get an error response of 0, so I’m definitely connecting and getting a good response from the MachIPC.dll initially, and many other functions work great even before I used mcIpcInit().
I’ve been struggling with the mcSignalGetHandle() long enough, time to ask for help. If anyone has any input on what I’m messing up to get the signal handles back, I would greatly appreciate the help and input. Or is it possible there is an issue on the M4/Lua side?
And a bit of other info, my testing is being done w/ Mach4 build 4612, I'm using the MachIPC-x64.dll, and compiling any cpu
thanks in advance for any input,
Eric