private static void ThrowError(NISwitchExecutiveHandle handle, int code, string errorMessagePrefix = null) { int codeFromGetError; string errorString = GetError(handle, out codeFromGetError); throw new DriverException(errorString, code); }
public static NISwitchExecutiveHandle CreateFromCHandle(IntPtr handle, bool ownsHandle) { NISwitchExecutiveHandle switchHandle = new NISwitchExecutiveHandle(ownsHandle); switchHandle.SetHandle(handle); return(switchHandle); }
internal static bool HasErrorClearIfDoes(NISwitchExecutiveHandle handle, int status) { bool hasError = HasError(status); if (hasError) { ClearError(handle); } return(hasError); }
private static string GetError(NISwitchExecutiveHandle handle, out int errorCode) { int size = 0; niSE_GetError(handle, out errorCode, null, out size); var msg = new StringBuilder(); if (size > 0) { msg.Capacity = size; niSE_GetError(handle, out errorCode, msg, out size); } return(msg.ToString()); }
private static extern int niSE_OpenSession(string resourceName, string options, out NISwitchExecutiveHandle instrumentHandle);
private static extern int niSE_GetError(NISwitchExecutiveHandle vi, out int errorCode, StringBuilder errorDescription, out int errorDescriptionBufferSize);
private static extern int niSE_GetAllConnections(NISwitchExecutiveHandle vi, StringBuilder routeSpec, out int routeSpecSize);
private static extern int niSE_ExpandRouteSpec(NISwitchExecutiveHandle vi, string spec, ExpandOptions expandOptions, StringBuilder expandedRouteSpec, out int expandedRouteSpecSize);
private static extern int niSE_IsConnected(NISwitchExecutiveHandle vi, string spec, out ushort isConnected);
private static extern int niSE_ConnectAndDisconnect(NISwitchExecutiveHandle vi, string connectSpec, string disconnectSpec, long multiconnectMode, long operationOrder, ushort waitForDebounce);
private static extern int niSE_DisconnectAll(NISwitchExecutiveHandle vi);
private static extern int niSE_Disconnect(NISwitchExecutiveHandle vi, string spec);
private static extern int niSE_Connect(NISwitchExecutiveHandle vi, string connectSpec, long multiconnectMode, ushort waitForDebounce);
private NISwitchExecutive(NISwitchExecutiveHandle sessionHandle, string resourceName, string options) { _sessionHandle = sessionHandle; _resourceName = resourceName; }
internal static void ClearError(NISwitchExecutiveHandle handle) { int notUsed; GetError(handle, out notUsed); }