Plugins that add more UPNP devices to UPnPServer

Discussion in 'Plugin Development' started by McGoober, June 3, 2011.

  1. McGoober
    • Team MediaPortal

    McGoober Retired Team Member

    Joined:
    August 13, 2006
    Messages:
    122
    Likes Received:
    103
    Gender:
    Male
    Occupation:
    Staff Software Developement Engineer
    Location:
    Cambridge, UK
    Ratings:
    +105 / 0
    Home Country:
    United Kingdom United Kingdom
    I'm in the process of creating a plugin that will add a new UPNP device and device services to the MP2 server. But currently, access to the UPnPServer object in the MP2 server isn't exposed. UPnpBackendServer inherits from UPnpServer, and it's instance is held in BackendServer. My current workaround for this is to expose a getter property called UPnpServer in BackendServer and in IBackendServer to allow access whilst I develop the plugin. A simple call to ServiceRegistration.Get<IBackendServer>().UPnpServer solves my problem, but is there another, more elegant way?


     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    AW: Plugins that add more UPNP devices to UPnPServer

    Ok, I'll see what I can do to give you public access to the UPnPServer or UPnP root device. I think it will be something similar as you already did.
     
  4. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    AW: Plugins that add more UPNP devices to UPnPServer

    That's exactly the way I will do it. I'll also expose the UPnPServer property in IFrontendServer.
    I'll do that change after I have finished my current bugfixing session, which can take maybe one or two more days.
     
  5. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    AW: Plugins that add more UPNP devices to UPnPServer

    I just pushed the change to the public git repository.
     
    • Like Like x 1
  6. McGoober
    • Team MediaPortal

    McGoober Retired Team Member

    Joined:
    August 13, 2006
    Messages:
    122
    Likes Received:
    103
    Gender:
    Male
    Occupation:
    Staff Software Developement Engineer
    Location:
    Cambridge, UK
    Ratings:
    +105 / 0
    Home Country:
    United Kingdom United Kingdom
    Sweet, thanks Albert.
    Just one thing, I think there was a cut and paste error in the name of the property in IBackendServer. Should the property be called "UPnPBackendServer" rather than "UPnPFrontendServer"?
     
  7. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    AW: Re: Plugins that add more UPNP devices to UPnPServer

    :oops:

    Fixed. Thanks.
     
  8. Smeulf
    • Team MediaPortal

    Smeulf Test Group

    Joined:
    October 27, 2010
    Messages:
    672
    Likes Received:
    227
    Location:
    France
    Ratings:
    +228 / 0
    Home Country:
    France France
    Show System Specs
    Re: AW: Re: Plugins that add more UPNP devices to UPnPServer

    Albert,

    After this fix, server does not build anymore :

    Services\BackendServer\BackendServer.cs(40,16): error CS0535: 'MediaPortal.Backend.Services.BackendServer.BackendServer' doesn't implement interface member 'MediaPortal.Backend.BackendServer.IBackendServer.UPnPBackendServer' [D:\Smeulf\Desktop\MP2 GIT\MediaPortal\Source\System\MediaPortal.Backend\MediaPortal.Backend.csproj]

    Cheers.
     
  9. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,978
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,293 / 3
    Home Country:
    Germany Germany
    Show System Specs
    AW: Plugins that add more UPNP devices to UPnPServer

    The class BackendServer needs a rename of the property, too ;)
     
    • Like Like x 1
  10. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    AW: Plugins that add more UPNP devices to UPnPServer

    Strange. Off course, I also renamed the property in the implementation class. I'll take a look at it tonight.
     
  11. Albert
    • Team MediaPortal

    Albert MP2 Developer

    Joined:
    February 18, 2008
    Messages:
    1,297
    Likes Received:
    1,125
    Gender:
    Male
    Occupation:
    Dipl.-Inform.
    Location:
    Freiburg im Breisgau, Germany
    Ratings:
    +1,130 / 1
    Home Country:
    Germany Germany
    AW: Plugins that add more UPNP devices to UPnPServer

    It seems that I really forgot to commit that file. I'll do that tonight.
     
    • Like Like x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!