NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 62 63 64 65 66 … 93 Next »
Developing plugins

 
  • 0 Vote(s) - 0 Average
Developing plugins
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,807
Threads: 769
Joined: Nov 2003
#1
2004-08-08, 05:48 AM
This post will give a brief heads up for those wanting to develop there own plugins.

Theres not really any formal API documentation, but its worth looking at the samples on http://www.gbpvr.com/plugins.html (many of which include source code) and reading http://gbpvr.com/cgi-bin/ikonboard.cgi?act=ST;f=4;t=1

The easiest way to get started is probably to download one of the plugins (comics?) and just start looking at how it works. If you're into VB.NET you may want to look at the original weather plugin source code.

I'm happy to answer any specific questions you may have.



sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,807
Threads: 769
Joined: Nov 2003
#2
2004-08-08, 05:50 AM
The general idea is, a plugin is made into a .net dll. The dll must contain at least one class that implements the IMenuTask interface (see below). The IMenuTask interface is contained in the GBPVRPublic.dll file, so you'll need a reference to this file in you C# or VB.NET project. When the dll is placed in the c:\program files\devnz\gbpvr\plugin directory it will be automatically detected by GB-PVR and shown in the list in the config app.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">namespace GBPVR.Public
{
/// <summary>The IMenuTask is the interface that all GBPVR menu tasks implement</summary>
public interface IMenuTask
{
/// <summary>Returns the name of task, which is shown on the task's button</summary>
string getName();

/// <summary>Called every second or so if the task is active to determine if it needs rendering</summary>
bool needsRendering();

/// <summary>Is called by GBPVR to get the task to render the page to show the user</summary>
Image render(out bool requiresMoreRendering);

/// <summary>
/// Is called by GBPVR in response to a key being pressed while this
/// task is active. The task should return true if it has performed some action
/// as a result of the key press - which will inturn cause the task to be render()'d
/// </summary>
bool OnKeyDown(System.Windows.Forms.KeyEventArgs e);

/// <summary>Is called by GBPVR when the user has click'd somewhere on the page</summary>
void OnClick(System.Drawing.Point location);

/// <summary>Is called by GBPVR when the user has double click'd somewhere on the page</summary>
void OnDoubleClick(System.Drawing.Point location);

/// <summary>Returns a short description about the purpose of the task</summary>
string getDescription();

/// <summary>Returns an image that represent the task. 100x100 is a good size.</summary>
Image getTaskImage();

/// <summary>Is called by GBPVR when the task is activated.</summary>
void Activate();

/// <summary>Is called by GBPVR when the task is deactivated.</summary>
void Deactivate();

/// <summary>
/// This method returns the name of a subdirectory off the skin root directory
/// that contains the skin's look and feel settings and images etc
/// </summary>
/// <returns>Skin sub-directory</returns>
string getSkinSubdirectory();

/// <summary>
/// This method is used to inform the active task of mouse wheel actions for scrolling etc...
/// </summary>
/// <param name="e">Mouse args that can be used for information about the mouse action</param>
void OnMouseWheel(MouseEventArgs e);

/// <summary>
/// This method is gets a form that can be used to config the plugin.
/// </summary>
/// <param name="document"></param>
/// <returns>Configuration Form, or null if there are no user configurable settings.</returns>
Form GetConfigFormInstance(XmlDocument document);
}
}
[/QUOTE]



sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,807
Threads: 769
Joined: Nov 2003
#3
2004-08-08, 06:12 AM
GB-PVR also supports event notification plugins, which could be used to (for example) show status information on an LCD. Event notification plugins must implement IEventNotification.

[b Wrote:Quote[/b] ]using System;

namespace GBPVR.Public
{
public enum EventTypes
{
CurrentAudioTrack,
CurrentVideoTrack,
CurrentTrackDuration,
CurrentChannelNumber,
CurrentChannelName,
};

/// &lt;summary&gt;
/// This interface is implement by GB-PVR plugins which need to be
/// notified about current audio/video track playing etc
/// &lt;/summary&gt;
public interface IEventNotification
{
void Notify(EventTypes eventType, string eventText);
}
}
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,807
Threads: 769
Joined: Nov 2003
#4
2004-08-08, 06:16 AM
The GBPVRPublic.dll also provides a few other user file classes.

Logger, with static methods for logging messages to the GB-PVR logs:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Logger.Verbose("GB-PVR is starting");
Logger.Error("Some error occurred");
[/QUOTE]

SkinHelper, for managing the creation and caching of graphical resources. This class includes methods such as:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
// Get the Image descibed in skin.xml
public Image getNamedImage(string name, Hashtable parameters)

// get a Color class given its name (eg White, Black, Blue)
public Color getNamedColor(string colorName)

// get the font (and associated brush) described in skin.xml
public Font getNamedFont(string name)
public Brush getNamedFontBrush(string name)

// look if there is translation in language.xml for the supplied text string.
// If not, the original string will be returned. Use this for any text you want
// to display on the screen.
public string getTranslation(string text);
[/QUOTE]

If you look at some of the existing skin.xml files, it should be relatively easy to see how these methods are used. Again, just ask if you've got specific questions.



