@@ -7,15 +7,14 @@ It has been tested with _Lawo Ruby_, _Lawo R3lay_, and _Lawo MxGUI_.
77The current version is very losely based on the original library and Mr Gilles Dufour's rewrites. It is however rewritten almost completely from scratch and bears little to no resemblance to earlier libraries.
88
99### Repository-specific Info for Developers
10- * [ Developer Info] ( DEVELOPER.md )
11- * [ Contribution Guidelines] ( CONTRIBUTING.md )
12-
13- ### General Sofie System Info
14- * [ Documentation] ( https://nrkno.github.io/sofie-core/ )
15- * [ Releases] ( https://nrkno.github.io/sofie-core/releases )
1610
11+ - [ Developer Info] ( DEVELOPER.md )
12+ - [ Contribution Guidelines] ( CONTRIBUTING.md )
1713
14+ ### General Sofie System Info
1815
16+ - [ Documentation] ( https://nrkno.github.io/sofie-core/ )
17+ - [ Releases] ( https://nrkno.github.io/sofie-core/releases )
1918
2019---
2120
@@ -26,24 +25,36 @@ The current version is very losely based on the original library and Mr Gilles D
2625Get Full tree:
2726
2827``` javascript
29- const { EmberClient } = require (' emberplus-connection' );
30- const client = new EmberClient (" 10.9.8.7" , 9000 );
31- client .on (" error" , e => {
32- console .log (e);
33- });
28+ const { EmberClient , StreamManager } = require (' emberplus-connection' )
29+ const client = new EmberClient (' 10.9.8.7' , 9000 )
30+ client .on (' error' , ( e ) => {
31+ console .log (e)
32+ })
3433await client .connect ()
34+
35+ // If you want to listen to stream updates - you can do it like this:
36+ client .on (' streamUpdate' , (internalNodePath , value ) => {
37+ console .log (' Stream Update:' , {
38+ path: internalNodePath,
39+ value: value,
40+ })
41+ // You can get the internal node path, the internal path can be different from the path you requested,
42+ // depending on wheter you request a numbered node or via the description
43+ // the client has a client.getInternalNodePath(node) that you can request and use as reference when subsribing to a node
44+ })
45+
3546// Get Root info
3647const req = await client .getDirectory (client .tree )
3748await req .response
3849// Get a Specific Node
39- const node = await client .getElementByPath (" 0.0.2" )
40- console .log (node);
50+ const node = await client .getElementByPath (' 0.0.2' )
51+ console .log (node)
4152// Get a node by its path identifiers
42- const node2 = await client .getElementByPath (" path.to.node" ) )
43- console .log (node2);
53+ const node2 = await client .getElementByPath (' path.to.node' )
54+ console .log (node2)
4455// Get a node by its path descriptions
45- const node3 = await client .getElementByPath (" descr1.descr2.descr3" ) )
46- console .log (node3);
56+ const node3 = await client .getElementByPath (' descr1.descr2.descr3' )
57+ console .log (node3)
4758// Expand entire tree under node 0
4859await client .expand (client .tree )
4960console .log (client .tree )
@@ -70,6 +81,10 @@ client
7081 })
7182 .then (() => client .getElementByPath (' 0.2' ))
7283 .then (async (node ) => {
84+ // You can get the internal node path, the internal path can be different from the requested,
85+ // depending on wheter you request a numbered node or via the description
86+ console .log (' This is the internal node path :' , client .getInternalNodePath (node))
87+
7388 // For non-streams a getDirectory will automatically subscribe for update
7489 return (
7590 await client .getDirectory (node, (update ) => {
@@ -84,14 +99,22 @@ client
8499 console .log (update)
85100 })
86101 )
102+ client .on (' streamUpdate' , (internalNodePath , value ) => {
103+ console .log (' Stream Update:' , {
104+ path: internalNodePath,
105+ value: value,
106+ })
107+ })
87108```
88109
89110### Setting New Value
90111
91112``` javascript
92113client = new EmberClient (LOCALHOST , PORT )
93114await client .connect ()
94- await (await client .getDirectory ()).response
115+ await (
116+ await client .getDirectory ()
117+ ).response
95118const req = await client .setValue (await client .getElementByPath (' 0.0.1' ), ' gdnet' )
96119await req .response
97120console .log (' result' , req .response )
@@ -107,7 +130,9 @@ const { EmberClient, EmberLib } = require('node-emberplus')
107130
108131const client = new EmberClient (HOST , PORT )
109132await client .connect ()
110- await (await client .getDirectory ()).response
133+ await (
134+ await client .getDirectory ()
135+ ).response
111136const fn = await client .getElementByPath (' path.to.function' )
112137const req = await client .invoke (fn, 1 , 2 , 3 )
113138console .log (' result' , await req .response )
@@ -126,7 +151,7 @@ const {
126151 ParameterAccess ,
127152 MatrixImpl ,
128153 MatrixType ,
129- MatrixAddressingMode
154+ MatrixAddressingMode ,
130155} = require (' emberplus-connection' )
131156
132157const s = new EmberServer (9000 ) // start server on port 9000
@@ -187,14 +212,14 @@ const tree = {
187212 undefined ,
188213 ParameterAccess .ReadWrite
189214 )
190- )
215+ ),
191216 }),
192217
193218 2 : new NumberedTreeNodeImpl (2 , new EmberNodeImpl (' Functions' , undefined , undefined , true ), {
194219 1 : new NumberedTreeNodeImpl (
195220 1 ,
196221 new EmberFunctionImpl (undefined , undefined ) // , [{ type: ParameterType.Boolean, name: 'Test' }])
197- )
222+ ),
198223 }),
199224
200225 3 : new NumberedTreeNodeImpl (3 , new EmberNodeImpl (' Matrices' , undefined , undefined , true ), {
@@ -211,13 +236,14 @@ const tree = {
211236 5 ,
212237 5
213238 )
214- )
215- })
216- })
239+ ),
240+ }),
241+ }),
217242}
218243
219244s .init (tree) // initiate the provider with the tree
220245```
246+
221247---
222248
223249_ The NRK logo is a registered trademark of Norsk rikskringkasting AS. The license does not grant any right to use, in any way, any trademarks, service marks or logos of Norsk rikskringkasting AS._
0 commit comments