using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using SystemX.Common;
using SystemX.Common.Serialization;
using SystemX.Net.BaseProtocol;
using SystemX.Net.Schedule;

namespace SystemX.Net.MiddlewareUI.UIM.Protocol_Method
{
    public class CONNECT_STATE : ProtocolShell, IProtocol
    {
        public CONNECT_STATE(MainForm parent, int iPos, byte nLabel)
            : base(parent, iPos, nLabel)
        {
        }

        public override void ExecuteProtocol(BASE_PROTOCOL GET_PROTOCOL,
            BASE_PROTOCOL.PROTOCOL_CODE CODE,
            HEADER_PACKET getHeader,
            object objData)
        {
            PING_PACKET GetPingPacket = (PING_PACKET)objData;

            string strGetMsg = GetPingPacket.objCheckMsg[0].Data;

            PING_PACKET PingPacketMake = new PING_PACKET();
            int iSendSize = Marshal.SizeOf(PingPacketMake);
            byte[] ucSendArray = new byte[iSendSize];
            PingPacketMake = (PING_PACKET)SystemXNetSerialization.RawDeSerialize(ucSendArray, PingPacketMake.GetType());

            PingPacketMake.objCheckMsg[0].Data = "SystemX";

            ucSendByteInfo = XCommons.SpecialObjectToByteStream(new BASE_PROTOCOL(BASE_PROTOCOL.PROTOCOL_CODE.CONNECT_STATE), PingPacketMake);
        }
    }
}
