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 11-10-2005, 10:57 AM
Narflex's Avatar
Narflex Narflex is online now
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
HOWTO: Integrate VB or C# .NET Components Using the SageTV Studio

I wrote up an article on how to Integrate VB or C# .NET Components into SageTV using the Studio.

Thanks to deria for providing the VB example source for this.

I'm sure many of you will find this useful...and the example can be done using all FREELY available compilers.

Enjoy! Comments are welcome.

http://www.sagetv.com/IntegrateVBDot...udio_Curr.html

This example also shows how you would integrate C or C++ code since that's the bridge used to tie in the VB/C# code.

So now we've shown you how to do Java, C, C++, VB and C# integrations. Let's see what y'all can do.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #2  
Old 11-11-2005, 10:44 PM
insomniac's Avatar
insomniac insomniac is offline
Sage Icon
 
Join Date: May 2003
Location: Concord, Ca.
Posts: 1,104
wow..no comments on this yet!??! I cannot wait till i get some free time to start screwing around with all kinds of hair brain ideas

thx for the recent dump of information!

I.
__________________
If you're not cheating, your not trying...

My sage rigs:
Server - Windows 2003, Intel 865 PERLL w/ P4 3.2g 1gb ram, 3-PVR250, 3-PVRUSB's, 1 Skystar2, 1 twinhan 102g, 1 starbox DVB-S Cards. Evo network QAM encoder. 1.2TB storage 6.x server + MTSAGE for DVB
Client 1/Master BR - MediaMVP running a 30" Olevia LCD TV.
Client 2/Front Room - Shuttle ST61G4 XPC 1gig ram, 60gb HD, BTC9019 wireless keyboard/mouse & Harmony 880. 6.x client. GF6600GT driving a Sony WEGA 55" rear projection tv.
Reply With Quote
  #3  
Old 11-13-2005, 12:23 PM
deria deria is offline
Sage Aficionado
 
Join Date: Nov 2005
Posts: 408
Quote:
Originally Posted by insomniac
wow..no comments on this yet!??!
I.
I did my commenting (which was all entirely positive) in private. Seriously, Sage really went above and beyond when it came to implementing this example. I was very, very, very impressed both with their response (ie: that they were interested in doing it) and with their effectiveness (they made it happen very quickly and in an easy to implement way).

I've pretty much finished porting my disk monitor to Sage TV (the example uses the code for the disk monitor). It is slow going, but that is because there is just so much information to absorb. The actual porting is not that difficult. The only real difficulty is learning how to work within the studio environment -- its a very complex and powerful environment, and it takes a little getting used to. I think that would be true of any complex environment though.

I'm still not too sure how I'm going to actually release the plugin when its finished. I know what files I need to distribute, but creating an STVI doesn't sound particularly easy at all. I'm hoping that if I stick with the standard STV and don't make any references to it other than using the MainMenuTheme that I can then just export the tree where all my stuff is (the main display and the configuration popups) and then import it again in another STV. I'll have to play around with it.

I've also been playing around with STV editing in general as a learning tool, which is kind of fun. It gives you a feeling of empowerment. I wanted SageMC 169 to display hours left and GB left on the recordings screen, so I added that. I wanted it to go directly to the show details of whatever I'm watching when I press stop instead of bringing up that "x is stopped" popup, so I changed that. The recording details screen doesn't show which tuner recorded the show or the file size of the recording, so I added that (but I added it in the wrong part of the menu, so it looks dumb right this second). It's really kind of a blast to be able to do this type of thing so easily.

Anyway, off to finish that module.
Reply With Quote
  #4  
Old 12-05-2005, 08:36 PM
jreichen's Avatar
jreichen jreichen is offline
Sage Icon
 
Join Date: Jul 2004
Posts: 1,192
JNI.NET

I ran across JNI.NET today and am posting the link in case anybody is interested.

http://caffeine.berlios.de/site/deve...net-guide.html
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun.
Extender: STP-HD300, Harmony 550 Remote,
Netgear MCA1001 Ethernet over Coax.
SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client
, Java 1.6.
Plugins: Jetty, Nielm's Web Server, Mobile Web Interface.

Reply With Quote
  #5  
Old 12-22-2005, 02:36 AM
jeffld's Avatar
jeffld jeffld is offline
Sage User
 
Join Date: Mar 2005
Location: Chicago burbs
Posts: 11
It is API's like this that attract those who are interested in the journey more than the destination.

I haven't explored this yet, but I think that the fact that it exists is fantastic.

