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

<  TAP and patch development  ~  Wake timers: do we need a convention?

Page 1 of 1
shinyford
Posted: Mon Nov 24, 2008 12:52 pm Reply with quote
Frequent contributor Joined: 12 Dec 2005 Posts: 726 Location: London
Hi all

I'm developing two TAPs, iGuide and iGuideSMS. Both of these need to be able to set watch timers to periodically wake the Toppy to do house keeping tasks, such as scan for new EPG information, see if an SMS has arrived and so on.

The problem is, such wake timers can clash with each other. And I am sure other TAPs need to set wake timers too, with more possibility for clashing.

I'm proposing that those TAP developers with a need for a wake timer get a set of conventions together which we agree to code to, to stop clashing causing a problem.

As a start, I'll put up the following rules for discussion.

1. The wake timer always uses the same filename, to aid detection: I use "__wake__.rec", so that's what I'll suggest.
2. TAPs only create one wake timer at a time
3. TAPs periodically check for the existence of a wake timer, if they need such a thing - say, once a minute
4. An existing wake timer is left alone if it is set to come on earlier than required by a TAP
5. An existing wake timer is amended to come on at the desired time, if it is set to come on later than required by a TAP
6. A TAP creates its wake timer if there is not already one in existence

Does anyone else think that this is a good idea? Any other comments?

Cheers

Nic

_________________
iGuide (EPG, now-and-next, series links) and iGuideSMS (sms connectivity for the Toppy) TAPs. Latest manual, alpha spike and beta
View user's profile Send private message Visit poster's website
Andy K
Posted: Mon Nov 24, 2008 12:58 pm Reply with quote
Frequent contributor Joined: 14 Jun 2005 Posts: 3497 Location: Owner of 3 Topfields
mystuff used? to liked it to contain "EPG" so it wouldn't delete it Rolling Eyes
View user's profile Send private message
chunkywizard
Posted: Mon Nov 24, 2008 1:26 pm Reply with quote
MyStuff Team Joined: 13 May 2005 Posts: 9277 Location: Sindlesham, Berkshire Tx: Hannington
MyStuff does have the possibility of setting one of these to wake up for an EPG Scan. As Andy says correctly, we prefix 'EPG' to the name to know it's special. However it is no longer really needed as eit2mei background scan is good enough on 5.12.88 and later. The timer we use is a Watch Timer. Apart from that MyStuff doesn't need any other wake timers.

HTH

CW

_________________
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
shinyford
Posted: Mon Nov 24, 2008 1:32 pm Reply with quote
Frequent contributor Joined: 12 Dec 2005 Posts: 726 Location: London
Yes, I use a watch timer too. What I suggest is that we all agree on conventions for the naming and creation of our watch timers, so that our TAPs can coexist without trashing each other's wakes.

Not that I think MyStuff and iGuide would be coexisting - but MyStuff and iGuideSMS may, at some point; and there will be other TAPs out there with wake requirements - eit2mei? - which also need to make sure they don't clash.

Cheers

Nic

_________________
iGuide (EPG, now-and-next, series links) and iGuideSMS (sms connectivity for the Toppy) TAPs. Latest manual, alpha spike and beta
View user's profile Send private message Visit poster's website
DX
Posted: Mon Nov 24, 2008 2:11 pm Reply with quote
Frequent contributor Joined: 06 Apr 2005 Posts: 2658
Although some of my TAPs can be configured to do periodic activity my "solution" was to let the user create any watch timers manually, so currently none of my TAPs do this themselves. So I don't have any direct interest in this at the moment.

As a general comment however there seems to be an assumption that TAPs can co-exist with a single timer, which I'm not sure will always be the case. Once a day wakeup seems reasonable for an overnight EPG scan but there might be other requirements. e.g.

Perhaps once a week for a TAP that deletes old recordings. Or maybe a TAP that accepts remote commands would want to wakeup several times a day, so have several watch timers.

Another issue might be what a TAP does. In the case of an EPG gathering TAP it may need to switch channels, especially on non-UK firmwares. Running two such TAPs together could be chaotic, so they may well require different watch timers anyway.

Off the cuff I'd say a shared timer would need some caveats.

The TAP expects a single daily timer.

The TAP doesn't depend on a particular time or channel.

The TAP will only increase the duration of an existing timer (if required), never decrease it.

The TAP promises not to do anything intrusive, such as changing channels.

It might be worth considering more than one type of timer. If a TAP has a requirement for switching channels or similar it always creates its own timer. Two such TAPs would therefore create two timers. Non-intrusive TAPs could however piggy-back on an existing exclusive timer, but not modify it in any way, and if none existed then create a shared timer.

We could identify exclusive timers by EPG_xxxxxxxx_yy.rec naming, where xxxxxxxx is the TAP Id and yy allows for more than one timer per TAP.


