Author Topic: Best Approach to Controlling a Network Device  (Read 45004 times)

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #30 on: November 18, 2013, 01:47:24 am »
Ok got some time today, made an attempt to get the data I believe is required, especially for controlling playback.

Tested with checking the response, then actually getting a player ID, was able to pause a movie and stop that movie. Decided to use and search a string, as I was only interested in getting the output for some value, eg, in testing the response, which was OK, in getting a player ID, the ID, which I had to cast from string to int, works thus far.

Need to put in speed and send input for searches, lets say in add on youtube, also how to play a file or URL.

see attached my progress.


CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #31 on: November 26, 2013, 02:05:06 am »
Ok, did some changes, got it creating in a heap and tried in main to log information.

Only basic functionality tested, navigation left, right, up, down, back, select, home. Additional pausing, playing a file from LNMCE, changing speed and tested also seeking, calling addons, and sending text to a search, command line but its do able otherwise.

Have not tested playlist etc, but I believe its time to create the device and all that entails.

After this, would move to the WD live

See code attached

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #32 on: November 27, 2013, 11:50:58 pm »
I was looking to start creating the device, so read the Developing a DCE Device and looking to proceed.

Hi tschak909

What is the device template number for the ROKU STREAMER, wanted to check it out for a guide or any similar device.

Trying to sort out some stuff, like control by, etc, want to look at a similar example.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #33 on: November 28, 2013, 06:01:27 am »
That would be DT#2049. You can see the code in src/Roku_LTHDXDXS_Pla  in the source tree.

-Thom

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #34 on: November 29, 2013, 12:09:13 am »
Thanks

See attached, screen shot of template for device.

I get the menu navigation and media ctrl.

Is there a command group which can be chosen for playing a video file or audio file from LNMCE as below, thus I pass the file as below, well not the SMB stuff, but /home/public/videos/....mkv, and which can be sent.

"{\"jsonrpc\": \"2.0\", \"method\": \"Player.Open\", \"params\": { \"item\": { \"file\": \"smb://DCEROUTER/public/videos/2.73 TB (sdb1) WDC_WD30EFRX-68 [71]/Transformers Dark of the Moon (2011).mkv\"} , \"options\":{ \"resume\":true } }, \"id\": 1}"


tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #35 on: November 29, 2013, 02:02:57 am »
The implementation ultimately depends on how the plugin is written, but, normally, the system sends an MH Play Media command to the media plugin.

This gets routed into the Plugin's CreateMediaStream method, which creates a media stream.

This then gets routed into Plugin's the StartMedia method, which then figures out the commands it needs to send to play the stream (usually, finding the player devices for an entertainment area, and sending a Play Media command to them.)

You can see this in the various Plugin devices like Xine_Plugin, Game_Plugin, SmartQ_Plugin, Hulu_Plugin, etc.

Since XBMC will be most likely running on the media directors, and the media directors do the plumbing of exposing the media devices, you should just pass the file path that is sent through MH Play Media, straight to the player, as this will be a local path (e.g. /home/public/data/videos/blabla...)

Also, the XBMC Player device must have a Name device data. This field contains the WM_CLASS.WM_NAME for the window that Orbiter is to swallow and manage (so it can bring it to front when needed, push it back a layer when the orbiter menu needs to be displayed, etc.)... You can get this information by running wmctrl -l -x while xbmc is running. You'll see something like "XBMC.xbmc" or whatever, and this needs to be put into the Name device data, so that Orbiter can swallow the window.

-Thom

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #36 on: November 29, 2013, 10:31:00 am »
Thanks, forgot to attach a print out of the template also.

How off or close am I?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #37 on: November 29, 2013, 04:23:23 pm »
You may also want Smart Media Player commands.

Also, Descriptions usually aren't in upper case. Please follow the conventions of the other templates.

TCP Address usually isn't needed, isn't XBMC going to be running local to the media director?

There also isn't a Name device data. again, isn't the XBMC going to be running on the local media director?

-Thom

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3675
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Best Approach to Controlling a Network Device
« Reply #38 on: November 29, 2013, 04:48:48 pm »
* posde wonders, why XBMC be running on an MD?!

All people I know, just have some XBMC compatible hardware that they want to remote control...

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #39 on: November 29, 2013, 04:58:49 pm »
If that's the case, then:

* Yes, the IP Address device data needs to be there.
* Name isn't needed, because Orbiter will not swallow the instance.
* you'll want to make sure that the XBMC device translates not only public shares, but also user (private) shares.

-Thom

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #40 on: November 30, 2013, 01:11:07 am »
Na XBMC not running on a MD, its totally other hardware.

I was thinking to use the mount in Device data, to send the configure share as at present I access LNMCE shares through SMB, NFS did not work, maybe this may changes, NFS may work, just wanted to have the option if required. This has to be manually entered, as there is currently no command in my understanding to get the mount points from XBMC or even set any.

Thanks for the pointers.
« Last Edit: November 30, 2013, 01:18:48 am by CentralMedia »

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3675
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Best Approach to Controlling a Network Device
« Reply #41 on: November 30, 2013, 12:06:23 pm »
If XBMC's api allows the definition of a media file using a URL like smb:// that should be usable.

golgoj4

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1193
  • hrumpf!
    • View Profile
    • Mah Website
Re: Best Approach to Controlling a Network Device
« Reply #42 on: November 30, 2013, 05:28:36 pm »
If XBMC's api allows the definition of a media file using a URL like smb:// that should be usable.

what about private media?
Linuxmce - Where everyone is never wrong, but we are always behind xbmc in the media / ui department.

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #43 on: November 30, 2013, 09:36:11 pm »
Questions

1: In the .cpp file, I see in the LTHDXDXS_Streaming.cpp, the following type of constructor is not there, should I remove the one generated for me
   a:The constructor when the class is created as an embedded instance within another stand-alone device
   b:Is this required pluto_pthread_mutex_t m_RokuMutex, seeing it in the implementation file, doing ,m_RokuMutex("roku") and the m_RokuMutex.Init(NULL)
2: In my xbmc.h and xbmc.cpp, I have to use the namespace DCE and put the class creation within.
3: Do I have to put anything in the constructor or simple do it in the GetConfig, where it says to put the initialization of your code there.
4: The Device Data, TCP address and TCP port, how or where do I get this value, is it string ServerAddress in the standalone constructore

See the 2 generated .h and .cpp files and the xbmc .h and .cpp files



tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #44 on: November 30, 2013, 09:43:51 pm »
const2 can be safely removed later, leave it in for now until you finish development, if it is not being embedded within another device. You can follow the instructions to remove it.

Yes, the namespace DCE should be used. In any DCEgen derived code, this is automatically specified by the using namespace DCE;

The constructor should contain initialization for any member variables you intend to use within the class. This is to ensure that the variables are in a predictable state when they are referenced. (In C, an uninitialized variable is undefined, and could point to anything, this is dangerous; this is why member variables are often explicitly initialized in the constructor.)

4. If you look in the .h for your generated class, you'll see DATA_TCP_address(), DATA_TCP_Port(), etc.. prototypes... This is how you reference the device data. These are read-only, and you should send a CMD_Set_Device_Data message to the General_Info_Plugin, should you wish to change device data programmatically.

-Thom