For discussions about development of TAPs, patches and other software for the Toppy

Moderator: Technical

Post Reply
Geoff Bacon
Frequent contributor
Posts: 4663
Joined: Fri Jan 12, 2007 12:21 am
Location: Bristol
Contact:

Detecting shutdown event in the event handler

Post by Geoff Bacon »

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+EvEzPePfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; MHEG On/Off A3; QuickJump 1.72; EIT Sub (Game) v0.6; SecCache (UK) v0.4; EPG2MEI v0.96; Font Manager 1.0d; Extend v1.7; WSSkiller V2.12d; MyInfo B5.6; fsSave 1.1; PruneEPG 1.0; MyStuff 6.6-1;
Sig generated by EMJB's MyInfo.tap on 3/5/21
BobD
MyStuff Team
Posts: 4220
Joined: Wed Aug 03, 2005 12:21 pm
Contact:

Post by BobD »

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: Select all

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
Geoff Bacon
Frequent contributor
Posts: 4663
Joined: Fri Jan 12, 2007 12:21 am
Location: Bristol
Contact:

Post by Geoff Bacon »

@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+EvEzPePfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; MHEG On/Off A3; QuickJump 1.72; EIT Sub (Game) v0.6; SecCache (UK) v0.4; EPG2MEI v0.96; Font Manager 1.0d; Extend v1.7; WSSkiller V2.12d; MyInfo B5.6; fsSave 1.1; PruneEPG 1.0; MyStuff 6.6-1;
Sig generated by EMJB's MyInfo.tap on 3/5/21
BobD
MyStuff Team
Posts: 4220
Joined: Wed Aug 03, 2005 12:21 pm
Contact:

Post by BobD »

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
Geoff Bacon
Frequent contributor
Posts: 4663
Joined: Fri Jan 12, 2007 12:21 am
Location: Bristol
Contact:

Post by Geoff Bacon »

@Bobd

many thanks for that

Geoff
TopManager program
TF5800, TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+EvEzPePfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; MHEG On/Off A3; QuickJump 1.72; EIT Sub (Game) v0.6; SecCache (UK) v0.4; EPG2MEI v0.96; Font Manager 1.0d; Extend v1.7; WSSkiller V2.12d; MyInfo B5.6; fsSave 1.1; PruneEPG 1.0; MyStuff 6.6-1;
Sig generated by EMJB's MyInfo.tap on 3/5/21
BobD
MyStuff Team
Posts: 4220
Joined: Wed Aug 03, 2005 12:21 pm
Contact:

Post by BobD »

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
Geoff Bacon
Frequent contributor
Posts: 4663
Joined: Fri Jan 12, 2007 12:21 am
Location: Bristol
Contact:

Post by Geoff Bacon »

Files have arrived.

Many thanks

Geoff
TopManager program
TF5800, TS On, F/W: MS6 Recommended F/W 12/9/2009 -Sy+EvEzPePfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; MHEG On/Off A3; QuickJump 1.72; EIT Sub (Game) v0.6; SecCache (UK) v0.4; EPG2MEI v0.96; Font Manager 1.0d; Extend v1.7; WSSkiller V2.12d; MyInfo B5.6; fsSave 1.1; PruneEPG 1.0; MyStuff 6.6-1;
Sig generated by EMJB's MyInfo.tap on 3/5/21
Geoff Bacon
Frequent contributor
Posts: 4663
Joined: Fri Jan 12, 2007 12:21 am
Location: Bristol
Contact:

Post by Geoff Bacon »

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+EvEzPePfUUuZ
TAPs: PcControl B1.4; StopExit v1.01; MHEG On/Off A3; QuickJump 1.72; EIT Sub (Game) v0.6; SecCache (UK) v0.4; EPG2MEI v0.96; Font Manager 1.0d; Extend v1.7; WSSkiller V2.12d; MyInfo B5.6; fsSave 1.1; PruneEPG 1.0; MyStuff 6.6-1;
Sig generated by EMJB's MyInfo.tap on 3/5/21
Post Reply