Parsing strings to turn off or on transport controls
Angelo_One
Posts: 9
Trying to parse these two strings (below) coming back from a device to turn off or on transport control buttons. The command that I am sending works when I send it via Control a Device under the Diagnostics tab. Is there something that I'm missing or doing incorrect? Any advice would be greatly appreciated! Thank you in advance
DATA_EVENT [dvDVD_CD]
{
STRING:
{
LOCAL_VAR INTEGER cPowerStatus
LOCAL_VAR CHAR cDATA [100]
cDATA = DATA.TEXT
IF (FIND_STRING (cDATA,'$11,$02,$0D',1))
{
SEND_COMMAND dvTP_DVD_CD, "'^SHO-44.49,0'"
}
ELSE IF (FIND_STRING (cDATA,'$11,$01,$0D',1))
{
SEND_COMMAND dvTP_DVD_CD, "'^SHO-44.49,1'"
}
}
}
DATA_EVENT [dvDVD_CD]
{
STRING:
{
LOCAL_VAR INTEGER cPowerStatus
LOCAL_VAR CHAR cDATA [100]
cDATA = DATA.TEXT
IF (FIND_STRING (cDATA,'$11,$02,$0D',1))
{
SEND_COMMAND dvTP_DVD_CD, "'^SHO-44.49,0'"
}
ELSE IF (FIND_STRING (cDATA,'$11,$01,$0D',1))
{
SEND_COMMAND dvTP_DVD_CD, "'^SHO-44.49,1'"
}
}
}
0
Comments
Your use of single quotes in the find_string command is likely to trip you up. It sounds like you are looking for hex characters not ASCII representation of hex characters. If the former is what you are trying to do use double quotes and see if that works better.
Paul
cData = "cData,Data.Text";
Just in case there's a hiccup with the sending device.
Now in your find_string you're using single quotes when you should be using doubles.
I made the change to double quotes in place of the sungle quotes and the code is running now. Thanks for the input. You guys are awesome here.
I made the change to double quotes in place of the sungle quotes and the code is running now. Thanks for the input. You guys are awesome here.