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