using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace RCUHost.Protocols
{
    [StructLayoutAttribute(LayoutKind.Sequential, Pack = 1)]
    public struct UpdateHostPacketProgress
    {
        #region Status Const

        /// <summary>
        /// 升级就绪
        /// </summary>
        public const byte Ready = 0x00;

        /// <summary>
        /// 升级完成
        /// </summary>
        public const byte Completed = 0x01;

        /// <summary>
        /// 升级出错
        /// </summary>
        public const byte Error = 0x02;

        /// <summary>
        /// 文件块数错误
        /// </summary>
        public const byte BlockNumError = 0x03;

        /// <summary>
        /// 文件类型错误
        /// </summary>
        public const byte FileTypeError = 0x04;

        /// <summary>
        /// 文件MD5错误
        /// </summary>
        public const byte FileMD5Error = 0x05;

        #endregion

        /// <summary>
        /// 状态
        /// </summary>
        public byte fileType;

        public ushort fileBlockCount;

        public ushort fileCurrentNumber;

        public byte fileNameLen;

        /// <summary>
        /// 版本号
        /// </summary>
        [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 2)]
        public string Version;

        /// <summary>
        /// CRC16
        /// </summary>
        public ushort CRC;
    }
}