Last edited by DX on Mon Nov 24, 2008 2:13 pm; edited 1 time in total
View user's profile Send private message
chunkywizard
Posted: Mon Nov 24, 2008 2:13 pm Reply with quote
MyStuff Team Joined: 13 May 2005 Posts: 9277 Location: Sindlesham, Berkshire Tx: Hannington
Hi Nic,

eit2mei isn't used standalone, only with MyStuff. I doubt Bob will change anything in MS in this regard but I guess if you need any wake timers in iGuideSMS then let us know what you call them and we can make sure we don't delete them, or we can just point people at the option you need to set so as not to interfere with Timers set by other TAPs (G2: Set to CTs only)

Cheers

CW

_________________
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
DX
Posted: Mon Nov 24, 2008 2:19 pm Reply with quote
Frequent contributor Joined: 06 Apr 2005 Posts: 2658
chunkywizard wrote:
eit2mei isn't used standalone, only with MyStuff.

Not so Smile

I wrote it specifically to support mei2archive. I believe it is also used with other EPG TAPs, and also by some to collect EPG data for transfer to a PC for further processing.
View user's profile Send private message
glenmcfar
Posted: Mon Nov 24, 2008 2:24 pm Reply with quote
Frequent contributor Joined: 07 Dec 2006 Posts: 4519 Location: Dundonald, Ayrshire, Scotland
...and MeiSearch !!!! Razz

Glen.

_________________
H/W: TF5800 | URC-7555 | Asus | Best Firmware Ever!
A/S: SecCacheUK, EitSub, EPG2MEI, Display, Extend, QuickJump, FontManager, TapLauncher, MyStuff
T/L: TapCommander, Surfer, MeiSearch, MediaManager | HDFW, CutAds, Sudoku
View user's profile Send private message
chunkywizard
Posted: Mon Nov 24, 2008 2:25 pm Reply with quote
MyStuff Team Joined: 13 May 2005 Posts: 9277 Location: Sindlesham, Berkshire Tx: Hannington
Shows what I know Confused Rolling Eyes

Thanks for putting me straight...

CW

_________________
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
shinyford
Posted: Mon Nov 24, 2008 3:05 pm Reply with quote
Frequent contributor Joined: 12 Dec 2005 Posts: 726 Location: London
DX wrote:

As a general comment however there seems to be an assumption that TAPs can co-exist with a single timer, which I'm not sure will always be the case. Once a day wakeup seems reasonable for an overnight EPG scan but there might be other requirements. e.g.

Perhaps once a week for a TAP that deletes old recordings. Or maybe a TAP that accepts remote commands would want to wakeup several times a day, so have several watch timers.


You're absolutely right that there may be other requirements - but that's exactly why I mandated a single timer.

I have iGuide and iGuideSMS running side by side, with different wake requirements. So long as (1) a TAP only does its wake actions a the appropriate time of day, and (2) all TAPs ensure only a single wake timer exists for the next wake event, it all works out okay. That's why a TAP should only change the starttime of a wake event if an existing wake event is later than required. Like this:

* TAP A sets a wake event for 2.00am
* TAP B, which needs to wake at 1.00am, sees it's later than required, so changes it to 1.00am
* TAP A monitors this, sees it's moved to an earlier time, so leaves it alone.
* Come 1.00am, the Toppy wakes, TAP B does its stuff, and sets a new wake timer for the following day at 1.00am
* TAP A sees this, notes that it's after its required wake of 2.00am today, changes the timer to the earlier time
* The wake timer is now set to happen earlier than TAP B's 1.00am tomorrow requirement, so TAP B leaves it alone.
* The Toppy goes back to sleep, rewakes at 2.00am, TAP A does its stuff and the cycle starts again.

Does that make sense? Setting a single, non-recurring wake timer each time its required gets over this problem.

DX wrote:

Another issue might be what a TAP does. In the case of an EPG gathering TAP it may need to switch channels, especially on non-UK firmwares. Running two such TAPs together could be chaotic, so they may well require different watch timers anyway.


That's quite correct. I'd hate to have e.g. MyStuff and iGuide on the same machine, I imagine the results would be awful.

DX wrote:

Off the cuff I'd say a shared timer would need some caveats.

The TAP expects a single daily timer.

The TAP doesn't depend on a particular time or channel.

The TAP will only increase the duration of an existing timer (if required), never decrease it.

The TAP promises not to do anything intrusive, such as changing channels.

It might be worth considering more than one type of timer. If a TAP has a requirement for switching channels or similar it always creates its own timer. Two such TAPs would therefore create two timers. Non-intrusive TAPs could however piggy-back on an existing exclusive timer, but not modify it in any way, and if none existed then create a shared timer.

We could identify exclusive timers by EPG_xxxxxxxx_yy.rec naming, where xxxxxxxx is the TAP Id and yy allows for more than one timer per TAP.


The problem with multiple wake timers for different sorts of wake is working out what to do when an actual recording or watch clashes with it. I still think a single wake timer is the way forward, but I'll add a new rule to the ones above:

