示例#1
0
        public clsSensor Add(clsSensor NewSensor)
        {
            if (NewSensor.ValidationErrors() != "")
            {
                throw new ArgumentException(NewSensor.ValidationErrors());
            }

            cSensors.Add(new clsSensor(mf));
            clsSensor Sen = cSensors[cSensors.Count - 1];

            Sen.SensorAddress = NewSensor.SensorAddress;
            Sen.ControlBoxID  = NewSensor.ControlBoxID;
            Sen.Enabled       = NewSensor.Enabled;
            Sen.OffSet        = NewSensor.OffSet;
            Sen.UserData      = NewSensor.UserData;
            return(Sen);
        }
示例#2
0
        public void Load()
        {
            cSensors.Clear();

            DAO.Recordset RS;
            string        SQL = "Select * from tblSensors order by senRecNum";

            RS = mf.Dbase.DB.OpenRecordset(SQL);
            while (!RS.EOF)
            {
                clsSensor Sen = new clsSensor(mf);
                Sen.Load((short)RS.Fields["senID"].Value);
                cSensors.Add(Sen);
                RS.MoveNext();
            }
            RS.Close();
        }
示例#3
0
        public clsSensor Add(byte[] Address)
        {
            // check if exists
            short ID = ByteAddressFound(Address);

            if (ID == -1)
            {
                // new address
                cSensors.Add(new clsSensor(mf));
                clsSensor Sen = cSensors[cSensors.Count - 1];
                Sen.SetAddressBytes(Address);
                return(Sen);
            }
            else
            {
                // existing address
                clsSensor Sen = new clsSensor(mf);
                Sen.Load(ID);
                return(Sen);
            }
        }