private void STVarChanged(Topic snd, TopicChanged p) {
if(p.Visited(_owner, true)) {
return;
}
for(int i=_drivers.Count-1; i>=0; i--) {
if(_drivers[i].VarChanged(snd, p.Art==TopicChanged.ChangeArt.Remove)) {
if(p.Art==TopicChanged.ChangeArt.Remove) {
lock(_drivers) {
_drivers.RemoveAt(i);
}
}
return;
}
}
if(p.Art==TopicChanged.ChangeArt.Remove) {
return;
}
TWICommon drv=null;
switch(snd.name) {
case "LM75_T0":
case "LM75_T1":
case "LM75_T2":
case "LM75_T3":
drv=new LM75(snd);
break;
case "CC2D_T":
case "CC2D_H":
drv=new CC2D(snd);
break;
case "HIH61_T":
case "HIH61_H":
drv=new HIH61xx(snd);
break;
case "SI7020_T":
case "SI7020_H":
drv=new SI7020(snd);
break;
case "BMP180_T":
case "BMP180_P":
drv=new BMP180(snd);
break;
case "BME280_T":
case "BME280_P":
case "BME280_H":
drv=new BME280(snd);
break;
case "BLINKM_8":
case "BLINKM_9":
case "BLINKM_10":
drv=new Blinky(snd);
break;
case "BH1750_0":
case "BH1750_1":
drv=new BH1750(snd);
break;
case "EXP_0":
case "EXP_1":
case "EXP_2":
case "EXP_3":
case "EXP_4":
case "EXP_5":
case "EXP_6":
case "EXP_7":
drv=new Expander(snd);
break;
//case "SI1143":
// drv=new SI1143(snd);
// break;
default:
if(snd.name.Length>2 && snd.name.Length<6 && (snd.name.StartsWith("Sa") || snd.name.StartsWith("Ra"))) {
drv=new RawDevice(snd);
}
break;
}
if(drv!=null) {
lock(_drivers) {
for(int i=_drivers.Count-1; i>=0; i--) {
if(_drivers[i].VarChanged(snd, false)) {
drv=null;
break;
}
}
if(drv!=null) {
_drivers.Add(drv);
}
}
}
}
[Flags]