Click here to go to the forum index Click here for the home page
 
Author Message

<  TAP and patch development  ~  Passing Keys onto next TAP

Page 1 of 3
Goto page 1, 2, 3  Next
BobD
Posted: Wed Aug 10, 2005 12:14 am Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
Hi

I am starting to write my first TAP, but have hit the first problem that I haven't been able to solve after a while. All the others I have cracked after hunting through the manual and sample TAPs.

How do I do something on a key press but still allow other TAPs to get the key press message?

Also, is there any way I can get my TAP to get key presses even if someother TAP got them first (or connected to the first question, how do I make sure my TAP gets the messages first, and can then pass them on?)

Thanks in advance!
View user's profile Send private message Visit poster's website
Darkmatter
Posted: Wed Aug 10, 2005 12:29 am Reply with quote
Forum moderator Joined: 21 Mar 2005 Posts: 1237
Right, a mixed bad of answers ? some good, some bad:

First the good ? passing on key strokes is easy, just return them before exiting TAP_EventHandler, something like this:

Code:
 //----------------------------------------
// Standard event handler
//
dword TAP_EventHandler( word event, dword param1, dword param2 )
{
   dword returnKey;
   returnKey = param1;

   switch(event)
   {
      case EVT_IDLE :   My_IdleHandler();
                  break;

      case EVT_KEY :   returnKey = My_KeyHandler(param1, param2);
               break;

      default :       break;
   }
   return (returnKey);
}


One thing to watch out for ? our Toppy?s manage the key parameter, they remap keys on the way in, and map certain keys back again when the TAPs are done. Topfield have attempted to remap the buttons on our remote, to the keycodes expected of existing TAPs (those written for the TF5000). It?s far from an ideal situation, but we get by.

Right, now for the bad news: There is no guaranteed way of ensuring which TAP ends up first in the key chain. Most of the time, it?s the one that has been loaded first on the HDD, but it often fails.

In the early days, the key mapping algorithm (see above) didn?t work, and I needed to write a TAP that acted as a task scheduler and key distributor - it?s called Program Manager. That got us underway with TAP development, but was far from an elegant solution.

Out of interest what are you having a stab at developing?
View user's profile Send private message
tonymy01
Posted: Wed Aug 10, 2005 7:23 am Reply with quote
Frequent contributor Joined: 23 Mar 2005 Posts: 243 Location: Sydney, Australia. Toppy 5K owner.
There has been some discussions about "inter-tap comms" to allow one tap to tell another "this has been pressed" or whatever. There have been a couple of solutions proposed, a neat one being returning the comms param in the 2nd item in the event handler (see the Aussie forums).
Also TSR_commander has some extensions to allow intertap comms, although you have to keep sweeping RAM to find the landingzone (well, this is how TSR_commander itself finds the tap details that are supported by TSR_commander each time you hit the key to bring up the tap list). I guess you only need to sweep once and have a pointer after that, it will probably work ok like this.
Regards

_________________
Tony H.
Capturing, DVD creating, TAPs and other Topfield info for DVB-T HD & SD caps, pics, links etc using the TF5000PVR
View user's profile Send private message Visit poster's website Yahoo Messenger
BobD
Posted: Wed Aug 10, 2005 11:14 am Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
Thanks for the answers folks.

Darkmatter wrote:
case EVT_KEY : returnKey = My_KeyHandler(param1, param2);

I thought this was it, and so on a key press my TAP_EventHandler returns the param1 passed in, but this still doesn't work. When I press Play during playback my TAP does what I want it to (see below), but the progress bar does not appear. Ah, could that be because its is the Toppy itself that displays the progress bar, and not a TAP? Just thought of that (it was late when I stopped writing it, and posted the question last night!)

OK, so I may have a problem with getting all key presses. A new way of perhaps doing this has occured to me (again see below). But the original questions may not be relevant now. Thanks anyway!

Tonymy01 - not sure I follow your reply! I've only just started TAP programming (although I am a computer programmer by trade, but I have to admit I just dived straight in without much reading first, thats how I like to learn)

So, the TAP itself.

I am writing a TAP that will display in the corner a box showing how far through, and what remaining time, there is in the currently being viewed recording (or, later when it works, in the current timeshift). My idea was to make it like the Sky+ circle box (and a bit like the Toppy circle) that appears bottom left.

