PDA

View Full Version : Maintaining Persistent State



MarkH
August 7th, 2006, 07:41 PM
Is there a tried-and-true approach for maintaining persistent state with Girder 4.0?

I have an older Samsung DLP TV set that does not have discrete codes for selecting inputs. I have three sources connected to the set -- "Component 2", "Component 3" and "PC". The Samsung insists that "Antenna" is also present, even though I have no OTA antenna connected. To choose an input source using the Samsung remote, I press the "Input" key then use the arrow keys to navigate up or down to the appropriate source, then press the "Enter" key to select that source. Learning the IR codes for these four actions is straightforward -- but I am completely new to Girder, and don't see the best way to maintain the state of the selected input source inside Girder (even following a reboot of the PC). The effect I'm after is to be able to use my Firefly remote and press "Video", then have the appropriate combination of IR codes emitted from my USB-UIRT to select the Samsung input source menu, navigate up or down as appropriate to (in this case) the "Component 3" source, then emit the "Enter" code. There are four possible states (Antenna, Component 2, Component 3, PC) and the navigation from any of these sources to any other is simple to enumerate -- but for this to work robustly, I need to have a way to persist the state of the input source inside Girder. (For those of you with programming background, this is simply a small finite-state machine). I suspect the answer lies with using the ptable library, but I'm so new to Girder (and never heard of Lua before now) so I thought I'd ask before heading down this road. Is there a simpler way to do this?

-M.

Promixis
August 9th, 2006, 12:49 PM
Mark,

It will be very hard to keep this in sync :(

Any serial port on that TV?

PTable is one way to do this.

MarkH
August 9th, 2006, 02:38 PM
It does have a serial port, but it's an significantly older unit than the Samsung set that someone here did a serial device .lua controller for. It's worth trying, certainly and I will.

Thanks for the reply.

-M.

Mark F
August 10th, 2006, 06:39 AM
Persistant state is a pain. Changes to the actual TV state, outside of Girder, are usually a major problem.

Another possibility ...

You really just need to know the current state before moving to a new state. Or said a different way, if you can force a known state, you can get to any other state. In some TVs this can be accomplished by using the channel up or down code to force the TV to the "antenna" state before using the menus to choose another state. In this scheme, you don't keep track of the current state at all and always start a state change by forcing the "antenna" state first.

Does this make sense? Could this be applied to your situation?

MarkH
August 10th, 2006, 08:01 AM
It makes tremendous sense -- until you discover that "Antenna" (the top selection) wraps around to the bottom selection on an UP arrow command :(

You've gotta hand it to the UI designers for making our lives difficult....

-M.

Rob H
August 10th, 2006, 08:55 AM
Another possibility is to use a USB-UIRT to watch the commands from the original remote and track what the current state of the device is. Not much fun, and still doesn't cope with power failure too well.