Parsing Projector Feedback Data
TUTech
Posts: 70
I have some Feedback data that I have to parse. First I have the Running Sense that tells me if the projector is idling, on, warming or cooling and the Input and then I have the Lamp information.
The Running Sense looks like this. $20,$85,$00,$D0,$01,$SS,$II,CKS where $SS is the Power Status and $II is the Input.
$SS $00=Idle, $03=Warming, $04=Power On, $05=Cooling
$II $01=HDMI, $11=Component, $06=Video, $0B=S-Video
I can do
DATA_EVENT [dvProj]
{
STRING:
{
IF (LENGTH_STRING(data.text))
{
SELECT
{
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$00",1)):
PPwr=P_OFF
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$03",1)):
PPwr=P_Warming
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$04",1)):
PPwr=P_On
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$05",1)):
PPwr=P_Cooling
}
}
}
}
That will tell me the running sense, but to check the input I would have to do the Select / Active 16 times. Is there an easier way to sort out the input by looking at the 7th bit? Can I put a wild card or something in for bit 6?
Select
{
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$??, $01",1)): //Input HDMI
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$??,$11",1)): //Input Component
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$??,$06",1)): //Input Video
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$??,$0B",1)): //Input S-Video
}
Then I have to do the Lamp Time, which looks like this. $23,$8C,$00,$04,$XX,$XX,$XX,$XX, CKS Where $XX is the Lamp Time in Seconds. I have to take bits 5 to 8 and reverse them, convert from Hex to Decimal and add them up.
$23,$8C,$00,$04,$30,$2A,$00,$00,CKS to 00 00 2A 30 equals 10800 seconds or 3 hours.
The Running Sense looks like this. $20,$85,$00,$D0,$01,$SS,$II,CKS where $SS is the Power Status and $II is the Input.
$SS $00=Idle, $03=Warming, $04=Power On, $05=Cooling
$II $01=HDMI, $11=Component, $06=Video, $0B=S-Video
I can do
DATA_EVENT [dvProj]
{
STRING:
{
IF (LENGTH_STRING(data.text))
{
SELECT
{
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$00",1)):
PPwr=P_OFF
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$03",1)):
PPwr=P_Warming
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$04",1)):
PPwr=P_On
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$05",1)):
PPwr=P_Cooling
}
}
}
}
That will tell me the running sense, but to check the input I would have to do the Select / Active 16 times. Is there an easier way to sort out the input by looking at the 7th bit? Can I put a wild card or something in for bit 6?
Select
{
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$??, $01",1)): //Input HDMI
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$??,$11",1)): //Input Component
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$??,$06",1)): //Input Video
ACTIVE (FIND_STRING(data.text,"$20,$85,$00,$D0,$01,$??,$0B",1)): //Input S-Video
}
Then I have to do the Lamp Time, which looks like this. $23,$8C,$00,$04,$XX,$XX,$XX,$XX, CKS Where $XX is the Lamp Time in Seconds. I have to take bits 5 to 8 and reverse them, convert from Hex to Decimal and add them up.
$23,$8C,$00,$04,$30,$2A,$00,$00,CKS to 00 00 2A 30 equals 10800 seconds or 3 hours.
0
Comments
One way would be to use the SELECT ACTIVE for the power on, remove that string (REMOVE_STRING) and use the next byte (GET_BUFFER_CHAR) for a switch case to determine the input.
I'm not going to provide code: that's cheating...
When looking at feedback strings can I put something in there where I don't care what bit 6 is but I need to know what 7 is?
This is going to take some time to figure out how to process the Lamp Time.
David
I overlook the obvious.
Here is my suggestion: You notice that there is a constant set of bytes that is the header for the returned string. Look for these bytes and when you find them remove them from data.text. At that point you know the response is one that you are looking for and the data you want is only a byte or two away. There are lots of string manipulation commands available to use other than just Find_String.
-Danny
Why not? The input and power are completely different and unrelated states. If the projector is off, and someone turns it on, it may be useful to know what the current input is so you don't need to change it if its already on that input, thus preventing a screen blank/refresh, or input OSD menu, etc. My policy is always get and store as much data as you can about whatever device you are controlling.
Paul
Because most projectors don't response to much else than a power query when not on. And even if they did it wouldn't be of much use, since your not projecting anything. Of course you should ask the input state as soon as the projectors allows for it, that's when it turn on, or soon thereafter.
Richard