I think more and more companies will be making API's available for their products and will notice that the effort is definitely worth while.

Check out this API for the Roomba Vacuum Robot
Reply With Quote
  #6  
Old 03-13-2006, 11:51 AM
Bohica's Avatar
Bohica Bohica is offline
Sage Advanced User
 
Join Date: Mar 2005
Posts: 218
Questions about the example...

Hi all,

I am going through this example trying to implement some native code I have written, and am a bit confused about a couple of points. I have not gotten to the STV example to look at what was done with it -- but am focusing now on modifiying my existing .net source ala the examples. Then I will move on to making the Java code, creating the c++ wrapper DLL -- if you will -- and then onto the sage environment. Correct steps??

The question I have is that the example provides a little base code for sending messages from java through to the .net code, but does not really ever demonstrate this correct? I see the definitions for the two functions, and trace them through to the .net VB sample -- where they return existing values. I have this working in my own code now. The sample for the sending messages into the queue -- or for triggering events are never used correct? Am I missing those examples by not pouring over the STV sample? Or does this example not really send messages or receive events. I will want to do both with my application... are there other examples by someone that does utilize the queue infrastructure and trigger events back to the sage level? Am I just lost?
Reply With Quote
  #7  
Old 03-14-2006, 03:32 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
There are no built-in queuing/event mechanisms other than the predefined hooks and listeners for predefined events.

However, you could create your own event/queuing system in the native code, and provide JNI functions such as:

my_jni_queue_class_AddEventToQueue(q,msg)
event=my_jni_queue_class_WaitForNextEvent(q,timeout)

These functions can then be called from the STV -- eg Fork a thread, then loop calling event=my_jni_queue_class_WaitForNextEvent(q,timeout), handling the event accordingly.

For a trivial example, the Sage IMDB code reads several IMDB web pages in the background, and triggers the STV to refresh the results page when more data is available... (search for 'net_sf_sageplugins_sageimdb_DbObject_waitUpdates')
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #8  
Old 03-14-2006, 09:57 AM
Bohica's Avatar
Bohica Bohica is offline
Sage Advanced User
 
Join Date: Mar 2005
Posts: 218
Much thanks! I will take a look...
Reply With Quote
  #9  
Old 05-21-2006, 11:43 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Linking errors with listed example....

I went through the example of building a .NET java DLL, and have some linking errors that the example doesn't talk about. Specifically:

c:\Documents and Settings\Rob\My Documents\Visual Studio Projects\SystemMonitorJNI\SystemMonitorJNI.cpp(20): fatal error C1191: 'mscorlib.dll' can only be imported at global scope
C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\stdio.h(191): error C2624: '(HANDLE,DWORD,LPVOID)DllMain::_iobuf' : local classes cannot be used to declare 'extern' variables

Any help would be appreciated...I may just have a configuration error, although I followed the steps in the tutorial.

Also, I'd like to make sure this isn't all a pointless effort, so here is my goal:

I'm trying to write a driver for the CQC home automation software. This driver will allow a user to query the EPG, find out what is next to record or is already recording, what shows have been recorded, and will allow the user to choose a show to watch (on the Sage host computer, not as in "client"). So in other words, I'm going to want a lot of info, and have a little bit of control.

Is the java plugin the route I would want to take to do this? I have lots of C++ experience, but no java....so it's a little slow goin. Just want to make sure I'm not heading the wrong way.

Thanks for any help.
Reply With Quote
  #10  
Old 05-22-2006, 10:34 AM
mogrinz mogrinz is offline
Sage Advanced User
 
Join Date: Apr 2003
Posts: 91
Has anyone looked into using JNBridge or J-Integra to generate the cross-platform calls? We use those tools at my work to let the Java and C# groups share code, and they do all the heavy-lifting for you. You set your classpath, push a button, and get a C# class w/ no effort.
Reply With Quote
  #11  
Old 05-23-2006, 02:08 PM
IVB's Avatar
IVB IVB is offline
Sage Icon
 
Join Date: Sep 2003
Location: Oak-town, CA
Posts: 1,083
beelzerob - any progress on this? Wondering how it's going.
__________________
------------------------------------
My Home Automation YouTube channel
Reply With Quote
  #12  
Old 05-24-2006, 08:48 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Quote:
Originally Posted by IVB
beelzerob - any progress on this? Wondering how it's going.


I'd like to get to a simple "Hello world" type of java plugin to work, to get my feet wet. But I can't even seem to compile the example they gave, so it's a tad frustrating.

