SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-18-2007, 09:36 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
UIContexts, and the MVP?

So, from what I've been told, I should be able to get a particular UI context....and with that context, I could actually control what plays on the MVP, using the java API.

My first step was to run GetUIContexts API call. However, the only two contexts I got were a local, and a remote. The actual setup is there is a sage server, a sage client, and the MVP. The remote context I got resolved to the IP of the client. So, there's a local (make sense) and the sage client....but what about the MVP?

Normally, to control the client, I'd just put my runnable java code in the startup properties...but I don't believe the MVP does that, correct?
Reply With Quote
  #2  
Old 05-18-2007, 10:00 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I haven't messed with UI contexts much, but I have one quick question: was the MVP active? If not, I don't believe it will have a UI context. I just tried it with a Placeshifter connection & its UI context went away as soon as the PS client was closed.

- Andy
__________________
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.
Reply With Quote
  #3  
Old 05-19-2007, 12:49 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
As Andy said, UI contexts get created and destroyed dynamically as MVP and Placeshifter clients connect and disconnect. So code that runs at service startup time won't see them.

The events that fire on MVP/Placeshifter connect and disconnect are the ApplicationStarted and ApplicationExiting hooks in the STV. By adding a call to GetUIContextName() in ApplicationStarted, you can get the specific context for the newly connected client and pass that in to your Java code. These hooks would also be the place to instantiate and dispose of any per-client state your code requires.

If you're determined to do it without any STV code, I guess you could create a thread that polls GetUIContextNames() periodically looking for changes, and then tries to guess which contexts go with which clients, in order to simulate the effect of ApplicationStarted and ApplicationExiting entirely within Java.
__________________
-- Greg
Reply With Quote
  #4  
Old 05-19-2007, 01:20 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I think he wants to control the MVP remotely, so it seems like polling on the server (or where ever the controlling software is located) will be called for.

But, I mainly wanted to comment on the ApplicationStarted hook: This does get fired at startup, but it doesn't get called when you change STVs while SageTV is already running. If an STV needs something initialized in the ApplicationStarted hook in order for the STV to work properly, I've found it is better to do the check every time you enter the Main Menu via the BeforeMenuLoad hook. You could set a global variable to be true/false or to remember the last setting that was loaded via 'startup' code. If it isn't loaded, or the setting has changed, then it can get updated simply by going to the Main Menu... which should automatically happen when a new STV is loaded.

- Andy
__________________
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.
Reply With Quote
  #5  
Old 05-20-2007, 07:01 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Quote:
Originally Posted by beelzerob View Post
\My first step was to run GetUIContexts API call. However, the only two contexts I got were a local, and a remote. The actual setup is there is a sage server, a sage client, and the MVP.
This is normal. The remote context is the MVP. Windows clients do not have a UI context in the server (use GetConnectedClients() instead to see the client connections). Linux and Mac clients are placeshifters, and will have a UI context.

Note that if you are running the server in service mode, you will not get a LOCAL UI context, and will only get connected placeshifters/MVPs

Quote:
The remote context I got resolved to the IP of the client. So, there's a local (make sense) and the sage client....but what about the MVP?
Incidentally, I am suprised that the remote context resolves to anything: it is normally the MAC address of the connected device...

Quote:
Normally, to control the client, I'd just put my runnable java code in the startup properties...but I don't believe the MVP does that, correct?
Like the webserver, you only need one runnable class to control both the server and the extenders (MVP/placeshifters). This can be started as before in the load_on_startup line. You need have some way of specifying which UI a particular command is sent to. You will still need to startup this class in all of the Windows clients so that they can be controlled too...

See the webserver's Home servlet for how I get the UI contexts and use the ApiUI call to find out what is running on each device.
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #6  
Old 05-23-2007, 08:10 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Now that I've gone back and looked....I actually can't find any evidence that a remote UI was found. Here's the only output I have that references anything other than the local:

Fri 5/18 8:06:48.603 [[SageCQC]]: Found 1 UI contexts
Fri 5/18 8:06:48.603 [[SageCQC]]: UI Context 0: SAGETV_PROCESS_LOCAL_UI
Fri 5/18 8:06:48.612 [[SageCQC]]: Found 2 connected clients
Fri 5/18 8:06:48.612 [[SageCQC]]: Client 0: /192.168.1.112:1057
Fri 5/18 8:06:48.612 [[SageCQC]]: Client 1: /127.0.0.1:2448


He said that 112 is his Sage Client. But I get no remote UI listed for the MVP. I had him do this same test with the MVP actually playing something, and it still didn't show up. he's running Sage in service mode, but that shouldn't affect things, should it?
Reply With Quote
  #7  
Old 05-23-2007, 12:13 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
When running the service, MVP UI contexts appear in the service process (i.e. SageTVService.exe), whereas the server's own local UI context appears in a separate UI process (SageTV.exe). If you're seeing the local context, then you're running your test in the wrong process.
__________________
-- Greg
Reply With Quote
  #8  
