I usually have a
TCP Client to connect to the projector, this sends and receives requests.
Then you use an
Event Listener to listen to those responses from the projectors.
Then in the Event Listener, you'd send the projectors' responses to a function to do the work.
Because you need 1 Event Listener per projector/TCP Client, you can add an "ID" to each Event Listener, for example:
- Code: Select all
YourProjectorFunction("Projector1", MessageReceived)
Then inside of that function, you'd use the functionality that Martina suggested, this is a generic example as I don't know what the responses from your projectors look like. I'm going to assume that it's PJ Link and this is the example for a shutter.
- Code: Select all
//Set the variables from the parameters passed to the function
//One is the message from the projector
//One is the Projector's ID
var thisMessage = MessageReceived.ToString
var thisProjector = ID.ToString
//PJ Link returns a string like: "%1AVMT=30" - we need the value after the "=" sign.
//we use the ".Split" command to make this an 'array' or a 'list' of values using the "=" sign as the known symbol to switch from:
var projReturn = thisMessage.Split("=")
//this variable would look like: ["%1AVMT", 30]
//projReturn[0] is "%1AVMT"
//projReturn[1] is "30"
//Now - we're looking at the whole projector return - does it have AVMT in it? IF it does, we know it's the shutter!
if thisMessage.Contains("AVMT") {
DebugMessage("This is a shutter message!")
//What is the value of the message that we split?
if projReturn[1] = 30 {
//Shutter is open!
DebugMessage(thisProjector, "Shutter OPEN!")
} else {
//Shutter is Closed!
DebugMessage(thisProjector, "Shutter CLOSED!")
}
}
I know this is a lot!
Please let me know if I can clarify this anymore!