Run both the OpcBasicClient and OpcBasicServer samples simultaneously on the same machine to see OPC commands passing from client to (virtual) server.
The utility of a server implementation is somewhat dubious, since that role is usually taken care of by the micro controller (or similar) that's communicating directly with the LEDs — Cinder's much more likely to come in handy creating OPC data rather than consuming it. Nevertheless, the server can be useful for creating simulators and testing layouts. (Similar conceptually to the gl_server example included in the official OpenPixelControl library.)
This library foregoes direct support for JSON layout files, but the OpcLayoutClient and OpcLayoutServer samples provide examples of parsing and using layout JSON.
Channels are currently unsupported.
This implementation is certainly not the leanest out there, but it tries to leverage Cinder's abstractions where possible. (e.g. ci::Color, asio::io_service, etc.)
Micah Elizabeth Scott has done a ton of significant work on top of the OPC protocol for her Fadecandy project, including hardware controllers and OPC wrapper libraries for a number of frameworks and platforms.
Shortly after finishing this block, I discovered James Hurlbut's FadeCandyCinderClient which includes a very similar implementation of the client, and also ports over some of the neat visual effect classes from the Fadecandy project.
This block depends on the Cinder-Asio block. I recommend Jean-Pierre Mouilleseaux fork.
Cinder-Asio needs to be added as the first include to the precompiled header file. See the examples for an example. If you forget this step, you will see "No member named 'error' in namespace 'asio::placeholders'" errors and similar.
If you're running your OPC client or server in the background, App Nap will slow down and eventually completely stop network transmissions.
To disable App Nap, add the following to your app's prepareSettings function:
The sample projects are already set accordingly.
- Test on Windows.
- Support for channels.
- Better support for layout JSON.
- Usue queue instead of deque for packet accumulation + parsing?