So, I wanted it to get Play, Rewind, FastForward and colour keys (as I use QuickJump TAP), and on those keys bring itself up for eg 5 seconds, updating its display all the time to show where in the recording I am.

And it all works really well, if it was already visible. Problems were that it hijacked the play key (no progress bar), and didn't appear on colour keys (as I assume QuickJump got them, and didn't pass them on to me). Hence the questions.

However, I have just thought that perhaps instead I will code it differently, so that:

1) It stores where it thinks the user should be in the recording (ie where they were last time it was called in idle processing)
2) If called again in idle, and the current position is not where it thinks it should be, then display itself for 5 seconds (or until the position changes too much again)

That would work (I think) and would not need any key presses!

I like it!

Thanks again. I'm now off for a quick rewrite.

God I love my Toppy!

Cheers
View user's profile Send private message Visit poster's website
BobD
Posted: Wed Aug 10, 2005 11:26 am Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
Hey, it works!

Cool. A few problems with screen displays but the principle works!

Cheers
View user's profile Send private message Visit poster's website
Darkmatter
Posted: Wed Aug 10, 2005 12:10 pm Reply with quote
Forum moderator Joined: 21 Mar 2005 Posts: 1237
BobD wrote:
...When I press Play during playback my TAP does what I want it to (see below), but the progress bar does not appear. ....

Ah, there are 2 possible reasons why the progress bar didn?t pop up:

The first is as you say, the key didn?t make out the bottom of the key chain in to the Toppy?s own key handler.

The second is to do with the way the Toppy handles exclusive mode. Yes, it does have such a thing, although it?s not obvious from reading the API document.

Executing TAP_ExitNormal(); forces exclusive mode. Only your TAP will receive the keys. Usually, a TAP has one main activation key (GUIDE for example), it?s sits there waiting and looking for that one key. Once detected, it exits the normal state, and from that point onwards it has complete access to the whole keyboard (remote control). No other TAP is passed keys.

There?s a tad more to it than that. EVT_KEY is still generated for each key pressed, and that occurs for all TAPs, irrespective of whether any TAP has exited the normal state, or not. Everyone gets the EVT_KEY event. However, once TAP_ExitNormal has been executed, all other TAPs get their keys forced to zero, i.e. param1 = 0.

You have to be wary of that one. Don?t do too much processing under these conditions, or you?ll slow down other TAPs.

I see you?re going down a different route, but I hope that helps.
View user's profile Send private message
Darkmatter
Posted: Wed Aug 10, 2005 12:13 pm Reply with quote
Forum moderator Joined: 21 Mar 2005 Posts: 1237
I forgot to add: Executing TAP_ExitNormal(); also inhibits the Toppy?s On Screen Displays (OSD). Things like the volume bar, infobox, and progress bar won?t appear.
View user's profile Send private message
BobD
Posted: Wed Aug 10, 2005 12:19 pm Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
Thanks Darkmatter. That helps me understand what happened before. I had started from one of the sample apps, which used Enter/ExitNormal, so yeah that was probably why the progress bar did not show. I have now removed those calls.

