using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotNetty.Handlers.Timeout;
using DotNettyFrom.config;
using DotNettyFrom.util;
using NUnit.Framework;

namespace DotNettyFrom.generatecmd
{
    public abstract class CmdGenetor
    {
        public string DeviceId;
        public static CmdGenetor Genetor { get; set; }

        public abstract string GetLoginCmd(string ccid);

        public abstract string GetHeartbeat();

        public abstract string GetReplyCmd(string receiveCmd);


        public int GetCmdId(string receiveCmd)
        {
            try
            {
                string cmdId = receiveCmd.Substring(2 * SystemConfig.FunctionCodeStartPos,
                    2 * SystemConfig.FunctionCodeLength);
                return Utils.hexToTen(cmdId);
            }
            catch (Exception)
            {
            }
            return int.MinValue;
        }
    }
}