public void Write(EMasterKDevice device, int address, UInt16[] values, int plcNo = 0, bool checkBcc = true)
        {
            if ((values == null) || (values.Length > 120))
            {
                Log(EEthernetLogItem.Exception, "Occurred out of writing length({0})", values.Length);
                throw new MasterKException(
                          "Occurred out of writinging length error in UlMasterKEthernetClient.Write",
                          EMasterKException.InvalidAddress);
            }

            string cmd    = (checkBcc == true) ? "w" : "W";
            string packet = $"{(char)EAscii.ENQ}{plcNo:X2}{cmd}SB07%{device}W{address:X4}{values.Length:X2}";

            for (int i = 0; i < values.Length; i++)
            {
                packet += $"{values[i]:X4}";
            }
            packet += $"{(char)EAscii.EOT}";

            if (checkBcc == true)
            {
                packet += CalcBcc(packet);
            }

            Send(packet, checkBcc);
        }
        public void Read(EMasterKDevice device, int address, int length, int plcNo = 0, bool checkBcc = true)
        {
            if ((length < 1) || (length > 120))
            {
                Log(EEthernetLogItem.Exception, "Occurred out of reading length({0})", length);
                throw new MasterKException(
                          "Occurred out of reading length error in UlMasterKEthernetClient.Read",
                          EMasterKException.InvalidAddress);
            }

            string cmd    = (checkBcc == true) ? "r" : "R";
            string packet = $"{(char)EAscii.ENQ}{plcNo:X2}{cmd}SB07%{device}W{address:D4}{length:X2}{(char)EAscii.EOT}";

            if (checkBcc == true)
            {
                packet += CalcBcc(packet);
            }

            Send(packet, checkBcc);

            lock (valuePacket)
            {
                lock (recvPacket)
                {
                    packet = recvPacket.ToString();
                }

                valuePacket = packet.Substring(8, length * 4);
            }
        }
        public void Write(EMasterKDevice device, int address, UInt16 value, int plcNo = 0, bool checkBcc = true)
        {
            string cmd    = (checkBcc == true) ? "w" : "W";
            string packet = $"{(char)EAscii.ENQ}{plcNo:X2}{cmd}SS0107%{device}W{address:X4}{value:X4}{(char)EAscii.EOT}";

            if (checkBcc == true)
            {
                packet += CalcBcc(packet);
            }

            Send(packet, checkBcc);
        }
        public void SetBit(EMasterKDevice device, int address, int bitNo, bool active, int plcNo = 0, bool checkBcc = true)
        {
            string cmd     = (checkBcc == true) ? "w" : "W";
            string boolean = (active == false) ? "00" : "01";
            string packet  = $"{(char)EAscii.ENQ}{plcNo:X2}{cmd}SS0107%{device}X{address:D3}{bitNo:X1}{boolean}{(char)EAscii.EOT}";

            if (checkBcc == true)
            {
                packet += CalcBcc(packet);
            }

            Send(packet, checkBcc);
        }
        public bool GetBit(EMasterKDevice device, int address, int bitNo, int plcNo = 0, bool checkBcc = true)
        {
            string cmd    = (checkBcc == true) ? "r" : "R";
            string packet = $"{(char)EAscii.ENQ}{plcNo:X2}{cmd}SS0107%{device}X{address:D3}{bitNo:X1}{(char)EAscii.EOT}";

            if (checkBcc == true)
            {
                packet += CalcBcc(packet);
            }

            Send(packet, checkBcc);
            packet = packet.Substring(10, 2);

            return((packet == "00") ? false : true);
        }