示例#1
0
        public void ParseXml(string _sXml, ref SECS2_XML_MESSAGE _rPacket)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(SECS2_XML_MESSAGE));
            TextReader    reader     = new StringReader(_sXml);

            _rPacket = (SECS2_XML_MESSAGE)serializer.Deserialize(reader);
        }
        public int Send_S6F12_EventReportAck(eACKC6 _nACKC6)
        {
            int nErr = 0;
            SECS2_XML_MESSAGE Packet = new SECS2_XML_MESSAGE(MakeSystemByte(), (byte)eCMD.user, 6, 12);

            Packet.BODY.ACKC6 = (int)_nACKC6;

            nErr = do_Send(Packet);
            return(nErr);
        }
        public int Send_S2F42_HostCmdAck(eHCACK _nHCACK)
        {
            int nErr = 0;
            SECS2_XML_MESSAGE Packet = new SECS2_XML_MESSAGE(MakeSystemByte(), (byte)eCMD.user, 2, 42);

            Packet.BODY.HCACK = (int)_nHCACK;

            nErr = do_Send(Packet);
            return(nErr);
        }
示例#4
0
        public string MakeXml(SECS2_XML_MESSAGE _packet)
        {
            string sXml = "";

            XmlSerializer serializer = new XmlSerializer(typeof(SECS2_XML_MESSAGE));
            TextWriter    writer     = new StringWriter();

            serializer.Serialize(writer, _packet);
            sXml = writer.ToString();

            return(sXml);
        }
        private int do_Send(SECS2_XML_MESSAGE _packet)
        {
            int nErr = 0;

            string sMsg = m_parser.MakeXml(_packet);

            // socket stream writer로 write 해준다.
            // client_stream.Wirte( sMsg );
            byte[] s_buff = Encoding.Default.GetBytes(sMsg);
            m_stream.Write(s_buff, 0, sMsg.Length);

            return(nErr);
        }
        public int Send_S2F41_HostCommand(string _HostCmd, List <SECS2_XML_MESSAGEBODYCMD_PARAM> _CmdParams)
        {
            int nErr = 0;

            SECS2_XML_MESSAGE Packet = new SECS2_XML_MESSAGE(MakeSystemByte(), (byte)eCMD.user, 2, 41);

            Packet.BODY.RCMD = _HostCmd;

            Packet.BODY.PARAMETERS = new SECS2_XML_MESSAGEBODYCMD_PARAM[_CmdParams.Count()];
            int i = 0;

            foreach (SECS2_XML_MESSAGEBODYCMD_PARAM it in _CmdParams)
            {
                // Packet.BODY.PARAMETERS[i].CPNAME  = it.CPNAME;
                // Packet.BODY.PARAMETERS[i].CPVALUE = it.CPVALUE;
                Packet.BODY.PARAMETERS[i] = it;
                i++;
            }

            nErr = do_Send(Packet);

            return(nErr);
        }
 public void analyze_xml(string _rcv_msg, ref SECS2_XML_MESSAGE _it)
 {
     m_parser.ParseXml(_rcv_msg, ref _it);
 }