This page last changed on Dec 08, 2011 by fuijtdewilligen.
I've run into a problem with one of my remotes. Apparently, it sends our alternating IR-codes for each button to differentiate between multiple presses and a long press. For example (I'm using the iTach IP2IR), if I press the 'right'-button 4 times:
I haven't found a solution for it within the OR Designer, so I'd be happy to hear from someone who has a clue on how to handle this
For all who's interested, I've managed to get it working by changing some code of the Controller. In short, I created a TCP/IP command in the Designer and added both alternatives of the IR-commands behind each other, separated by "##". The entire command thus looks as follows:
I've adapted the Controller to check whether the separator (##) exists. If so, it checks which command was sent the last time and sends the other.
For those with more knowledge of the Controller code: I've adjusted the TCPSocketCommandBuilder to check for the separator. If it finds the separator, it creates a TCPSocketAlternatingCommand, which extends the TCPSocketCommand. That class overrides the getCommand() and setCommand() to enable the alternating of the IR commands.
Because the command objects are created with each button press, and thus not keep any state, I've also created a AlternatingCommandStates with a single static method, getState() which takes the name of the command as a parameter and returns a boolean, alternating with each call.
As I found out, the commands do not have a name in the xml, and thus, the name field of the object remains empty. Therefore, I've added another small modification to the TCPSocketCommandBuilder that puts the ID of the command in the name field if the name was null or empty.
Posted by fuijtdewilligen at Dec 10, 2011 16:38