Files
2020-06-22 09:21:13 +02:00

73 lines
2.6 KiB
C#

using CMS_CORE_Library.OPENControl;
using CndexLinkDotNet;
using System;
using System.Runtime.InteropServices;
namespace CMS_CORE_Library.Osai
{
partial class NativeConstants
{
//NUM_LINE_PER_MSG -> 4
public const int NUM_LINE_PER_MSG = 4;
//NUM_WCHAR_PER_LINE -> 512
public const int NUM_WCHAR_PER_LINE = 512;
}
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
struct MESSAGE_TEXT
{
// WCHAR[2048]
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 512)]
public String Line1;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 512)]
public String Line2;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 512)]
public String Line3;
[MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 512)]
public String Line4;
public static implicit operator MESSAGE_TEXT(String value)
{
return new MESSAGE_TEXT() { Line1 = value, Line2 = value, Line3 = value, Line4 = value };
}
}
class OSAIErrorManagerLibrary
{
/// <summary>
/// Return Type: void
/// pMsgLog: MSG_LOGS*
/// pText: MESSAGE_TEXT*
/// </summary>
[DllImport("OSAI_ErrorMgr.dll", EntryPoint = "TranslateLogMsg", CallingConvention = CallingConvention.Cdecl)]
public static extern void TranslateLogMsg(ref MSGLOGS pMsgLog, ref MESSAGE_TEXT pText);
/// <summary>
/// Return Type: void
/// pMsgLog: MSG_ERROR*
/// pText: MESSAGE_TEXT*
/// </summary>
[DllImport("OSAI_ErrorMgr.dll", EntryPoint = "TranslateErrorMsg", CallingConvention = CallingConvention.Cdecl)]
public static extern void TranslateErrorMsg(ref Cndex.MSG_ERROR pMsgLog, ref MESSAGE_TEXT pText);
/// <summary>
/// Return Type: void
/// pMsgLog: MSG_EMERGENCY*
/// pText: MESSAGE_TEXT*
/// </summary>
[DllImport("OSAI_ErrorMgr.dll", EntryPoint = "TranslateEmergMsg", CallingConvention = CallingConvention.Cdecl)]
public static extern void TranslateEmergMsg(ref Cndex.MSG_EMERGENCY pMsgLog, ref MESSAGE_TEXT pText);
/// <summary>
/// Return Type: void
/// pMsgLog: MSG_ANOMALY*
/// pText: MESSAGE_TEXT*
/// </summary>
[DllImport("OSAI_ErrorMgr.dll", EntryPoint = "TranslateAnomalyMsg", CallingConvention = CallingConvention.Cdecl)]
public static extern void TranslateAnomalyMsg(ref MSGANOMALY pMsgLog, ref MESSAGE_TEXT pText);
}
}