Skip to main content

TVTimer - reset

7 replies [Last post]
mico88
Offline
Joined: 2008-01-24

Hi,

I would like to use javax.tv.util.TVTimer to close popup menu after set timeout if no activity (UO) on the menu. I need help how to reset the timer to don’t fire TVTimerWentOff event and start to count from beginning. I was trying to TVTimer.deschedule(TVTimerSpec) and again TVTimer.scheduleTimerSpec(TVTimerSpec), but this doesn’t work for me. Can somebody confirm that to use TVTimer is good way and how to stop it and how to reset it.

Regards,

~mirek

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Bill Foote

bd-j-dev@mobileandembedded.org wrote:

> BTW, there is a class java.util.Timer on any BDJ device that allows to provide
> similar functionality to TVTimer's:

FWIW, I'd recommend java.util.Timer.

TVTimer is a bit of a historical accident - the only reason it
exists is because the Java platform didn't have a timer class
at the time it was added. That was before Personal Basis Profile,
back when Java TV was used with a thing called "Personal Java,"
which pre-dates the JCP.

The timer class in java.util has equivalent functionality, is
better written, and has more reliable conformance testing.

With that said, if you already have a frame pump thread, you
might look into having your timing notifications come from that
thread. Don't worry too much about this, but threads can be
somewhat expensive, and using java.util.Timer (or JavaTV's TVTimer)
might cause the platform to spin up a system thread.

Cheers,

Bill

---------------------------------------------------------------------
To unsubscribe, e-mail: bd-j-dev-unsubscribe@hdcookbook.dev.java.net
For additional commands, e-mail: bd-j-dev-help@hdcookbook.dev.java.net

bbk
Offline
Joined: 2006-10-13

Mirek,

what is the change that you have made to force that old s/w to behave as you wanted to?
Have you had to provide another instance to deschedule() as an argument?

BTW, there is a class java.util.Timer on any BDJ device that allows to provide
similar functionality to TVTimer's:

You will just need to subclass java.util.TimerTask by implementing it's
run() method (where you may do everything you want) and schedule
your TimerTask's subclass on newly created java.util.Timer by calling
one of it's scheduleXXX() methods. When you decide to cancel all your
tasks, you simply call to it's cancel() method.

This class is good to schedule new tasks without concerning on
threads lifecycle management.

--
Thanks,
Boris.

mico88
Offline
Joined: 2008-01-24

Hi Boris,

no, I meant I had to upgrade my PC based player to the new version, there was a bug in old one (it seems to me at least). Everything worked well on HW players. I will look at java.util.TimerTask if it can work better for me. Thanks.

~mirek

jasongilbert
Offline
Joined: 2008-03-26

Hey Denny!

This is my desire for BD-J dev...to have a great scalable code as we had for HDi. Where you can quickly add\subtract features from a solid base of reusable code. I will be in need of your BD Authoring app ASAP! We have about 30 projects on hold that I would like to get out quickly with "DoStudio Blu"

Thanks for everything...Talk to you soon.

Jason

Http://www.HDPostConsulting.com

dbreitenfeld
Offline
Joined: 2007-03-18

Hi micro88,

Can you let us know what settings you are using when you create your java.tv.util.TVTimerSpec? This is probably a silly question but have you implemented a java.tv.util.TVTimerWentOffListener and passed it to the TVTimerSpec?

If you are having troubles with the TVTimer, one way is to create a Runnable instance and then have it sleep for the time you want. This should perform pretty well and if you use the same pattern that the TVTimerSpec Class uses, it might fit in the code that you have already written. If you are not familar with threads I would recommend checking out Javaworld.com for some good articles. Even if the article is several years old you should be ok. Here is one article that might help you get started: http://www.javaworld.com/javaworld/jw-04-1996/jw-04-threads.html?page=1

Good luck,

Denny B.
-------------------------------------------------------------------------------------------------------------
[i]NetBlender DoStudio Blu-ray Team - DSA - http://dostudio.netblender.com [/i]

mico88
Offline
Joined: 2008-01-24

Hello Denny,

Thanks for your comment. Meanwhile I have solved the problem, actually not solved but discovered that one of my old sw players I use for quick check of my project don't behave correctly. Tested on newest version, on Panasonic standalone player and PS3 everything is OK now and behaves as I intended. But yes, I am BDJ and Java newbie and try to use my knowledge from HDDVD authoring to the new world :), so any article and/or suggestion which can help me are more than welcome. Thank you.

Regards

~mirek

dbreitenfeld
Offline
Joined: 2007-03-18

Hi Mirek,

Glad to hear you got it working. I would spend sometime at javaworld.com They have a lot of great articles and most of them come with code snippets that you can learn by example. Also if you are not familiar with Patterns I would check out the following site: http://www.patterndepot.com/put/8/JavaPatterns.htm I have not read the entire site but did check out the text around the key patterns and found it to be a good start to learning patterns. At this moment in time I would not go overboard on using too many patterns but there are several that can be used that will help you code better and help your performance. Singleton, and Factory patterns are two that come mind along with the Builder pattern. If you are more into reading a book then I would recommend Patterns in Java, Volume 1 (http://www.amazon.com/Patterns-Catalog-Reusable-Design-Illustrated/dp/04...) It is definitely too much for BD-J but the author does a great job at explaining patterns in an everyday way. (I do not reccommend volume 2).

Good luck with your new found skills!

Denny B.
-------------------------------------------------------------------------------------------------------------
[i]NetBlender DoStudio Blu-ray Team - DSA - http://dostudio.netblender.com [/i]