need to further update measurement emit function
This commit is contained in:
@@ -13,7 +13,7 @@ class ChildRegistrationUtils {
|
||||
|
||||
// Enhanced child setup
|
||||
child.parent = this.mainClass;
|
||||
child.positionVsParent = positionVsParent;
|
||||
//child.positionVsParent = positionVsParent;
|
||||
|
||||
// Enhanced measurement container with rich context
|
||||
if (child.measurements) {
|
||||
@@ -33,10 +33,10 @@ class ChildRegistrationUtils {
|
||||
registeredAt: Date.now()
|
||||
});
|
||||
|
||||
// IMPORTANT: Only call parent registration - no automatic handling and if parent has this function then try to register this child
|
||||
if (typeof this.mainClass.registerChild === 'function') {
|
||||
this.logger.debug(`Child ${name} stored under type ${softwareType}`);
|
||||
this.logger.debug(`Spitting out mainclass: ${this.mainClass.child} `);
|
||||
|
||||
this.mainClass.registerChild(child, softwareType);
|
||||
}
|
||||
|
||||
this.logger.info(`✅ Child ${name} registered successfully`);
|
||||
}
|
||||
|
||||
@@ -154,8 +154,9 @@ class MeasurementContainer {
|
||||
};
|
||||
|
||||
// Emit the exact event your parent expects
|
||||
this.emitter.emit(`${this._currentType}.${this._currentVariant}.${this._convertPositionNum2Str(this._currentPosition)}`, eventData);
|
||||
this.emitter.emit(`${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
|
||||
//console.log(`Emitted event: ${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
|
||||
console.log(`Emitted event: ${this._currentType}.${this._currentVariant}.${this._currentPosition}`, eventData);
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -418,7 +419,9 @@ class MeasurementContainer {
|
||||
}
|
||||
|
||||
_convertPositionStr2Num(positionString) {
|
||||
switch(positionString) {
|
||||
|
||||
switch (positionString) {
|
||||
|
||||
case "atEquipment":
|
||||
return 0;
|
||||
case "upstream":
|
||||
|
||||
Reference in New Issue
Block a user