Using Flags to Emulate Discrete Power Buttons

General Discussion on DemoPad or related products
Post Reply
raylinds
Posts: 4
Joined: Mon Oct 29, 2012 10:26 pm

Using Flags to Emulate Discrete Power Buttons

Post by raylinds » Tue Nov 20, 2012 5:31 pm

I have two devices for which I cannot find discrete power codes, including my Motorola cable STB. This would be problematic for switching between activities where devices would end up getting turned off or on when they should not be.

Here is what I did:
1. Created a flag titled CablePower.
2. In the Watch TV Activity startup button, I created a command to send a power toggle command depending on CablePower flag being "OFF".
3. After a short delay, set the CablePower flag to "ON" if flag is "Off".
4. In the All Power Off activity button, I send a command to send a power toggle command depending on CablePower flag being "On".
5. After a short delay, set the CablePower flag to "OFF" if flag is "ON".
6. On the Cable device remote page I created an On Power and Off Power buttons.
7. In the On Power button, I created a command to send a power toggle command depending on CablePower flag being "OFF".
3. After a short delay, set the CablePower flag to "ON" if flag is "OFF".
4. In the Power Off, I send a command to send a power toggle command depending on CablePower flag being "On".
5. After a short delay, set the CablePower flag to "OFF" if flag is "ON".

So basidally what I do is press the power button only if the power flag is in the proper state, and then update the flag to the current state. It seems to be working so far. The trick was to ensure the correct begining state for the flag. I could not set the flag to off when the app is launched since it would always set it to off when I reopened the app after the iPad went to sleep. So I created a page with buttons to set the flag on or off. So far I only used it for the intiial setting, and will remove the page if it continues to operate as expected.

I hope this helps!

Ray

User avatar
DemoPad
Site Admin
Posts: 769
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Re: Using Flags to Emulate Discrete Power Buttons

Post by DemoPad » Tue Nov 20, 2012 5:44 pm

If you use the app setting 'remember last page', then when the app restarts the flags will be as they were when you shut the app down - or if you have multitasking turned on, the flags will stay the same anyway. This approach doesn't help when you have multiple iPads though....(or people using manual remotes!)

In cases where you cannot find discrete power commands, you can sometimes use other commands, eg to power off certain set top boxes (regardless of whether they are on or not), you can send the 'guide' command followed by the 'power toggle' command. If it was already off, the guide command turns it on, and the power toggle command turns it off. If it was on, the guide command just opens the TV guide first, then the power toggle command turns it off. Similarly you can send the 'guide' command followed by 'exit' to turn the box on.

Not ideal...but might help

Idealhomes
Posts: 144
Joined: Mon Jul 16, 2012 3:35 pm
Location: New Zealand
Contact:

Re: Using Flags to Emulate Discrete Power Buttons

Post by Idealhomes » Wed Nov 21, 2012 8:36 am

And the ultimate way..........

GC-SV1 Video Out Sensor

:mrgreen:
"Setting the Standard in Quality and Commitment"

Post Reply