News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

Best Approach to Controlling a Network Device

Started by CentralMedia, October 16, 2013, 02:14:24 AM

Previous topic - Next topic

tschak909

That warning is a common one, and should be okay.

-Thom

CentralMedia

Cool, was making some changes, and declared the m_pxbmc in the  XBMC_MEDIA_CENTRE.h and then XBMC_MEDIA_CENTRE.cpp.cpp, fix that and re-compiled no warning. Actually got the default constructor, working in the constructor of XBMC_MEDIA_CENTRE.cpp, which was giving an error before and working in the GetConfig

Quotemake all
g++ -shared -o XBMC_MEDIA_CENTRE.so Main.o xbmc.o XBMC_MEDIA_CENTRE.o ../Gen_Devices/XBMC_MEDIA_CENTREBase.o  -L../lib  -lmysqlclient_r -lcurl -lSerializeClass -lDCECommon -lPlutoUtils -lpthread
cp XBMC_MEDIA_CENTRE.so ../bin
chmod +x post_make.sh
./post_make.sh XBMC_MEDIA_CENTRE.so

Left testing, can I test without creating a device as in Developing a DCE Device?

tschak909

no. You'll need to create a device for testing... and use Send Command to Device, to ensure that it works.

Then you'll need to put together the plugin.

-Thom

CentralMedia

Tried adding the to core or core/hybrid, but am getting an error when putting in the device number see attachment.

Also attached a print screen of the template existing

tschak909

What is your controlled via category in your device template ?

-Thom

tschak909

Also, you can connect to irc.freenode.net (even via the webchat.freenode.net web page), and connect to the #linuxmce-devel chat, and we can help faster, there.

-Thom

CentralMedia

Ok, later this evening when I get home, will join that irc.

To report now, got it to work, see output below, basic navigation

Quotelinuxmce@dcerouter:~/CodingWork/LINUXMCE/src/XBMC_MEDIA_CENTRE$ ./XBMC_MEDIA_CENTRE -d 74
XBMC_MEDIA_CENTRE, v.<=version=>
Visit www.plutohome.com for source code and license information

01      12/03/13 4:52:18.038            Config XBMC URL Successful, URL: http://192.168.80.155:80/jsonrpc <0xb77be6f0>
01      12/03/13 4:53:04.011            Command Left Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc":"2.0","                                      result":"OK"} <0xb6fbcb70>
01      12/03/13 4:53:09.015            Command Left Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc":"2.0","                                      result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"} <0xb6fbcb70>
01      12/03/13 4:53:14.958            Command Right Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc":"2.0",                                      "result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"} <0xb6fbcb70>
01      12/03/13 4:54:04.959            Command Back Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc":"2.0","                                      result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"} <0                                      xb6fbcb70>
01      12/03/13 4:54:19.241            Command Down Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc":"2.0","                                      result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"i                                      d":1,"jsonrpc":"2.0","result":"OK"} <0xb6fbcb70>
01      12/03/13 4:54:25.720            Command Right Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc":"2.0",                                      "result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"                                      id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"} <0xb6fbcb70>
01      12/03/13 4:54:29.583            Command Right Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc":"2.0",                                      "result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"                                      id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"} <0xb6fbcb70>
01      12/03/13 4:54:35.506            Command Select/Enter Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc"                                      :"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":                                      "OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"js                                      onrpc":"2.0","result":"OK"} <0xb6fbcb70>
01      12/03/13 4:54:45.563            Command Back Successful: {"id":1,"jsonrpc":"2.0","result":"pong"}{"id":1,"jsonrpc":"2.0","                                      result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"i                                      d":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"}{"id":1,"jsonrpc":"                                      2.0","result":"OK"}{"id":1,"jsonrpc":"2.0","result":"OK"} <0xb6fbcb70>

CentralMedia

Ok, created the template for the plugin, generated the code, but it does not fully looking like Xine or Pandora, etc.

See attached, is this as expected?

Just time for me to edit, well using from the others where applicable, LOL

tschak909

Nope, you gotta do more than that, bro. ;)

You need to implement the CreateMediaStream, StartMedia, ConvertMediaStream, etc. methods.

Look at the Hulu_Plugin and the compare with the Xine Plugin and the Game Plugin code.

-Thom

tschak909

Also make sure to look at the ::Register() method as well in each of these, you need to register your media player with the Media Plugin, in that method.

You also need to add rows to the database, by hand, at the least:

A new row(s) for DeviceTemplate_MediaType using the mediatype for 5 (stored video) and 4 (stored audio), referencing your player's device template.

Once this is done, you can reload router, and if all is well, you'll be able to send an MH Play Media command to the device asking to play a piece of media.


CentralMedia

Ok thanks.

Did the work on the others, have to augment the register. Also created a XbmcMediaStream based on PandoraMediaStream, cope and pasted

Question
The pXbmcMediaStream->m_iPK_MediaType, well really m_iPK_MediaType, this is going to reference the media types I enter within the DB, 4 and 5?

Just making sure, want to do a check on media type so I choose the appropriate share point for XBMC.

Also, would I be able to referrence any of the Device Data from the XBMC template, for example the mount?

CentralMedia

My humble attempt at the plugin, will try and compile later if I reach home early

Comment of course welcomed


tschak909

Ok. good so far, did you implement XbmcMediaStream ?

-Thom

CentralMedia

Yes I did, see attached, copied from the one you had, plan to try compiling later when I reach home

Also, from the plugin, could you access the device data, for example IP, PORT, MOUNT in my case?

tschak909

Yes, you can, using Event_Impl::GetDeviceDataFromDatabase().

From src/DCE/Event_Impl.h:

                /**
                 * @brief gets the specified parameter from the specified device and returns it's value in the sResult parameter
                 * @warning not implemented here
                 */
                string GetCurrentDeviceData( int PK_Device, int PK_DeviceData );  // Get it from the device itself
                string GetDeviceDataFromDatabase( int PK_Device, int PK_DeviceData );  // Get the latest value from the router

Each Command_Impl implementation, after ::Connect() is run, will have assigned a pointer to the matching Event_Impl class in m_pEvent, so you can do the following inside StartMedia:


string sPort = m_pEvent->GetDeviceDataFromDatabase(pMediaStream->m_pMediaDevice_Source->m_pDeviceData_Router->m_dwPK_Device,DEVICEDATA_Port_CONST);

The device data constants, can of course be read from pluto_main/Define_DeviceData.h,
and the various pointers to classes etc, can all be gleaned from various classes in src/DCE.. the .h files are very helpful in determining what member variables are part of a class.

-Thom