using BPASmartClient.Model.冰淇淋.Enum;
using System.Runtime.InteropServices;
using static BPASmartClient.GSIceCream.MessageDefine;

namespace BPASmartClient.GSIceCream
{
    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public class ICMSG_MODE_UP
    {
        public byte Header1;
        public byte Header2;
        public IC_CMD Cmd;
        public MORKI_MODE Mode;
        public short CalcCode;

        public ICMSG_MODE_UP() {
            Header1 = MessageDefine.HEADER1;
            Header2 = MessageDefine.HEADER2_DW;
            Cmd = IC_CMD.MODE;
        }

        public static ICMSG_MODE_DW Build(MORKI_MODE mode) {
            ICMSG_MODE_DW temp = new ICMSG_MODE_DW();
            temp.Mode = mode;
            temp.CalcCode = (short)((byte)temp.Cmd + (byte)temp.Mode);
            return temp;
        }
    }
}