My next goal is going to be to try and use the free compilers they mention instead....since no one here seems to know what problem it is I'm experiencing. Maybe there's just too much obsfucation with Visual Studio .NET.
Reply With Quote
  #13  
Old 05-28-2006, 01:26 AM
IVB's Avatar
IVB IVB is offline
Sage Icon
 
Join Date: Sep 2003
Location: Oak-town, CA
Posts: 1,083
any help that anyone can provide beelzerob on how to integrate SageTV with CQC would be greatly appreciated. I personally know of 3-5 professional installers that would LOVE to include SageTV as part of their custom designed Home Automation/Home Theater automation solution, but that means much tighter integration than just kicking off SageTV from within CQC. They're waiting on this driver to get done before formally approaching anyone here about it.

Thanks,
- Vivek
__________________
------------------------------------
My Home Automation YouTube channel
Reply With Quote
  #14  
Old 05-28-2006, 01:48 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, for now I've forsaken anything Visual .NET related, and am embracing java wholeheartedly. I'm well versed in C++, so it seems pretty familiar. Enough anyway....hopefully the learning will go fast.

What I really need is some good examples of hooking up plugins into Sage, and communicating via ports, and all that. I understand that Neilm's webserver code is considered the standard for this, and I keep reading that it's freely available...but I have yet to be able to find out how to get ahold of a copy for myself. That would be the biggest help.
Reply With Quote
  #15  
Old 01-24-2007, 12:06 AM
UFGrayMatter's Avatar
UFGrayMatter UFGrayMatter is offline
Sage Advanced User
 
Join Date: Aug 2006
Posts: 185
digging up an old thread - just wondering if Sage has some sort of .NET interop, so I can play around w/ the API from within VS C#?

Thanks,
Ryan
Reply With Quote
  #16  
Old 08-16-2009, 08:15 PM
cowboyway cowboyway is offline
Sage User
 
Join Date: Aug 2009
Posts: 44
Delphi?

Anyone use these methods with Delphi to do the same? I'm using version 6.
Reply With Quote
  #17  
Old 08-17-2009, 08:30 AM
jsonnabend jsonnabend is offline
Sage Aficionado
 
Join Date: Sep 2006
Posts: 301
Good to hear someone else is still on D6. I'll be curious to hear if anyone answers. I hadn't even thought of doing any Sage stuff in Delphi, but it's my most proficient language.

- Jeff
Reply With Quote
  #18  
Old 09-17-2009, 11:41 AM
owilsky's Avatar
owilsky owilsky is offline
Sage Aficionado
 
Join Date: Dec 2004
Location: Germany
Posts: 447
I also would like to know if it is possible to call certain functions from the SageTV API from within a C# program.
__________________
Oliver Kötter
------------
Check this thread for importing German TV Data into SageTV

Using SageTV 7.1.9, Java 1.6.0_24 Win7 Home Premium on an
Asus M4N78-AM Mainboard, AMD Athlon II X2 215, 4 GB RAM, 500 GB HDD, 2xTechnoTrend S-2400 as Network Encoder (LM DVB Smart Recorder), ATI Radeon HD 3450 with analog TV-Out on good old CRT TV (100Hz)
My avatar shows the world's best composer!!!
Reply With Quote
  #19  
Old 09-18-2009, 11:33 AM
Slugger Slugger is offline
SageTVaholic
 
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
Quote:
Originally Posted by owilsky View Post
I also would like to know if it is possible to call certain functions from the SageTV API from within a C# program.
Sort of, if you install the remote APIs plugin and call your API calls in C# via that then you could, but there is no way to directly call the Sage API outside of a Java program running in an active SageTV embedded JVM process.
__________________
Twitter: @ddb_db
Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive
Capture: 2 x Colossus
STB Controller: 1 x USB-UIRT
Software:Java 1.7.0_71; SageTV 7.1.9
Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter
Plugins: Too many to list now...
Reply With Quote
  #20  
Old 09-18-2009, 01:16 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Well I guess that brings up the question, what do you really want to do? As you may have noticed, the Sage API is really designed for writing code to be called from inside Sage, not so much for external apps to call into Sage from the outside.

Quote:
Originally Posted by Slugger View Post
...there is no way to directly call the Sage API outside of a Java program running in an active SageTV embedded JVM process.
Not directly, but with a JNI wrapper, you should be able to call into Sage from any language 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


All times are GMT -6. The time now is 11:16 AM.


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