void CallStartupNPClientFunctions(TrackIRDll dll, IntPtr freePieWindowHandle, short data, short profileId) { Log("Calling dll with the following values - WindowHandle: " + freePieWindowHandle + " Data: " + data + " ProfileId: " + profileId); dll.GetSignature(); dll.QueryVersion(); dll.RegisterWindowHandle(freePieWindowHandle); dll.RequestData(data); dll.RegisterProgramProfileId(profileId); dll.StopCursor(); dll.StartDataTransmission(); }
TrackIRDll SetupRealTrackIRDll(string realDllPath, IntPtr freePieWindowHandle) { TrackIRDll dll = null; if (realDllPath != null) { Log("Loading trackir dll: " + realDllPath); dll = new TrackIRDll(realDllPath, Log); CallStartupNPClientFunctions(dll, freePieWindowHandle, Data, ProgramProfileId); } else { Log("Not loading trackir dll - not found"); } return(dll); }
protected override void DoExecute(IEnumerable <string> arguments) { var args = arguments.ToList(); doLog = args.Count == 3 && bool.Parse(args[2]); if (dll == null) { dll = SetupRealTrackIRDll(args[0], new IntPtr(long.Parse(args[1]))); } dll.GetPosition(headposeData); var data = (TrackIRHeadposeData)Marshal.PtrToStructure(headposeData, typeof(TrackIRHeadposeData)); WriteData(data); Thread.Sleep(1); }