![]() |
|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Custom hooks for events from Java?
Another Java question... I have a feeling that this isn't possible right now, but I'll go ahead and ask!
I want to be able to pass information from Java code to Studio without Studio asking for it. Basically, I would like to be able to set up a call from Java that could trigger a custom hook inside studio. For example, the Java code is running along doing it's own thing... and so is Sage. The java code suddenly sends a message to Sage and Sage detects it, stops what it's doing, and goes to a specified widget chain. Is there any way of doing this? Thanks! |
#2
|
||||
|
||||
The info below is from an old email I received from Jeff. It sounds like what you are looking for. Or else Jeff can update it later.
![]() BTW: you could place such Studio code some place where it would never normally get executed, such as under a Menu widget that never gets called and/or under an 'if false' conditional widget. - Andy ----------------------- Your own hooks can be created by just using Actions. So let's say you want to make your own 'hook' called "MessageNotification()". Just make an Action with the name "MessageNotification()" (put it in quotes so it doesn't try to execute it). Then when you want that hook called, execute this from Java: Code:
Object[] actWidgets = (Object[])sage.SageTV.api("GetWidgetsByType", new Object[]{"Action"}); for (int i = 0; i < actWidgets.length; i++) { if ("\"MessageNotification()\"".equals( sage.SageTV.api("GetWidgetName", new Object[]{actWidgets[i]})) { sage.SageTV.api("ExecuteWidgetChain",new Object[]{actWidgets[i]}); break; } }
__________________
SageTV Open Source v9 is available. - Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1. - Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus - HD Extenders: A) FAQs B) URC MX-700 remote setup Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request. Last edited by Opus4; 11-12-2005 at 12:45 AM. Reason: fixed API function name |
#3
|
||||
|
||||
Ah!!! Calling a widget chain with a api call from Java. That should do it. I should have known to look in the Sage API docs. The curse of an early adopter.
![]() |
#4
|
||||
|
||||
Or... a blocking call to your java class eg 'GetNextEvent()', which is called in a Fork()'ed action tree. When the call is returned, the forked action tree resumes and can handle the event...
(used in my info popup -- java java.net.ServerSocket.accept() is called in a forked action tree, and when it returns, the rest of the action tree is handled, causing the infopopup window to be popped up.)
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki ![]() |
#5
|
||||
|
||||
Quote:
|
#6
|
||||
|
||||
I tried out the code that Opus posted and it works, with one exception. The first API call should be to "GetWidgetsByType", not "GetAllWidgetsByType". Other than that, it works fine.
I will look into the fork() method once I get everything working as I want... I agree that it's the better method. Thanks again... |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|