Its looking good. It pops up whenever I want it to (with the one exception so far of when in pause mode, but I'm working on it).

The only odd problem now is that when my popup is told to disappear, it seems to shift itself to top left of the screen (well, just above that actually) so there is a (permanent) ghost image of the bottom half of my popup at the top left of the screen.

I use OSD_CreateRgn to a static var, then on each idle I do OSD_PutS and when it has been up for 5 seconds I just do an OSD_DeleteRgn. This does hide my popup, but seems to have this effect of creating the onscreen blob.

Should I be doing something more than DeleteRgn when I am done?

Thanks for your help.

Cheers
View user's profile Send private message Visit poster's website
Darkmatter
Posted: Wed Aug 10, 2005 12:29 pm Reply with quote
Forum moderator Joined: 21 Mar 2005 Posts: 1237
No, that should do the trick.

In the beginning, I defined different regions for displaying certain things, but rapidly worked out there is no advantage. They overwrite each other, rather than overlay each other. If you clear, or delete one region, then it clears that bit of the screen, irrespective of the contents of any other active regions.

These days, I just define one region that covers the whole screen, and do all the write to that.
Code:
    TAP_ExitNormal();                                                // Exclusive mode
   rgn = TAP_Osd_Create( 0, 0, 720, 576, 0, FALSE );   // define the whole screen for us to draw on
   TAP_Osd_FillBox( rgn, 0, 0, 720, 576, 0 );               // clear the screen

View user's profile Send private message
BobD
Posted: Wed Aug 10, 2005 3:39 pm Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
Thangs again. Think I've fixed this issue now (I think it was caused by accidentally displaying something on the region that took up more space than the region had (if that makes sense).

I now have another problem (of course). I have found the duration field in the PlayInfo structure, so can find out how long a recording is, but how do I know how long (in minutes rather than bytes) the current timeshifting recording is? PlayInfo has a duration of 0. I can find the length of the file it is using, but I think that bytes per minute might depend on the transmission, so I don't want to use that. Any ideas anyone?

Thanks
View user's profile Send private message Visit poster's website
simonc
Posted: Wed Aug 10, 2005 5:23 pm Reply with quote
Frequent contributor Joined: 12 Apr 2005 Posts: 5639 Location: Cheltenham
Hi Bob, I worked this out for QuickJump - I'll can send you the source if it'll help. I did make a start on a display thingy for QuickJump but drawing the circlular progress indicator plus my toppy being in a different room took the wind out of my sails a little, so if you'd like to incorporate this into QuickJump we can make it a joint effort.
View user's profile Send private message Visit poster's website
chunkywizard
Posted: Wed Aug 10, 2005 5:57 pm Reply with quote
MyStuff Team Joined: 13 May 2005 Posts: 9319 Location: Sindlesham, Berkshire Tx: Hannington
Hi Bob,

sounds really interesting! Let us know when you want some beta testers Very Happy

Cheers

Chunkywizard

_________________
Toppy:TF5800 F/W: 1365PaTcHeD
TAPs: MyStuff | EPG2MEI | FontManager | SecCache UK | Extend | FastScanGUI | EIT_sub_game | MyInfo | ScreenCapture with OSD | MHEG On/Off
MyStuff Manual & Logos | Known Bugs | Recommended F/W
View user's profile Send private message Visit poster's website
BobD
Posted: Wed Aug 10, 2005 9:22 pm Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
simonc wrote:
Hi Bob, I worked this out for QuickJump - I'll can send you the source if it'll help. I did make a start on a display thingy for QuickJump but drawing the circlular progress indicator plus my toppy being in a different room took the wind out of my sails a little, so if you'd like to incorporate this into QuickJump we can make it a joint effort

Hi simonc

Yeah, having mentioned it to you about QuickJump I figured it would be a good way of getting my feet wet and having a play. It is a pain having to go from one room to the next to test, but I'm surviving.

Mine (so far) just uses rectangles on the screen. Haven't worked out how to do a circular display yet, but it does look quite good in a white lined blue box. A joint effort could be cool (though you aint seen my code yet, it may well be awful!), but I'm having so much fun playing with it. If you could send me code to get me over this problem, or just give me a hint, that would be cool, and I can send you mine back when its had a bit of a tidy up! To be honest, there really isn't much code! Its been a lot simpler than I thought it might be (perhaps because I've not done it the right way!), so I'm sure the start you have made will be better.

What is the best way of sending code around anyway? Just by email?

chunkywizard wrote:
sounds really interesting! Let us know when you want some beta testers

I'll keep you posted. Thanks for the encouragement!
View user's profile Send private message Visit poster's website
simonc
Posted: Wed Aug 10, 2005 10:16 pm Reply with quote
Frequent contributor Joined: 12 Apr 2005 Posts: 5639 Location: Cheltenham
It's on my site http://www.geocities.com/simon_capewell/quickjump_src.zip

You'll probably have to muck around with the file paths in build.bat. Does anyone have a standard environment I wonder?


Last edited by simonc on Wed Aug 10, 2005 10:24 pm; edited 1 time in total
View user's profile Send private message Visit poster's website
BobD
Posted: Wed Aug 10, 2005 10:23 pm Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
Cool, thanks very much. That link does not work yet (probably I jumped the gun).

Here is what I have worked out so far though

Keep calling GetRecInfo(j,...) with increasing j's, until it returns a RecInfo with a rectype of Timeshift, then decode the starttime to get an elapsed time since start.

Not finished the code yet, so cant tell if it will work, but fingers crossed!
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT + 1 Hour
Page 1 of 3
Goto page 1, 2, 3  Next

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum