01-29-2013 03:24 PM
I'm somewhat new to Actor framework and this is my first major project using it. I've completed a few simple Actors before and integrated them into larger applications.
I am communicating with a device over Ethernet. A proprietary program takes in ASCII commands and passes them to the device. Data is returned along the same TCP connection as ASCII strings.
I want to display the data to the user in a UI. In the future, the proprietary communication program may be swapped out for a custom in-house program. There are likely to be different UIs in the future.
I decided to create 3 Actors: a Hardware Interface / Listener actor, a Controller actor, and a UI actor. I want to keep communication between the three Actors simple and consistent, so potential future Actors are able to handle the same messages. The Listener and UI actors may be substituted for other actors in the future (a certainty in the case of the UI actor).
A critical task of the UI is to be able to display the parameters/settings of the device. There are several dozen different settings. The UI is interested in displaying some of them as indicators, issuing warnings depending on other parameters, and ignoring other updates. The UI's response to a specific parameter would change depending on which UI is being used.
What I'm struggling with is this:
I'm afraid of coupling Actors too tightly together. On the other hand, it's not clear to me where the Parameter data should be stored, because it seems like the Controller and UI would need to have access to it.
If anyone has any thoughts/advice, I'd greatly appreciate it.
01-30-2013 10:56 AM
Hi Mike,
Although I am not profficient with the Actor framework, since there have been no replies yet, in the meantime you might want to take a look at the "Documentation and Learning Tools" section of this page:
https://decibel.ni.com/content/docs/DOC-17193
In particular, the NI Week 2012 Hands-On Session on Actor framework may be helpful.
Best of luck,
Eric
01-30-2013 11:38 AM
Thanks, Eric. I have actually already gone through the Hands-On session, as well as the Simple Actor Example, the Cooler Example, and a couple others that were online. Unfortunately, a real-world project is quite a bit more complicated, and I'm struggling somewhat with the jump from example code to generating my own system.
02-26-2013 12:36 AM
Mike,
Have you thought about making your device an actor(model in MVC structure) instead of the Listener/interface? The controller would then send/receive messages to and from the device actor. A UI base class to generate events based on messages received from the controller could then be subclassed to handle the messages differently for different UIs.
02-26-2013 10:59 AM
Hi, I believe you should store these settings within the Controller Actor. Having a copy of the setting in UI Actor could result a bad coherency. In my opinion, UI Actor should be used only for the display and the user interaction purpose. The source of the displaying data must always come from Controller, but not UI Actor itself.
Let's say you have a UI Actor (with a single boolean display and a numeric control) and a Controller Actor that communicate with each other. Even controls (not only indicators) should be under the Controller Actor's control. Then you can have a structure like this:
UI Actor (Assuming your UI is Actore Core.vi)
Controller Actor
This is what I would do, but I am also new to Actor Framework so I may want to hear an opinion from others.