fix(commands): restore child.register handler (alias registerChild)
The P6.3 refactor dropped the case 'registerChild' branch from the nodeClass switch. Restored as a canonical child.register descriptor with the legacy registerChild alias. Monster accepts measurement children — without this, inbound Port 2 handshakes from a child were silently ignored. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,3 +40,15 @@ exports.setMode = (source, msg) => {
|
|||||||
exports.setModelPrediction = (source, msg) => {
|
exports.setModelPrediction = (source, msg) => {
|
||||||
if (typeof source.setModelPrediction === 'function') source.setModelPrediction(msg.payload);
|
if (typeof source.setModelPrediction === 'function') source.setModelPrediction(msg.payload);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Inbound child registration from a measurement (or other) child node.
|
||||||
|
// Ported from the legacy `case 'registerChild'` branch in nodeClass.
|
||||||
|
exports.childRegister = (source, msg, ctx) => {
|
||||||
|
const childId = msg.payload;
|
||||||
|
const childObj = ctx?.RED?.nodes?.getNode?.(childId);
|
||||||
|
if (!childObj?.source) {
|
||||||
|
(ctx?.logger || source.logger)?.warn?.(`child.register skipped: missing child/source for id=${childId}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
source.childRegistrationUtils.registerChild(childObj.source, msg.positionVsParent, msg.distance);
|
||||||
|
};
|
||||||
|
|||||||
@@ -44,4 +44,10 @@ module.exports = [
|
|||||||
payloadSchema: { type: 'any' },
|
payloadSchema: { type: 'any' },
|
||||||
handler: handlers.setModelPrediction,
|
handler: handlers.setModelPrediction,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
topic: 'child.register',
|
||||||
|
aliases: ['registerChild'],
|
||||||
|
payloadSchema: { type: 'string' },
|
||||||
|
handler: handlers.childRegister,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user