Trying to fix - Bridge

This commit is contained in:
Martin Karkowski 2021-03-19 13:19:06 +01:00
parent d4628e183d
commit 75f3c58543

View File

@ -264,7 +264,18 @@ export class Bridge implements ICommunicationInterface {
): void {
const oldItems = this._combineLayers(layerToForwardTo, mode);
// Store the Elements, that have been provided before.
this._dispatcherSubscribedTopicsMapping.set(dispatcherID, new Set(content));
switch (mode) {
case "events":
this._dispatcherSubscribedTopicsMapping.set(
dispatcherID,
new Set(content)
);
break;
case "services":
this._dispatcherServicesMapping.set(dispatcherID, new Set(content));
break;
}
// Store the Elements, that now have been provided.
const newItems = this._combineLayers(layerToForwardTo, mode);
@ -371,6 +382,15 @@ export class Bridge implements ICommunicationInterface {
if (!this._callbacks.has(_name)) {
// Define the Callback and Store it.
const callback = (msg) => {
if (this._logger) {
this._logger.debug(
layerSubscribed.id,
"==",
_mapping[type],
"==>",
layerForwarded.id
);
}
layerForwarded[_mapping[type]](item, msg);
};
this._callbacks.set(_name, {
@ -619,8 +639,8 @@ export class Bridge implements ICommunicationInterface {
} else {
// Define a Function which stores the Actions:
this[method as any] = async (...args) => {
if (_this._logger) {
_this._logger.debug(method, ...args);
if (_this._logger && method !== "emitStatusUpdate") {
_this._logger.info(method, ...args);
}
for (const _layer of _this._connectedLayers.keys()) {
@ -643,7 +663,7 @@ export class Bridge implements ICommunicationInterface {
const _wrapped = (data) => {
// Log the Forwarding
if (_this._logger && method != "onStatusUpdate") {
_this._logger.debug("Forwarding", method, "=>", METHOD_MAPPING[method]);
_this._logger.info("Forwarding", method, "=>", METHOD_MAPPING[method]);
}
for (const _layer of _this._connectedLayers.keys()) {
@ -668,7 +688,7 @@ export class Bridge implements ICommunicationInterface {
const _this = this;
return (data) => {
if (_this._logger && method != "onStatusUpdate") {
_this._logger.debug("Forwarding", method, "=>", METHOD_MAPPING[method]);
_this._logger.info("Forwarding", method, "=>", METHOD_MAPPING[method]);
}
for (const _layer of _this._connectedLayers.keys()) {