tkgafs
Offline

Senior Member

Posts: 594
Threads: 61
Joined: Jun 2004
#5
2004-08-12, 09:25 AM
This must seem really stupid, but whilst the code I've looked at for the plugins seems reasonably straight forward to understand, I have no idea what software I need to allow me to write my own (or modify other plugins).

What complier is needed (i have only ever written unix / mainframe code before) so programming for this will be an adventure.

Are there freely available compliers or do i need something like visual C++

in other words how do I get started

thanks for any info

Tkgafs
colin
Offline

Senior Member

Posts: 683
Threads: 39
Joined: Nov 2003
#6
2004-08-12, 11:24 AM
[b Wrote:Quote[/b] ]in other words how do I get started

Basically any language that supports the .NET environment should work for you. So far C# and VB.NET have been used.

A c# compiler comes with the .NET environment and probably some others. Some folk use Visual Studio to do their development in others (like myself) just use free stuff or simply a text editor and the command shell for compiling.

As someone else pointed out in the forum (sorry forgot who it was) there is a free IDE for developing C# or VB.NET apps in called SharpDevelop
which is good. I use this to do the gui stuff for the configuration section.

I will someday get around to doing a set of skeleton files for SharpDevelop to get people going.

After that, look at other plugin examples and see how things are done. Any problems following the examples opena new topic in the developers forum and we'll give you a hand,

Cheers,
Colin.
brew
Offline

Junior Member

Posts: 3
Threads: 1
Joined: Aug 2004
#7
2004-08-27, 06:30 AM
Hi,

I'm a bit new to this game but thought I'd have a go at modifying an existing plugin (i.e Comic). I picked up a Free C# developement system (microsoft Visual Studio 2005 beta), just go to microsoft and pick it up! The application built ok and the .dll I created was recognised as a plug-in - well at least I thought it was since another box appeared on the main menu on my MediaMVP. In fact, it wasn't being recognised - I eventually found this out by looking at the config logfile where I found the following error:-

27/08/2004 07:11:43.406 ERROR [8] Error initializing plugin: C:\Program Files\devnz\gbpvr\\plugins\ComicPlugin_test.dll
27/08/2004 07:11:43.406 ERROR [8] Version 1.1 is not a compatible version.

Can I take it this means that I'm using the .net SDK V1.1 and I should be using V1.0? If this is the case, anyone got any tips on how to safely downgrade?

Thanks

Brew
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,807
Threads: 769
Joined: Nov 2003
#8
2004-08-27, 07:15 AM
GB-PVR was developed against .net v1.1. I haven't personally tried VS 2005 or the .net v2.0 that comes with it so dont have too much advice to give you.

You might want to see if there is a setting somewhere to produce .net 1.1 compatible code.
brew
Offline

Junior Member

Posts: 3
Threads: 1
Joined: Aug 2004
#9
2004-08-27, 07:35 AM
Hi,

Yes, you're right, VS 2005 does use .net v2.0. I've tried downgrading but clearly VS 2005 relies on .net v2.0. Looks like I'll have to find an alternative development environment.

BTW, just like to say you've made an excellent job of the GB-PVR package.
colin
Offline

Senior Member

Posts: 683
Threads: 39
Joined: Nov 2003
#10
2004-08-27, 01:24 PM
Hi brew,

I would recommed the Sharpdevelop as a cheap (free) alternative to the Studio stuff. very handy for doing the config gui's and creaing the .res files required.

Also, if you are happy with using command line syntax, etc. you can just use notepad as .NET v1.1 comes with a c# compiler. I like this way as i know what files are being created [Image: smile.gif]

The plugins are not that complex that they require a VS application. Keep going!

Colin.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (10): 1 2 3 4 5 … 10 Next »
Jump to page 


Possibly Related Threads…
Thread Author Replies Views Last Post
  Plugins and NPVR. Where do we start? sub 80 70,326 2020-11-26, 10:02 PM
Last Post: mandai
  Developing Android TV client fred250 2 1,923 2020-11-16, 06:33 PM
Last Post: fred250
  I want to start developing plugins...but how? OrenShapir 6 4,192 2014-11-18, 10:38 PM
Last Post: mvallevand
  Tuner plugins and client id mvallevand 2 2,134 2013-07-03, 01:39 AM
Last Post: mvallevand
  Tuner Plugins - Output folders mvallevand 2 2,103 2013-02-19, 07:45 PM
Last Post: mvallevand
  .NET 4 plugins? McBainUK 20 7,917 2012-12-11, 08:48 PM
Last Post: sub
  Integrated Development Environment (IDE) for plugins osx-addict 5 2,874 2012-10-18, 08:35 PM
Last Post: osx-addict
  Tuner plugins mvallevand 4 2,532 2012-08-05, 11:19 PM
Last Post: mvallevand
  Recorder plugins - Deleting tuners mvallevand 1 1,580 2012-03-29, 12:51 AM
Last Post: sub
  Recorder plugins - scheduling mvallevand 4 2,519 2012-03-26, 05:09 PM
Last Post: mvallevand

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode