Skip to content

Commit 8265887

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 143b4be + 617de53 commit 8265887

File tree

6 files changed

+681
-17
lines changed

6 files changed

+681
-17
lines changed

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

lib/bindings/OPCUABinding.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,9 @@ function prepareInputArguments(attribute) {
328328
const inputs = [];
329329
let parsedValue;
330330
try {
331-
parsedValue = JSON.parse(attribute.value);
332-
if (Array.isArray(parsedValue)) {
331+
if (Array.isArray(attribute.value)) {
333332
config.getLogger().info(context, 'Found an Array as command input');
334-
for (const singleValue of parsedValue) {
333+
for (const singleValue of attribute.value) {
335334
inputs.push(singleValue);
336335
}
337336
} else {
@@ -392,7 +391,7 @@ async function executeCommand(apiKey, device, attribute, serialized, contentType
392391
return {
393392
attributeName: attribute.name,
394393
statusCode: thisCommand.statusCode.value,
395-
resultValue: thisCommand.outputArguments[0].value[0]
394+
resultValue: thisCommand.outputArguments[0].dataType < 12 ? thisCommand.outputArguments[0].value : thisCommand.outputArguments[0].value[0]
396395
};
397396
} else {
398397
config.getLogger().fatal(context, 'COMMAND-001: Error during command execution: commandResults.length is null');

lib/handlers/queryHandler.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ function queryHandler(id, type, service, subservice, attributes, callback) {
100100
const lazyAttributes = filterLazy(device, attributes);
101101
const funcList = lazyAttributes.map(generateQueryExecution.bind(null, apiKey, device)).reduce(concat, []);
102102
async.series(funcList, function (err, results) {
103-
callback(err, results[0]);
103+
var json_object = {};
104+
results.forEach(function (result) {
105+
json_object = { ...json_object, ...result };
106+
});
107+
callback(err, json_object);
104108
});
105109
}
106110
});

lib/mappingTool/objectFolder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ async function objectFolder(data, configJson, crawler, configJS) {
6262
var contextSubscription = {};
6363

6464
if (!ignoreNodeId) {
65-
if (!browseSubLev.hasOwnProperty('dataValue') && !browseSubLev.hasOwnProperty('hasComponent')) {
66-
//console.log("Method " + browseSubLev.browseName)
65+
if (!browseSubLev.hasOwnProperty('dataValue') && !browseSubLev.hasOwnProperty('hasComponent') && !browseSubLev.hasOwnProperty('organizes') && !browseSubLev.hasOwnProperty('hasTypeDefinition')) {
6766
const forbiddenCharacters = [...config.getConfig().iota.extendedForbiddenCharacters, ...constants.FORBIDDEN_NGSI_CHARS];
6867
config.getLogger().info(logContext, 'Using forbidden characters set: ' + JSON.stringify(forbiddenCharacters));
6968
var ocb_id = [...(name + browseSubLev.browseName)].map((char) => (forbiddenCharacters.includes(char) ? '' : char)).join('');
69+
7070
command = {
7171
name: ocb_id,
7272
type: 'command'

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/unit/lib/bindings/OPCUABinding.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ describe('OPCUABinding handling', () => {
200200
const device = mockDevice;
201201
const attribute = {
202202
name: 'Accelerate',
203-
value: '10'
203+
value: 10
204204
};
205205
opcuaBinding.executeCommand(apiKey, device, attribute);
206206
done();
@@ -210,7 +210,7 @@ describe('OPCUABinding handling', () => {
210210
const device = mockDevice;
211211
const attribute = {
212212
name: 'Accelerate',
213-
value: '[10,10]'
213+
value: [10, 10]
214214
};
215215
opcuaBinding.executeCommand(apiKey, device, attribute);
216216
done();

0 commit comments

Comments
 (0)