SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio

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 09-04-2010, 01:21 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Working with enums in Studio

I'm working on an STVi that uses the SRE classes written by Slugger. One of the methods returns an enum, but it may also return null. There is another static method that accepts an enum as a parameter and returns a String. The enum is listed below. (Sluger's code is on google code so I'm assuming it's OK to post it here.) So far so good.

I'm getting an unknown method error from Studio accessing the static method but it looks to me like the parameters are all correct.

Here is the Studio code to get the MonitorStatus: (SREDataStore is OK at this point.)

Code:
MonitorStatus = com_google_code_sagetvaddons_sre3_server_DataStore_getMonitorStatus(SREDataStore, AiringID)
After checking MonitorStatus for null, this is the code that generates the error:

Code:
Status = com_google_code_sagetvaddons_sre3_shared_AiringMonitorStatus_getToolTip(MonitorStatus)
This is the error from Studio:

Code:
sage.a.e: Error in method reflection of com_google_code_sagetvaddons_sre3_shared_AiringMonitorStatus_getToolTip of sage.a.e: UNKNOWN METHOD ERROR name=com_google_code_sagetvaddons_sre3_shared_AiringMonitorStatus_getToolTip args=[VALID]
The argument VALID is valid for the enum. Am I invoking the getToolTip method incorrectly? I've never used an enum class from Studio so I'm guessing that's where my problem lies.

Edit: It's probably worth noting that if I pass the getToolTip method an invalid enum I get the expected String "Unrecognized status!".

PS. I'm sure when Slugger sobers up he will respond to this thread

Code:
package com.google.code.sagetvaddons.sre3.shared;

/**
 * @author dbattams
 *
 */
public enum AiringMonitorStatus {
        NO_MONITOR,
        VALID,
        UNKNOWN,
        INVALID,
        MONITORING;
        
        static public String getToolTip(String status) {
                if(NO_MONITOR.toString().equals(status))
                        return "Recording not monitored.";
                else if(VALID.toString().equals(status))
                        return "Recording will be monitored.";
                else if(UNKNOWN.toString().equals(status))
                        return "Monitor status unknown.";
                else if(INVALID.toString().equals(status))
                        return "Monitor status is invalid.";
                else if(MONITORING.toString().equals(status))
                        return "This recording is currently being monitored.";
                else
                        return "Unrecognized status!";
        }
}
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.

Last edited by tmiranda; 09-04-2010 at 01:35 PM.
Reply With Quote
  #2  
Old 09-04-2010, 02:51 PM
skiingwiz skiingwiz is offline
Sage Aficionado
 
Join Date: Jan 2005
Posts: 360
The getToolTip method takes a String, not an AiringMonitorStatus, so you'll have to call the toString method on MonitorStatus and pass that to getToolTip.


I haven't put this into studio, but it should be what you want. (I just took your call and added the toString call)
Code:
Status = com_google_code_sagetvaddons_sre3_shared_AiringMonitorStatus_getToolTip(java_lang_Object_toString(MonitorStatus))
Reply With Quote
  #3  
Old 09-04-2010, 03:50 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Doh!
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
Reply


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

Advanced Search
Display Modes

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
HDPVR working. Dish HD receiver working - Yeeeehaaa david zero Hardware Support 2 10-18-2009 07:36 AM
Where to get Studio? shill SageTV Studio 3 09-23-2009 12:53 PM
any chances of altering the graphics in sage without studio? studio users please read reboot_this SageTV Customizations 1 12-03-2004 04:03 AM


All times are GMT -6. The time now is 01:53 PM.


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