Comments (2)
Here's some test code I'm using to retrieve part of the tree statically:
`using System;
using System.Linq;
using System.Net.Sockets;
using System.Threading.Tasks;
using Lawo.EmberPlusSharp.Model;
using Lawo.EmberPlusSharp.S101;
using Lawo.Threading.Tasks;
internal class EmberTalk
{
public EmberTalk()
{
}
private static async Task<S101Client> ConnectAsync(string host, int port)
{
// Create TCP connection
var tcpClient = new TcpClient();
await tcpClient.ConnectAsync(host, port);
// Establish S101 protocol
// S101 provides message packaging, CRC integrity checks and a keep-alive mechanism.
var stream = tcpClient.GetStream();
return new S101Client(tcpClient, stream.ReadAsync, stream.WriteAsync);
}
private static void WriteChildren(INode node, int depth)
{
var indent = new string(' ', 2 * depth);
foreach (var child in node.Children)
{
var childNode = child as INode;
if (childNode != null)
{
Console.WriteLine("{0}Node {1}", indent, child.Identifier);
WriteChildren(childNode, depth + 1);
}
else
{
var childParameter = child as IParameter;
if (childParameter != null)
{
Console.WriteLine("{0}Parameter {1}: {2}", indent, child.Identifier, childParameter.Value);
}
}
}
}
private sealed class McRoot : Root<McRoot>
{
internal Mc Mc { get; private set; }
}
private sealed class Mc : FieldNode<Mc>
{
internal Channels Channels { get; private set; }
}
private sealed class Channels : FieldNode<Channels>
{
internal Inputs Inputs { get; private set; }
}
private sealed class Inputs : FieldNode<Inputs>
{
[Element(Identifier = "VB 1")]
internal Inputs vb1 { get; private set; }
}
private static void Main()
{
AsyncPump.Run(
async () =>
{
using (var client = await ConnectAsync("10.12.28.150", 9000))
using (var consumer = await Consumer<McRoot>.CreateAsync(client))
{
WriteChildren(consumer.Root, 0);
}
});
}
}`
from ember-plus-sharp.
Nevermind I solved it, I had to use the correct identifiers to make it work like this:
` private sealed class McRoot : Root
{
[Element(Identifier = "_2")]
internal Channels Channels { get; private set; }
}
private sealed class Channels : FieldNode<Channels>
{
[Element(Identifier = "_1")]
internal Inputs Inputs { get; private set; }
}
private sealed class Inputs : FieldNode<Inputs>
{
[Element(Identifier = "_1")]
internal VB1 VB1 { get; private set; }
}
private sealed class VB1 : FieldNode<VB1>
{
[Element(Identifier = "_400016b0")]
internal Fader Fader { get; private set; }
}
private sealed class Fader : FieldNode<Fader>
{
[Element(Identifier = "_400016b1")]
internal IntegerParameter FaderLevel { get; private set; }
}
`
However getting the whole tree dynamically still doesn't work, but for my application statically is sufficient. So I'm closing this issue.
from ember-plus-sharp.
Related Issues (20)
- High CPU usage HOT 3
- Wrong exception message is sometimes set for incorrect Ember+ lengths
- Extend Convert Glow Log to include matrix changes
- Connections are reset when the provider repeats matrix contents
- Converting IsOnlineLog.xml misses entry for node 1.1.2 HOT 2
- Lawo.EmberPlusSharp.Model.EmberOption is gone HOT 3
- Elements without identifiers are ignored
- How do I close the S101Logger on client ConnectionLost event
- Lawo Sapphire/SapphireCompact - The provider failed to send the children HOT 5
- Connecting to Mediornet - inconsistent source or target counts in matrix HOT 3
- Static Access to optional Parameters possible?
- Change Root Node during runtime?
- Requesting children of a node that contains a matrix freezes the application
- Consumer class creates an EmBER+ message that exceeds 1024 bytes
- Add support for connecting sources to targets in matrix nodes
- Lib not working with DHD devices HOT 5
- How to react multiple Changes HOT 2
- Glow Analyzer Proxy Autostart Option
- Decoding message received on s101Client.EmberDataReceived
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-plus-sharp.