40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Driver.FOCAS;
|
|
|
|
/// <summary>
|
|
/// FOCAS atomic data types. Narrower than Logix/IEC — FANUC CNCs expose mostly integer +
|
|
/// floating-point data with no UDT concept; macro variables are double-precision floats
|
|
/// and PMC reads return byte / signed word / signed dword.
|
|
/// </summary>
|
|
public enum FocasDataType
|
|
{
|
|
/// <summary>Single bit (PMC bit, or bit within a CNC parameter).</summary>
|
|
Bit,
|
|
/// <summary>8-bit signed byte (PMC 1-byte read).</summary>
|
|
Byte,
|
|
/// <summary>16-bit signed word (PMC 2-byte read, or CNC parameter as short).</summary>
|
|
Int16,
|
|
/// <summary>32-bit signed int (PMC 4-byte read, or CNC parameter as int).</summary>
|
|
Int32,
|
|
/// <summary>32-bit IEEE-754 float (rare; some CNC macro variables).</summary>
|
|
Float32,
|
|
/// <summary>64-bit IEEE-754 double (most macro variables are double-precision).</summary>
|
|
Float64,
|
|
/// <summary>ASCII string (alarm text, parameter names, some PMC string areas).</summary>
|
|
String,
|
|
}
|
|
|
|
public static class FocasDataTypeExtensions
|
|
{
|
|
public static DriverDataType ToDriverDataType(this FocasDataType t) => t switch
|
|
{
|
|
FocasDataType.Bit => DriverDataType.Boolean,
|
|
FocasDataType.Byte or FocasDataType.Int16 or FocasDataType.Int32 => DriverDataType.Int32,
|
|
FocasDataType.Float32 => DriverDataType.Float32,
|
|
FocasDataType.Float64 => DriverDataType.Float64,
|
|
FocasDataType.String => DriverDataType.String,
|
|
_ => DriverDataType.Int32,
|
|
};
|
|
}
|