PDA

View Full Version : IR Codes translated into nice names



Ben Cook
2005-04-08, 00:11
Posted on behalf of a friend:

Hello,

I am playing around with XPLHal again having lost all of my config in a
drunken rage. I have everything working to my satisfaction apart from
translating IR hex codes into recognisable names.

What I have done so far is:

Change the default.map to enable buttons 0 to 9 when the player is OFF.

I have named these buttons = NUM0OFF, NUM1OFF etc.

This has worked beautifully and when my SBG is OFF and I press 1 on the
remote I see two TRIG events in the XPL Monitor:

Event 1:

zone=slimserver

device=KITCHEN

keys=7689f00f

power=off

Event 2:

zone=slimserver

device=KITCHEN

keys=NUM1OFF

power=off

What I now wish to do is reference the "keys" parameter in a script.

E.g.:

if lcase(xpl.getparam(XplMsg,"keys",true)) = "NUM1OFF" Then

This does not appear to work. If I replace NUM1OFF with the HEX code,

i.e.:

if lcase(xpl.getparam(XplMsg,"keys",true)) = "7689f00f " Then

It _does_ work. I am certain that there is something I have to do to be able
to use the nice name rather than the HEX, but I cannot remember, or find
what it is. Can anyone clear this up for me?

Thanks

John

Robbert Heederik
2005-04-08, 04:36
On Fri, Apr 08, 2005 at 08:11:58AM +0100, Ben Cook wrote:
> What I now wish to do is reference the "keys" parameter in a script.
>
> E.g.:
>
> if lcase(xpl.getparam(XplMsg,"keys",true)) = "NUM1OFF" Then
>
> This does not appear to work. If I replace NUM1OFF with the HEX code,
>
> i.e.:
>
> if lcase(xpl.getparam(XplMsg,"keys",true)) = "7689f00f " Then
>
> It _does_ work. I am certain that there is something I have to do to be able
> to use the nice name rather than the HEX, but I cannot remember, or find
> what it is. Can anyone clear this up for me?

Hi Ben/John,

I have no experience with XPLHal, but it looks like you are comparing
a lowercased version of the "keys" parameter with a string that is
all uppercase. That would always fail. Try removing the lcase
call or lowercasing the NUM1OFF string.

E.g.:

if lcase(xpl.getparam(XplMsg,"keys",true)) = "num1off" Then

Hope this helps.

Robbert.
--
Robbert Heederik Universiteit van Amsterdam, Faculteit der
Natuurwetenschappen, Wiskunde en Informatica
"Who are the
brain police?" - FZ <URL:http://www.science.uva.nl/~robbert/>