Skip to content

Commit

Permalink
Fix to function info
Browse files Browse the repository at this point in the history
  • Loading branch information
gsteinLTU committed Jul 30, 2024
1 parent ceb2a3d commit 5dae6a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/procedures/iotscape/iotscape-devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ IoTScapeDevices.accepts = function (service, id, clientId, seqNum = -1) {
state.clientCounts[clientId] = client;
IoTScapeDevices._encryptionStates[service][id] = state;

logger.log(JSON.stringify(IoTScapeDevices._encryptionStates[service][id]));
return true;
};

Expand Down
10 changes: 9 additions & 1 deletion src/procedures/iotscape/iotscape-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ IoTScapeServices.getFunctionInfo = function (service, func) {
return IoTScapeServices._specialMethods[func];
}

return IoTScapeServices._serviceDefinitions[service].methods[func];
let method = (IoTScapeServices._serviceDefinitions[service] ?? {methods: []}).methods.filter(m => m.name === func);
return method.length > 0 ? method[0] : undefined;
};

IoTScapeServices._lastRequestID = 0;
Expand Down Expand Up @@ -250,6 +251,13 @@ IoTScapeServices.call = async function (service, func, id, clientId, ...args) {
!IoTScapeDevices.deviceExists(service, id) ||
!IoTScapeServices.functionExists(service, func)
) {
if (!IoTScapeDevices.deviceExists(service, id)) {
logger.log("Device does not exist");
}
if (!IoTScapeServices.functionExists(service, func)) {
logger.log("Function does not exist");
}

return false;
}

Expand Down

0 comments on commit 5dae6a3

Please sign in to comment.