//====================================================================== // Get Status /// <summary> /// Returns the current server status. /// </summary> /// <returns>The current server status.</returns> public ServerStatus GetStatus() { if (m_server == null) { throw new NotConnectedException(); } ServerStatus status = ((IServer)m_server).GetStatus(); if (status.StatusInfo == null) { status.StatusInfo = GetString("serverState." + status.ServerState.ToString()); } return(status); }
internal static Opc.Ae.ServerStatus GetServerStatus(ref IntPtr pInput, bool deallocate) { Opc.Ae.ServerStatus status = null; if (pInput != IntPtr.Zero) { OPCEVENTSERVERSTATUS opceventserverstatus = (OPCEVENTSERVERSTATUS)Marshal.PtrToStructure(pInput, typeof(OPCEVENTSERVERSTATUS)); status = new Opc.Ae.ServerStatus { VendorInfo = opceventserverstatus.szVendorInfo, ProductVersion = string.Format("{0}.{1}.{2}", opceventserverstatus.wMajorVersion, opceventserverstatus.wMinorVersion, opceventserverstatus.wBuildNumber), ServerState = (ServerState)opceventserverstatus.dwServerState, StatusInfo = null, StartTime = OpcCom.Interop.GetFILETIME(Convert(opceventserverstatus.ftStartTime)), CurrentTime = OpcCom.Interop.GetFILETIME(Convert(opceventserverstatus.ftCurrentTime)), LastUpdateTime = OpcCom.Interop.GetFILETIME(Convert(opceventserverstatus.ftLastUpdateTime)) }; if (deallocate) { Marshal.DestroyStructure(pInput, typeof(OPCEVENTSERVERSTATUS)); Marshal.FreeCoTaskMem(pInput); pInput = IntPtr.Zero; } } return(status); }
internal static Opc.Ae.ServerStatus GetServerStatus(ref IntPtr pInput, bool deallocate) { Opc.Ae.ServerStatus serverStatus = null; if (pInput != IntPtr.Zero) { OPCEVENTSERVERSTATUS oPCEVENTSERVERSTATUS = (OPCEVENTSERVERSTATUS)Marshal.PtrToStructure(pInput, typeof(OPCEVENTSERVERSTATUS)); serverStatus = new Opc.Ae.ServerStatus(); serverStatus.VendorInfo = oPCEVENTSERVERSTATUS.szVendorInfo; serverStatus.ProductVersion = $"{oPCEVENTSERVERSTATUS.wMajorVersion}.{oPCEVENTSERVERSTATUS.wMinorVersion}.{oPCEVENTSERVERSTATUS.wBuildNumber}"; serverStatus.ServerState = (ServerState)oPCEVENTSERVERSTATUS.dwServerState; serverStatus.StatusInfo = null; serverStatus.StartTime = OpcCom.Interop.GetFILETIME(Convert(oPCEVENTSERVERSTATUS.ftStartTime)); serverStatus.CurrentTime = OpcCom.Interop.GetFILETIME(Convert(oPCEVENTSERVERSTATUS.ftCurrentTime)); serverStatus.LastUpdateTime = OpcCom.Interop.GetFILETIME(Convert(oPCEVENTSERVERSTATUS.ftLastUpdateTime)); if (deallocate) { Marshal.DestroyStructure(pInput, typeof(OPCEVENTSERVERSTATUS)); Marshal.FreeCoTaskMem(pInput); pInput = IntPtr.Zero; } } return(serverStatus); }