Exemplo n.º 1
0
        //甄玉龙增加燃气校时配置帧
        public void calibraRQ(DeviceDTO dto)
        {
            var       server      = bootstrap.GetServerByName(WS_SERVER);
            WSServer  casicServer = server as WSServer;
            WSSession session     = casicServer.GetSessionByID(dto.SessionId) as WSSession;

            //下发校时信息
            String preTimeCal = "SewTiming:" + session.MacID + ",";
            String postTime   = DateTime.Now.ToString("yyyyMMddHHmmss");
            String timeCal    = preTimeCal + postTime;

            byte[] data1 = new byte[timeCal.Length + 2];
            Encoding.ASCII.GetBytes(timeCal, 0, timeCal.Length, data1, 0);
            data1[timeCal.Length]     = 0x0D;
            data1[timeCal.Length + 1] = 0x0A;
            session.Send(data1, 0, data1.Length);
            session.Logger.Info("校时信息:" + timeCal);
        }
Exemplo n.º 2
0
        private bool sendWSConfig(DeviceDTO dto, Dictionary <String, String> settings)
        {
            var       server      = bootstrap.GetServerByName(WS_SERVER);
            WSServer  casicServer = server as WSServer;
            WSSession session     = casicServer.GetSessionByID(dto.SessionId) as WSSession;

            String period = settings["ws_period"];

            if (period == "")
            {
                return(false);
            }

            String sdata0 = "SewAcquireInterval:" + session.MacID + "," + period;

            byte[] data0 = new byte[sdata0.Length + 2];
            Encoding.ASCII.GetBytes(sdata0, 0, sdata0.Length, data0, 0);
            data0[sdata0.Length]     = 0x0D;
            data0[sdata0.Length + 1] = 0x0A;
            session.Send(data0, 0, data0.Length);
            session.Logger.Info("有害气体配置信息:" + sdata0);

            //下发校时信息

            /*
             * String preTimeCal = "SewTiming:" + session.MacID + ",";
             * String postTime = DateTime.Now.ToString("yyyyMMddHHmmss");
             * String timeCal = preTimeCal + postTime;
             *
             * byte[] data1 = new byte[timeCal.Length + 2];
             * Encoding.ASCII.GetBytes(timeCal, 0, timeCal.Length, data1, 0);
             * data1[timeCal.Length] = 0x0D;
             * data1[timeCal.Length + 1] = 0x0A;
             * session.Send(data1, 0, data1.Length);
             * session.Logger.Info("校时信息:" + timeCal);
             * */
            return(true);
        }