7. If the required wake timer clashes with an existing timer, don't set it - the Toppy will be awake anyway.

Cheers

Nic

_________________
iGuide (EPG, now-and-next, series links) and iGuideSMS (sms connectivity for the Toppy) TAPs. Latest manual, alpha spike and beta
View user's profile Send private message Visit poster's website
DX
Posted: Mon Nov 24, 2008 4:02 pm Reply with quote
Frequent contributor Joined: 06 Apr 2005 Posts: 2658
shinyford wrote:
Does that make sense?

Yes, I can see how that works.

Thinking out loud -

I assume any TAP is free to delete the shared wake timer at any point? e.g. If TAP C gets a clash setting 2x recordings for 1.00am-3.00am it can just delete the "__wake__.rec" timer to resolve it.

At that point TAP A and TAP B will both try and recreate a wake timer, but won't because of the clash. Then at 1.01am TAP B will set a wake timer for a day later.

I'm not so sure about the non-recurring nature of the timer. Wouldn't a daily repeat be safer? I'm thinking what happens if you can't set the timer because there are no timer slots left. So to resolve a clash rather than TAP C deleting the shared timer it tries advancing it 24 hours. If that doesn't work try 25, 26 etc until it finds a non-clashing time. TAPs A+B will then set earlier times if possible.

Or possibly TAP C resolves the clash by setting the channel to be the same as that of the recording? But then what about clashes with other wake timers?
View user's profile Send private message
shinyford
Posted: Mon Nov 24, 2008 4:16 pm Reply with quote
Frequent contributor Joined: 12 Dec 2005 Posts: 726 Location: London
Yes, I like the idea of a TAP advancing its timer to a non-clashing day (or whatever). I think that this can be left to the conscience of the individual TAP, however. For me, the important thing is that the timer is a OneTime timer, rather than any sort of repeat. Mainly because, when I start trying to contemplate managing multiple wake timer events in a single timer, my head starts to hurt.

I think in the instance of a clash with a real recording, there's no need to change the watch timer to the same channel - for my needs, if the Toppy is awake for a recording, that's enough. Are there any other use cases where that's not the case?

And yes, any TAP can delete the shared timer at any point, so long as it doesn't rely on that timer not existing (i.e. another TAP can reinstate it, so long as there's no clash with recordings etc).

Cheers

Nic

_________________
iGuide (EPG, now-and-next, series links) and iGuideSMS (sms connectivity for the Toppy) TAPs. Latest manual, alpha spike and beta
View user's profile Send private message Visit poster's website
DX
Posted: Mon Nov 24, 2008 6:43 pm Reply with quote
Frequent contributor Joined: 06 Apr 2005 Posts: 2658
shinyford wrote:
I think in the instance of a clash with a real recording, there's no need to change the watch timer to the same channel - for my needs, if the Toppy is awake for a recording, that's enough. Are there any other use cases where that's not the case?

It's not something I would currently need, but I can see there might be a case for it.

Suppose TAP A sets a wake timer for 1.00-2.00am, and needs that full hour do whatever it does. What happens if the clashing recordings are 1:00-1:05am? If TAP C just deletes the wake timer then TAP A doesn't manage to complete before the Toppy goes back to sleep. Or maybe the recordings are 1:45-3:00 and so the Toppy wakes up late. It would be friendlier of TAP C to ensure the Toppy was awake for the full period of the original wake timer. Of course if there are multiple clashes this gets very difficult and may not be possible with a single wake timer.

In practice I don't think it is worth losing any sleep over, just deleting the timer is probably good enough.
View user's profile Send private message
shinyford
Posted: Wed Dec 03, 2008 10:43 pm Reply with quote
Frequent contributor Joined: 12 Dec 2005 Posts: 726 Location: London
So, I've created a bit of code - I hesitate to call it a program - to achieve the wake timer convention as described above. Two files, wake.h and wake.c: #include wake.h and #include or compile separately wake.c.

If your TAP needs to use wake timers or sets timers for recordings, and may exist alongside another TAP that uses this wake API, then it may prove useful (see the readme for why Smile )

http://www.shinyford.co.uk/toppy/wake.zip

Cheers

Nic

_________________
iGuide (EPG, now-and-next, series links) and iGuideSMS (sms connectivity for the Toppy) TAPs. Latest manual, alpha spike and beta
View user's profile Send private message Visit poster's website
shinyford
Posted: Fri Dec 19, 2008 10:46 am Reply with quote
Frequent contributor Joined: 12 Dec 2005 Posts: 726 Location: London
Slight update to the .c file in

http://www.shinyford.co.uk/toppy/wake.zip

because some of the basic logic was slightly screwy. Should work better now.

Cheers

Nic

_________________
iGuide (EPG, now-and-next, series links) and iGuideSMS (sms connectivity for the Toppy) TAPs. Latest manual, alpha spike and beta
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT
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