diff --git a/src/Ember/Client/index.ts b/src/Ember/Client/index.ts index 67f461b..c44223e 100644 --- a/src/Ember/Client/index.ts +++ b/src/Ember/Client/index.ts @@ -209,7 +209,13 @@ export class EmberClient extends EventEmitter { cb, }) - return this._sendCommand(node, command, ExpectResponse.HasChildren) + return this._sendCommand( + node, + command, + node.contents.type == 'PARAMETER' + ? ExpectResponse.None + : ExpectResponse.HasChildren + ) } async subscribe( node: RootElement | Array, @@ -388,24 +394,24 @@ export class EmberClient extends EventEmitter { const i = pathArr.shift() if (!i) break // TODO - this will break the loop if the path was `1..0` if (!tree) break - let next = getNextChild(tree, i) - if (!next) { - const req = await this.getDirectory(tree) - tree = (await req.response) as NumberedTreeNode - next = getNextChild(tree, i) - } - tree = next + const req = await this.getDirectory(tree) + tree = (await req.response) as NumberedTreeNode + tree = getNextChild(tree, i) if (!tree) throw new Error(`Could not find node ${i} on given path ${numberedPath.join()}`) if (tree?.number !== undefined) numberedPath.push(tree.number) } - - if (cb && numberedPath) { - this._subscriptions.push({ - path: numberedPath.join('.'), - cb, - }) + if (tree) { + const req = await this.getDirectory(tree) } + // this resulted in doubled subscription because getDirectory() adds the element as well + // if (cb && numberedPath) { + // this._subscriptions.push({ + // path: numberedPath.join('.'), + // cb, + // }) + // } + return tree } diff --git a/src/encodings/ber/encoder/Tree.ts b/src/encodings/ber/encoder/Tree.ts index 205d840..bdc98fe 100644 --- a/src/encodings/ber/encoder/Tree.ts +++ b/src/encodings/ber/encoder/Tree.ts @@ -130,7 +130,6 @@ function hasChildren(el: TreeElement): boolean { el.children !== undefined && !( el.contents.type === ElementType.Command || - el.contents.type === ElementType.Parameter || el.contents.type === ElementType.Template ) )