Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lXRainDevice"></param>
        private void ShowLXRainDevice(LXRainDevice lXRainDevice)
        {
            UCLXRainDevice uc = GetUCLXRainDevice();

            OnlyVisible(uc);
            uc.RainDevice = lXRainDevice;
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public StationCollection CreateRainStations(CommuniSoft soft)
        {
            string deviceType = "LXRainDevice";

            StationCollection stations = new StationCollection();
            DataTable         stTable  = LXDBDBI.LXDB.GetRainStationDataTable();

            foreach (DataRow row in stTable.Rows)
            {
                string    rainName    = row["Rain_Name"].ToString();
                int       rainAddress = Convert.ToInt32(row["Rain_addr"]);
                string    ipString    = row["Rain_IP"].ToString();
                IPAddress ip          = IPAddress.Parse(ipString);
                int       deviceid    = rainAddress;
                int       stationid   = rainAddress;

                SocketCommuniType ct = new SocketCommuniType(ip);
                Station           st = new Station(rainName, ct);
                st.ID = stationid;

                DeviceDefine dd = soft.DeviceDefineManager.
                                  DeviceDefineCollection.FindDeviceDefine(deviceType);
                LXRainDevice d = new LXRainDevice(dd, rainAddress);
                d.ID = deviceid;

                st.Devices.Add(d);

                stations.Add(st);
            }
            return(stations);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="task"></param>
        public void ProcessExecutingTask(Task task)
        {
            //throw new NotImplementedException();
            if (StringHelper.Equal(task.Device.DeviceDefine.DeviceType,
                                   DeviceDefineConst.DDT_XD2300))
            {
                XD2300Processor.Default.ProcessExecutingTask(task);
            }

            if (task.Device is LXRainDevice)
            {
                LXRainDevice rainDevice = task.Device as LXRainDevice;
                task.Opera.SendPart["lastdt"] = rainDevice.LastRainDateTime.Ticks;
            }
        }
Esempio n. 4
0
        static public void ProcessExecutedTask(Task task, ParseResult pr)
        {
            byte recordCount = Convert.ToByte(pr.NameObjects.GetObject("RecordCount"));

            byte[] bs = (byte[])pr.NameObjects.GetObject("Record");

            DateTime[] dts;
            int[]      rains;

            bool b = LXRainCommon.RainResponse.Parse(bs, recordCount, out dts, out rains);

            if (b)
            {
                for (int i = 0; i < recordCount; i++)
                {
                    LXRainData rainData = new LXRainData();
                    rainData.DT   = dts[i];
                    rainData.Rain = rains[i];

                    LXRainDevice rainDevice = task.Device as LXRainDevice;
                    rainDevice.LXRainData = rainData;
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="lXRainDevice"></param>
 private void ShowLXRainDevice(LXRainDevice lXRainDevice)
 {
     UCLXRainDevice uc = GetUCLXRainDevice();
     OnlyVisible(uc);
     uc.RainDevice = lXRainDevice;
 }
Esempio n. 6
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public StationCollection CreateRainStations(CommuniSoft soft)
        {
            string deviceType = "LXRainDevice";

            StationCollection stations = new StationCollection();
            DataTable stTable = LXDBDBI.LXDB.GetRainStationDataTable();
            foreach (DataRow row in stTable.Rows)
            {
                string rainName = row["Rain_Name"].ToString();
                int rainAddress = Convert.ToInt32(row["Rain_addr"]);
                string ipString = row["Rain_IP"].ToString();
                IPAddress ip = IPAddress.Parse(ipString);
                int deviceid = rainAddress;
                int stationid = rainAddress;

                SocketCommuniType ct = new SocketCommuniType(ip);
                Station st = new Station(rainName, ct);
                st.ID = stationid;

                DeviceDefine dd = soft.DeviceDefineManager.
                    DeviceDefineCollection.FindDeviceDefine(deviceType);
                LXRainDevice d = new LXRainDevice(dd,rainAddress);
                d.ID = deviceid;

                st.Devices.Add(d);

                stations.Add(st);
            }
            return stations;
        }