aqhome-react: major rebuild of unit handling.
now nested networks are allowed to allow for complex networks.
This commit is contained in:
@@ -37,8 +37,7 @@
|
||||
*/
|
||||
|
||||
static void _handleDataResponse(AQHREACT_UNIT *varChangeUnit, GWEN_MSG *msg);
|
||||
static int _processAllNets(AQHOME_REACT *aqh);
|
||||
static int _processNet(AQHREACT_UNIT_NET *unitNet);
|
||||
static int _processAllUnits(AQHOME_REACT *aqh);
|
||||
|
||||
|
||||
|
||||
@@ -78,69 +77,31 @@ void AqHomeReact_ProcessAllUnits(AQHOME_REACT *aqh)
|
||||
int rv;
|
||||
|
||||
do {
|
||||
rv=_processAllNets(aqh);
|
||||
rv=_processAllUnits(aqh);
|
||||
} while (rv==1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int _processAllNets(AQHOME_REACT *aqh)
|
||||
int _processAllUnits(AQHOME_REACT *aqh)
|
||||
{
|
||||
int result=0;
|
||||
int rv;
|
||||
AQHREACT_UNIT_NET *unitNet;
|
||||
AQHREACT_UNIT *unit;
|
||||
|
||||
rv=AQHREACT_Unit_Process(aqh->varChangeUnit);
|
||||
if (rv>0)
|
||||
result=1;
|
||||
unit=AQHREACT_Unit_List_First(aqh->unitList);
|
||||
while(unit) {
|
||||
int rv;
|
||||
|
||||
rv=AQHREACT_Unit_Process(aqh->timerUnit);
|
||||
if (rv>0)
|
||||
result=1;
|
||||
|
||||
unitNet=AQHREACT_UnitNet_List_First(aqh->unitNetList);
|
||||
while(unitNet) {
|
||||
rv=_processNet(unitNet);
|
||||
rv=AQHREACT_Unit_Process(unit);
|
||||
if (rv>0)
|
||||
result=1;
|
||||
|
||||
unitNet=AQHREACT_UnitNet_List_Next(unitNet);
|
||||
unit=AQHREACT_Unit_List_Next(unit);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int _processNet(AQHREACT_UNIT_NET *unitNet)
|
||||
{
|
||||
AQHREACT_UNIT_LIST *unitList;
|
||||
const char *netName;
|
||||
|
||||
netName=AQHREACT_UnitNet_GetName(unitNet);
|
||||
DBG_DEBUG(NULL, "Processing net \"%s\"", netName?netName:"<unnamed>");
|
||||
unitList=AQHREACT_UnitNet_GetUnitList(unitNet);
|
||||
if (unitList) {
|
||||
int result=0;
|
||||
AQHREACT_UNIT *unit;
|
||||
|
||||
unit=AQHREACT_Unit_List_First(unitList);
|
||||
while(unit) {
|
||||
int rv;
|
||||
|
||||
rv=AQHREACT_Unit_Process(unit);
|
||||
if (rv>0)
|
||||
result=1;
|
||||
unit=AQHREACT_Unit_List_Next(unit);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _handleDataResponse(AQHREACT_UNIT *varChangeUnit, GWEN_MSG *msg)
|
||||
{
|
||||
AQH_VALUE *value;
|
||||
|
||||
Reference in New Issue
Block a user