Exemplo n.º 1
0
        public ushort[] GetAsModbus()
        {
            switch (Type)
            {
            case SignalType.Bool:
                return(new[] { (ushort)(Signal.IsSet ? Mask : 0) });

            case SignalType.Ushort:
                return(new[] { (ushort)Signal.Value });

            //case SignalType.Uint:
            //    return XpBitConverter.GetUint16(BitConverter.GetBytes((uint)Signal.Value));

            case SignalType.Float:
                return(XpBitConverter.GetUint16(BitConverter.GetBytes(Signal.Value)));
            }

            return(null);
        }
Exemplo n.º 2
0
 public ushort[] Restore()
 {
     return(mData ?? XpBitConverter.GetUint16(Convert.FromBase64String(Data)));
 }