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 04-15-2008, 09:36 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
How can you tell if the SageTV Service is running

Basically does anybody know how to tell if the Service is running from Java?

The IsServerUI API call will tell you that your code is running on a Server PC but I cannot find an API call or combination of calls that will tell me if service mode is running. I can tell if this has been configured to share files with Sage Clients with the IsSageTVServerEnabled but I don't think it will tell me if SERVICE mode is running.

Any ideas?
Reply With Quote
  #2  
Old 04-15-2008, 09:49 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Are you trying to determine if the service is in use from any client, or are you trying to determine this only while using the UI on the server?

For checking while using the server UI, see this post.

- 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 04-15-2008, 10:11 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by Opus4 View Post
Are you trying to determine if the service is in use from any client, or are you trying to determine this only while using the UI on the server?

For checking while using the server UI, see this post.

- Andy
Sorry should have searched for it. Think this will give me what I want. Right now I was just wanting to be able to tell which property file was being used based on the current thread's context.

Edit: Here is what I came up with in case anybody is interested:
Code:
    public static boolean isService() throws InvocationTargetException {
        boolean isServerUI = (Boolean) sage.SageTV.apiUI(
                "SAGETV_PROCESS_LOCAL_UI", "IsServerUI", null);
        boolean isGUIBoot = findLocalContext();
        return isServerUI && !isGUIBoot;
    }

    public static boolean isGUIClient() throws InvocationTargetException {
        boolean isServerUI = (Boolean) sage.SageTV.apiUI(
                "SAGETV_PROCESS_LOCAL_UI", "IsServerUI", null);
        boolean isServiceRunning = ((String) sage.SageTV.apiUI(
                "SAGETV_PROCESS_LOCAL_UI", "GetProperty",
                new Object[] {"client", ""})).equalsIgnoreCase("true");
        return isServerUI && isServiceRunning;
    }

    public static boolean isGUIBoot() throws InvocationTargetException {
        boolean isServerUI = (Boolean) sage.SageTV.apiUI(
                "SAGETV_PROCESS_LOCAL_UI", "IsServerUI", null);
        boolean isServiceRunning = ((String) sage.SageTV.apiUI(
                "SAGETV_PROCESS_LOCAL_UI", "GetProperty",
                new Object[] {"client", ""})).equalsIgnoreCase("true");
        boolean isGUIBoot = findLocalContext();
        return isServerUI && !isServiceRunning &&isGUIBoot;
    }

    private static boolean findLocalContext() throws InvocationTargetException {
        String[] contexts = (String[]) sage.SageTV.apiUI(
                "SAGETV_PROCESS_LOCAL_UI", "GetUIContextNames", null);
        for (String context : contexts) {
            if (context.equalsIgnoreCase("SAGETV_PROCESS_LOCAL_UI")) {
                return true;
            }
        }
        return false;
    }
    
    public static boolean isClient() throws InvocationTargetException {
        return (Boolean) sage.SageTV.apiUI(
                "SAGETV_PROCESS_LOCAL_UI", "IsClient", null);
    }

    public static String getContext() throws InvocationTargetException {
        if (isService()) {
            return "Service";
        } else if (isGUIClient()) {
            return "ClientOnService";
        } else if (isGUIBoot()) {
            return "Server";
        } else if (isClient()) {
            return "Client";
        } else {
            return (String) sage.SageTV.apiUI(
                "SAGETV_PROCESS_LOCAL_UI", "GetUIContextName", null);
        }
    }

Last edited by BobPhoenix; 04-17-2008 at 03:40 AM. Reason: Added code
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sage Server as a service in Win2003 drive mapping eguy SageTV Software 9 07-27-2007 01:10 PM
Sage service mode OverClock SageTV Software 4 04-08-2007 06:39 PM
Service mode with MCE problem MantisRay SageTV Software 2 01-21-2007 02:57 PM
Not Connecting When Running as Service? RAlfieri SageTV Beta Test Software 3 02-28-2006 06:38 PM
Can't get SageTV service to work dflachbart SageTV Software 1 02-01-2006 07:07 AM


All times are GMT -6. The time now is 06:09 PM.


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