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

<  TAP and patch development  ~  Detecting shutdown event in the event handler

Page 1 of 1
Geoff Bacon
Posted: Wed Jul 09, 2014 2:20 pm Reply with quote
Frequent contributor Joined: 12 Jan 2007 Posts: 4351
Can anyone post an example of how to handle toppy shutdown in the event handler (I have searched the site and, apart from some references to RKEY_Power event, I haven't found anything usable).

Basically, I want my tap to detect the event and set a flag. I can then poll this flag within my loops to see if the tap should exit.

Another possibility is that my tap responds with "give me more time"; this is discussed but gives no idea of the mechanism (I suspect it down to the return value from the event handler).

Finally, as my code is looping in a routine called from the event handler, do I need to TAP_ExitNormal (or TAP_EnterNormal) to allow another event to be processed? (I know about re-entrancy)

Cheers
Geoff

_________________
TopManager program
TF5800, TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+EvEzPfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; PruneEPG 1.0; fsSave 1.1; QuickJump 1.72; SecCache (UK) v0.4; EIT Sub (Game) v0.6; EPG2MEI v0.96; MyStuff 6.6; Bookmark 3.0; Extend v1.7; Font Manager 1.0d; MyInfo B5.6; MHEG On/Off A3;
Sig generated by EMJB's MyInfo.tap on 29/12/18
View user's profile Send private message Visit poster's website
BobD
Posted: Wed Jul 09, 2014 3:09 pm Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
MyStuff used ShutDownFns.c/.h ("Version X5, code extracted from FireBird's SDS code by EMJB") to modify various elements of shutdown (eg cancel, change Front Panel display, cause a shutdown etc). It delays shutdown by detecting a shutdown request, canceling it, and setting a timer for when it wants to do the shutdown, at which point it used these functions to initiate a shutdown.

I can send you a copy of these files if EMJB agrees and if you can't find them anywhere else. No idea where I originally got them from, but it could have been directly from EMJB.

MS detects a shutdown request by:

Code:

if(event==EVT_KEY)
{   
   if(param1==0x1001f) // RKEY_Power handled by internal SDS
   {
         // Shutdown request
    }
}


Exit/EnterNormal should only be required if you are displaying an OSD and want to stop other TAPs from doing so. Other events will be processed by other TAPs as a result of you exiting your event handler.

_________________
FW: ChunkyWizard Recommended
TAPs:
MyStuff (always one version ahead of everyone else!), and recommended support TAPS
MyStuff skins, manual and latest version: http://www.BobDsMyStuff.co.uk
Known bugs & forthcoming fixes: http://www.BobDsMyStuff.co.uk/Bugs.shtml
Changes coming in the next version: http://www.BobDsMyStuff.co.uk/NextVersion.shtml
View user's profile Send private message Visit poster's website
Geoff Bacon
Posted: Wed Jul 09, 2014 3:43 pm Reply with quote
Frequent contributor Joined: 12 Jan 2007 Posts: 4351
@Bobd

Many thanks; I'll contact EMJB (if he doesn't contact me first).

One last question:-
After detecting the shutdown event, do you know if I exit the handler with a return(0) or a return( second arg of handler routine)? (Thinking about it, I suspect it is the latter as an 0 would indicate that the tap had consumed the key and this would probably prevent other taps seeing the event).


Geoff

_________________
TopManager program
TF5800, TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+EvEzPfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; PruneEPG 1.0; fsSave 1.1; QuickJump 1.72; SecCache (UK) v0.4; EIT Sub (Game) v0.6; EPG2MEI v0.96; MyStuff 6.6; Bookmark 3.0; Extend v1.7; Font Manager 1.0d; MyInfo B5.6; MHEG On/Off A3;
Sig generated by EMJB's MyInfo.tap on 29/12/18
View user's profile Send private message Visit poster's website
BobD
Posted: Wed Jul 09, 2014 5:59 pm Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
Yeah, return (param1) if you allow the shutdown to continue, but if you cancel/delay it then return (0) to stop other TAPs closing themselves down needlessly.

_________________
FW: ChunkyWizard Recommended
TAPs:
MyStuff (always one version ahead of everyone else!), and recommended support TAPS
MyStuff skins, manual and latest version: http://www.BobDsMyStuff.co.uk
Known bugs & forthcoming fixes: http://www.BobDsMyStuff.co.uk/Bugs.shtml
Changes coming in the next version: http://www.BobDsMyStuff.co.uk/NextVersion.shtml
View user's profile Send private message Visit poster's website
Geoff Bacon
Posted: Wed Jul 09, 2014 6:21 pm Reply with quote
Frequent contributor Joined: 12 Jan 2007 Posts: 4351
@Bobd

many thanks for that

Geoff

_________________
TopManager program
TF5800, TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+EvEzPfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; PruneEPG 1.0; fsSave 1.1; QuickJump 1.72; SecCache (UK) v0.4; EIT Sub (Game) v0.6; EPG2MEI v0.96; MyStuff 6.6; Bookmark 3.0; Extend v1.7; Font Manager 1.0d; MyInfo B5.6; MHEG On/Off A3;
Sig generated by EMJB's MyInfo.tap on 29/12/18
View user's profile Send private message Visit poster's website
BobD
Posted: Wed Jul 09, 2014 11:37 pm Reply with quote
MyStuff Team Joined: 03 Aug 2005 Posts: 4218
Files sent.

_________________
FW: ChunkyWizard Recommended
TAPs:
MyStuff (always one version ahead of everyone else!), and recommended support TAPS
MyStuff skins, manual and latest version: http://www.BobDsMyStuff.co.uk
Known bugs & forthcoming fixes: http://www.BobDsMyStuff.co.uk/Bugs.shtml
Changes coming in the next version: http://www.BobDsMyStuff.co.uk/NextVersion.shtml
View user's profile Send private message Visit poster's website
Geoff Bacon
Posted: Wed Jul 09, 2014 11:55 pm Reply with quote
Frequent contributor Joined: 12 Jan 2007 Posts: 4351
Files have arrived.

Many thanks

Geoff

_________________
TopManager program
TF5800, TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+EvEzPfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; PruneEPG 1.0; fsSave 1.1; QuickJump 1.72; SecCache (UK) v0.4; EIT Sub (Game) v0.6; EPG2MEI v0.96; MyStuff 6.6; Bookmark 3.0; Extend v1.7; Font Manager 1.0d; MyInfo B5.6; MHEG On/Off A3;
Sig generated by EMJB's MyInfo.tap on 29/12/18
View user's profile Send private message Visit poster's website
Geoff Bacon
Posted: Thu Jul 10, 2014 2:37 pm Reply with quote
Frequent contributor Joined: 12 Jan 2007 Posts: 4351
Just to complete the picture; it looks like I didn't need the files, just the information about the event handler.

Still, (I think) I now know how it works.

Geoff

_________________
TopManager program
TF5800, TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+EvEzPfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; PruneEPG 1.0; fsSave 1.1; QuickJump 1.72; SecCache (UK) v0.4; EIT Sub (Game) v0.6; EPG2MEI v0.96; MyStuff 6.6; Bookmark 3.0; Extend v1.7; Font Manager 1.0d; MyInfo B5.6; MHEG On/Off A3;
Sig generated by EMJB's MyInfo.tap on 29/12/18
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT + 1 Hour
Page 1 of 1

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