Old 05-23-2007, 12:19 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
How do you specify a different process to run GetUIContexts() on?
Reply With Quote
  #9  
Old 05-23-2007, 01:28 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
GetUIContexts() always returns the contexts for the current process, i.e. the one your code is running in. So you need to make sure you load your code into the right process in the first place. If you're using SageTVService, it takes its startup parameters from Sage.properties, and the UI process takes its parameters from SageClient.properties. (If you're not using the service, there's only one process, which takes its parameters from Sage.properties.)
__________________
-- Greg
Reply With Quote
  #10  
Old 05-23-2007, 10:30 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Oooooo......kaaaaaaaaay.



So...if I'm looking for the UI process name that I can use to control the MVP....then I should make sure the java code is loaded....from the sageClient.properties file? And not the Sage.properties file?
Reply With Quote
  #11  
Old 05-24-2007, 12:13 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
No, the other way round. Again, MVPs run in the SageTVService process (if you're using the service), which takes its parameters from Sage.properties.
__________________
-- Greg
Reply With Quote
  #12  
Old 05-24-2007, 05:02 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
... which is why the webserver installer prompts to install in both Sage.properties (for service/MVPs) and SageClient.properties (for UI/clients)...
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #13  
Old 05-27-2007, 07:32 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Ok......

Inserting the java runnable at startup call into sage.properties...
With something playing on the MVP at the time....
Doing a search of all contexts and connected clients....

this is what I get:
Fri 5/25 20:29:10.658 [[SageCQC]]: Found 1 UI contexts
Fri 5/25 20:29:10.661 [[SageCQC]]: UI Context 0: SAGETV_PROCESS_LOCAL_UI
Fri 5/25 20:29:10.662 [[SageCQC]]: Found 2 connected clients
Fri 5/25 20:29:10.662 [[SageCQC]]: Client 0: /127.0.0.1:3333
Fri 5/25 20:29:10.662 [[SageCQC]]: Client 1: /192.168.1.112:3985

So, I'm still not seeing a UI context specifically for the MVP.

The 112 IP address listed is appearantly the address of the Sage Client PC...not the MVP.

Am I just not getting it?? (entirely possible)
Reply With Quote
  #14  
Old 05-28-2007, 03:26 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Are you using service mode?

If so, then you are looking at the UI client's logging (service mode will never show a SAGETV_PROCESS_LOCAL_UI context.)

(you need to enable debug logging for the server/service as well, and look at sagetv_0.txt to see the server's logging.

Or to make it a bit easier during development, disable service mode)
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #15  
Old 05-28-2007, 07:25 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Hmmm....I think I've reached the limits of what I can describe by proxy...

What i'm doing is writing this code for IVB and his setup, so I'll get him into this thread and he can explain how he setup this last test. Essentially, I give him some new code to test, and then he sends me back a logfile....but I don't know the details about which logfile, service mode, clients, etc....and those details are suddenly crucial to things working right.

Without further ado......I......V.......Beeeeeeeeeee!
Reply With Quote
  #16  
Old 05-28-2007, 10:44 AM
IVB's Avatar
IVB IVB is offline
Sage Icon
 
Join Date: Sep 2003
Location: Oak-town, CA
Posts: 1,083
Here's what I did, if I understand nielm correctly I need to redo this:

1) I left SageTV in service mode
2) I stopped it, set debug_logging=TRUE
3) I restarted it (in service mode)
4) I connected with CQC so that beelzerob's code would connect and produce the file he wanted

So...from what I gather, I should take it off service mode and redo this test?
__________________
------------------------------------
My Home Automation YouTube channel
Reply With Quote
  #17  
Old 05-28-2007, 03:49 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
did you add beelzerob's class to the load_on_startup_runnable_classes in the sage.properties file (for the server/service)

Where did you get the posted logging from?
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #18  
Old 05-28-2007, 04:47 PM
IVB's Avatar
IVB IVB is offline
Sage Icon
 
Join Date: Sep 2003
Location: Oak-town, CA
Posts: 1,083
yep, his class is in there.

Beelzerob can answer the posted logging question better than I - I just sent him the logfile that his code generates.
__________________
------------------------------------
My Home Automation YouTube channel
Reply With Quote
  #19  
Old 05-28-2007, 04:51 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Not really....in this case, the file I had him send me was the sage_tv0 logfile created by sage, in the SageTV directory. That's different that the logfile I produce on the CQC side of things.
Reply With Quote
  #20  
Old 05-30-2007, 10:58 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
The logging does look like it came from a client UI..

However, I think at this stage, it might be better to run the server in non-service mode to simplify things a little.

Beelzerob, you know that a placeshifter client looks the same to the server as an MVP, so all you need to do to test your UI context stuff is to run a placeshifter... This might be easier than remote-testing
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:32 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.