Compare commits
1 Commits
2a82b7d7dc
...
2aa7f88f03
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2aa7f88f03 |
@@ -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