feat: add reactor registration and handling in ChildRegistrationUtils
This commit is contained in:
@@ -88,6 +88,11 @@ class ChildRegistrationUtils {
|
||||
this.connectActuator(child,positionVsParent);
|
||||
break;
|
||||
|
||||
case "reactor":
|
||||
this.logger.debug(`Registering reactor child: ${id}`);
|
||||
this.connectReactor(child);
|
||||
break;
|
||||
|
||||
default:
|
||||
this.logger.error(`Child registration unrecognized desc: ${desc}`);
|
||||
this.logger.error(`Unrecognized softwareType: ${softwareType}`);
|
||||
@@ -222,6 +227,20 @@ class ChildRegistrationUtils {
|
||||
}
|
||||
}
|
||||
|
||||
connectReactor(reactor) {
|
||||
if (!reactor) {
|
||||
this.logger.warn("Invalid reactor provided.");
|
||||
return;
|
||||
}
|
||||
this.mainClass.upstreamReactor = reactor; // Add reactor to the main class
|
||||
this.logger.info(`Reactor registered successfully.`);
|
||||
|
||||
reactor.emitter.on("stateChange", (data) => {
|
||||
this.mainClass.logger.debug(`State change of reactor detected: ${data}`);
|
||||
this.mainClass.setInflux = data;
|
||||
});
|
||||
}
|
||||
|
||||
//wanneer hij deze ontvangt is deltaP van een van de valves veranderd (kan ook zijn niet child zijn, maar dat maakt niet uit)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user