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

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #90 on: December 14, 2013, 12:33:41 pm »
Did two greps for XBMC and Xbmc from the log, see pastebinit below

grep Xbmc /var/log/pluto/DCERouter.log

http://pastebin.com/WQnuycZb

grep XBMC /var/log/pluto/DCERouter.log

http://pastebin.com/iJwgyB6V

Notice this while playing with the fastforward, jump buttons on orbitor, for the pause command, seems like a complaint

Quote
Received Message from 70 (Windows XP PC/tablet (Horiz) / Bedroomles) to 10 (Media Plu
g-in / Closet/Storage Space), type 1 id 41 Command:Change Playback Speed, retry none, parameters: <0x6a5b4b70>
08      12/14/13 7:26:29.332              Parameter 41(StreamID):  <0x6a5b4b70>
08      12/14/13 7:26:29.332              Parameter 43(MediaPlaybackSpeed): +2 <0x6a5b4b70>
08      12/14/13 7:26:31.166            Received Message from 70 (Windows XP PC/tablet (Horiz) / Bedroomles) to 10 (Media Plu
g-in / Closet/Storage Space), type 1 id 41 Command:Change Playback Speed, retry none, parameters: <0x6a5b4b70>
08      12/14/13 7:26:31.166              Parameter 41(StreamID):  <0x6a5b4b70>
08      12/14/13 7:26:31.166              Parameter 43(MediaPlaybackSpeed): -2 <0x6a5b4b70>
08      12/14/13 7:26:32.122            Received Message from 70 (Windows XP PC/tablet (Horiz) / Bedroomles) to 10 (Media Plu
g-in / Closet/Storage Space), type 1 id 41 Command:Change Playback Speed, retry none, parameters: <0x6a5b4b70>
08      12/14/13 7:26:32.122              Parameter 41(StreamID):  <0x6a5b4b70>
08      12/14/13 7:26:32.122              Parameter 43(MediaPlaybackSpeed): -2 <0x6a5b4b70>
08      12/14/13 7:26:33.697            Received Message from 70 (Windows XP PC/tablet (Horiz) / Bedroomles) to 10 (Media Plu
g-in / Closet/Storage Space), type 1 id 39 Command:Pause Media, retry none, parameters: <0x6a5b4b70>
08      12/14/13 7:26:33.697              Parameter 41(StreamID):  <0x6a5b4b70>
05      12/14/13 7:26:33.698            BoundRemote::UpdateOrbiter(): Updating object:  on device 21 with size of 19584 <0x867e1b70
>
05      12/14/13 7:26:33.698            BoundRemote::UpdateOrbiter(): Updating object: 2355 on device 70 with size of 19584 <0x867e
1b70>
05      12/14/13 7:26:33.698            BoundRemote::UpdateOrbiter(): Updating object: 2355 on device 73 with size of 19584 <0x867e
1b70>
08      12/14/13 7:26:33.698            Received Message from 10 (Media Plug-in / Closet/Storage Space) to 21 (OnScreen Orbit
er / Closet/Storage Space), type 1 id 242 Command:Set Now Playing, retry none, parameters: <0xa69f9b70>
08      12/14/13 7:26:33.698              Parameter 3(PK_DesignObj): 70,4964,47,140,224,230 <0xa69f9b70>
08      12/14/13 7:26:33.698              Parameter 5(Value To Assign): Xbmc <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 9(Text):  <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 29(PK_MediaType): 5 <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 41(StreamID): 1006 <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 48(Value): 0 <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 50(Name):  <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 103(List PK Device): 74,74,74,,0,1,0 <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 120(Retransmit): 0 <0xa69f9b70>
08      12/14/13 7:26:33.699            Received Message from 0 (unknown / ) to 70 (Windows XP PC/tablet (Horiz) / Bedroomles), type 1 id 32 Command:
35;1mUpdate Object Image, retry none, parameters: <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 3(PK_DesignObj): 2355 <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 14(Type): jpg <0xa69f9b70>
08      12/14/13 7:26:33.699              Parameter 23(Disable Aspect Lock): 0 <0xa69f9b70>
08      12/14/13 7:26:33.699              Data Parm 19(Data): 19584 bytes <0xa69f9b70>
08      12/14/13 7:26:33.700            Received Message from 10 (unknown / ) to 70 (Windows XP PC/tablet (Horiz) / Bedroomles), type 1 id 242 Command
:Set Now Playing, retry none, parameters: <0xa69f9b70>

This is my register code

Quote
bool Xbmc_Plugin::Register()
//<-dceag-reg-e->
{
   LoggerWrapper::GetInstance()->Write(LV_CRITICAL,"Starting Xbmc_Plugin::Register()");
  
   m_iPriority=DATA_Get_Priority();
  
   m_pMedia_Plugin=( Media_Plugin * ) m_pRouter->FindPluginByTemplate(DEVICETEMPLATE_Media_Plugin_CONST);
   m_pOrbiter_Plugin=( Orbiter_Plugin * ) m_pRouter->FindPluginByTemplate(DEVICETEMPLATE_Orbiter_Plugin_CONST);
   if( !m_pMedia_Plugin || !m_pOrbiter_Plugin )
    {
      LoggerWrapper::GetInstance()->Write(LV_CRITICAL,"Cannot find sister plugins to Xbmc plugin");
      return false;
    }
  
   vector<int> vectPK_DeviceTemplate;
   vectPK_DeviceTemplate.push_back(DEVICETEMPLATE_XBMC_MEDIA_CENTRE_CONST);
   m_pMedia_Plugin->RegisterMediaPlugin( this, this, vectPK_DeviceTemplate, true );
  
   LoggerWrapper::GetInstance()->Write(LV_CRITICAL,"Registered device %d",DEVICETEMPLATE_XBMC_MEDIA_CENTRE_CONST);
  
   RegisterMsgInterceptor(( MessageInterceptorFn )( &Xbmc_Plugin::MenuOnScreen ), 0, 0, 0, 0, MESSAGETYPE_EVENT, EVENT_Menu_Onscreen_CONST );
  
   return Connect(PK_DeviceTemplate_get());
}
« Last Edit: December 14, 2013, 12:37:45 pm by CentralMedia »

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #91 on: December 14, 2013, 01:56:04 pm »
Also did some more digging, made it my device similar with Xine Player, see  code attached.

Jump position works, speed does not seem to be sent

Quote
b1b70>
Need to implement command #65 - Jump Position In Playlist
Parm #5 - Value_To_Assign=-1
Parm #41 - StreamID=1010
Need to implement command #65 - Jump Position In Playlist
Parm #5 - Value_To_Assign=+1
Parm #41 - StreamID=1010


See also code attached and template

Also noticed, speed change and pause, is being sent to the Media Plugin, is this normal?

Do have no function in my plugin for pause and speed
« Last Edit: December 14, 2013, 01:59:36 pm by CentralMedia »

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Best Approach to Controlling a Network Device
« Reply #92 on: December 14, 2013, 07:26:11 pm »
Did two greps for XBMC and Xbmc from the log, see pastebinit below

grep Xbmc /var/log/pluto/DCERouter.log

http://pastebin.com/WQnuycZb

grep XBMC /var/log/pluto/DCERouter.log

http://pastebin.com/iJwgyB6V

in case you don't know, grep accepts -i for ignoring case.

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #93 on: December 15, 2013, 02:31:57 am »
posde thanks

tschak909

I made some change to the xbmc device template, adding the plugin as a related device.

Created another device, switched it to manual config and assigned to a room, all plays well now. I noticed once I have more than one file in the orbitor list, the Jump Position In Playlist does not get sent to the device, but actual goes through the playlist, which plays each file fine.

The speed and pause, simple gets sent to media plugin, i see no calling command on my device, even took out code, so I can get the output when not configured, no luck yet with these.

The only thing missing from Xine is keyboard stuff, IP and inherits mac, would this be my issue?

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #94 on: December 15, 2013, 06:44:01 pm »
TSCHAK909
When I hit pause, I am only seeing this when I grep of xbmc, for jump position etc, you see the command
Once
Quote
Parameter 5(Value To Assign): Xbmc <0xa73f7b70>
08      12/15/13 12:34:21.360           Received Message from 0 (unknown / ) to 83 (xbmc test / Living Room), type 1 id 92 Command:Pause, retry none, parameters: <0x4d7dfb70>
08      12/15/13 12:45:21.882           Received Message from 0 (unknown / ) to 83 (xbmc test / Living Room), type 1 id 92 Command:Pause, retry none, parameters: <0x4d7dfb70>
And on subsequent retries just below
Quote
08      12/15/13 13:33:20.496             Parameter 5(Value To Assign): Xbmc <0xa69f7b70>

I have changed the template, adding IP controlled and control categories such as Standard Orbitor, Specialized and infrared interface. I have also removed controlled by computer and select IP based, see template attached.

Have not configured any events, am assuming this is for Xine sending an event.

I put some prompts in the plugin, and realized that following chunk of code is not running, put in the Xbmc_Plugin so it would show up when I grep, also did a grep for looking, this is in my StartMedia.

Quote
for( MapEntertainArea::iterator itEA = pXbmcMediaStream->m_mapEntertainArea.begin( );itEA != pXbmcMediaStream->m_mapEntertainArea.end( );++itEA )
   {
      EntertainArea *pEntertainArea = ( *itEA ).second;
      LoggerWrapper::GetInstance()->Write( LV_STATUS, "Looking from Xbmc_Plugin into the ent area (%p) with id %d and %d remotes", pEntertainArea, pEntertainArea->m_iPK_EntertainArea, (int) pEntertainArea->m_mapBoundRemote.size() );
        for(map<int,OH_Orbiter *>::iterator it=m_pOrbiter_Plugin->m_mapOH_Orbiter.begin();it!=m_pOrbiter_Plugin->m_mapOH_Orbiter.end();++it)
        {
            OH_Orbiter *pOH_Orbiter = (*it).second;
         if( pOH_Orbiter->m_pEntertainArea!=pEntertainArea )
            continue;
         LoggerWrapper::GetInstance()->Write(LV_STATUS, "Processing from Xbmc_Plugin remote: for orbiter: %d", pOH_Orbiter->m_pDeviceData_Router->m_dwPK_Device);
         bool bBound = pEntertainArea->m_mapBoundRemote.find(pOH_Orbiter->m_pDeviceData_Router->m_dwPK_Device)!=pEntertainArea->m_mapBoundRemote.end();
         pXbmcMediaStream->SetNowPlaying(pOH_Orbiter,false,bBound);
      }
   }

Any pointers welcomed

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #95 on: December 17, 2013, 12:16:44 am »
I have added some events to the template, in an effort to see if this was needed as Xine sets this at a point.

Quote
EVENT_Playback_Started(sMediaURL,iStreamID,"","","");
      //EVENT_Menu_Onscreen(int iStream_ID,bool bOnOff);
      EVENT_Menu_Onscreen(iStreamID,onoff);

The EVENT_Menu.. is causing a CMD_Set_Media_ID to be called within my template, I went ahead and set it to register the streamID, as below, as I was assuming that one of the reason the pause of fast forward did not work is there is no streamID showing in DCERouter.log

Quote
DCE::CMD_Set_Media_ID cmd(m_dwPK_Device,DEVICETEMPLATE_General_Info_Plugin_CONST,sID,iStreamID);
   SendCommand(cmd);

I had already register within the Plugin, so it might have been a long shot
Quote
DCE::CMD_Set_Media_ID CMD_Set_Media_ID(m_dwPK_Device, pMediaStream->m_pMediaDevice_Source->m_pDeviceData_Router->m_dwPK_Device, sMediaID, pXbmcMediaStream->m_iStreamID_get());
    SendCommand(CMD_Set_Media_ID);

Also I noticed, the room which I assigned the device, when I fire off volume up, down or mute, nothing happens on the tv, which works in another room, slightly different name with the cable box.

So far no luck

Changes to the device template attached


tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #96 on: December 17, 2013, 04:15:28 am »
I'll be able to look soon, sorry I've been away, I've been trying to get an OpenStack cluster test working for work.

-Thom

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #97 on: December 17, 2013, 11:17:41 pm »
Appreciate it.

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #98 on: December 27, 2013, 06:34:50 pm »
TSCHAK909

Any luck?

Anything additional required?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #99 on: December 27, 2013, 08:45:24 pm »
Sorry, will be able to soon after the New Year, i've been knee deep in this OpenStack cluster, and trying spend time with my new family...

Have you been experimenting and looking over the other media player devices?

-Thom

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #100 on: December 28, 2013, 01:05:07 am »
That is quiet expected, its christmas, my boys kept me busy, they still believe in Santa, that's their grandma doing.

Initially I thought well the device was not registering, so I went through and change a lot of the LV_STATUS or LV_WARNING TO LV_CRITICAL in the loggerWrapper calls, as I was uncertain where it logs after not finding (/var/log/pluto/83_XBMC_MEDIA_CENTRE.log) thus sent everything to DCERouter.log for testing purposes, to see what was happening.

On realize it does seem to do what it supposed to do, I went ahead and changed the controlled by as in Xine, template attached, adding all that Xine had.

Then I thought the streamId was not being set, as when you pressed, lets say pause, it did not show a streamId in the DCERouter.log, but skip position worked and showed a streamID, so I did the following in the plugin, right after the call command to play

Quote
DCE::CMD_Set_Media_ID CMD_Set_Media_ID(m_dwPK_Device, pMediaStream->m_pMediaDevice_Source->m_pDeviceData_Router->m_dwPK_Device, sMediaID, pXbmcMediaStream->m_iStreamID_get());
    SendCommand(CMD_Set_Media_ID);

Then I added the events as Xine to the device, which I initially thought were not needed, such as playback started, playback stopped, Media Position Changed, and Menu Onscreen and fired off in the device play command as below

Quote
EVENT_Playback_Started(sMediaURL,iStreamID,"","","");
bool onoff;
EVENT_Menu_Onscreen(iStreamID,onoff);

I then implemented the CMD_Restart_Media media function as found documentation saying it supposed to work with pause, also implemented CMD_Pause, just calling CMD_Pause_Media(0)


CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #101 on: January 03, 2014, 01:17:03 pm »
TSCHAK909

I noticed something last night.

As I had adjusted the device pipes to hook to a tv in a room, the system when a movie starts, would turn the tv on and when I stop the movie, will turn the tv off.

Unfortunately, the volume up, down or mute from the orbitor, does not get sent to the TV device, it just reaches the Media Plugin, this only happens for this XBMC device attached to the TV in this room (dummy room used for testing), the cable box attached to the same tv, in another room works fine, with volume commands.

Now I am assuming its because of the type of device I created, easy to assume, LOL, but not sure how to fix this.

Also the XBMC device template, can only be used in creating a device, child of the core, cannot use it to create an A/V equipment device, is this normally?

The difference between it and the roku_telnet, is the roku telnet using a generic serial package, the XBMC device template does not.

Regards

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #102 on: January 06, 2014, 11:25:37 pm »
Went back through the Hulu and Pandora Plugin, looking to see what I missed, found something in the CreateMediaStream, where the stream ID is supposed to be assigned, but did not help, see what I missed
Quote
m_mapDevicesToStreams[pMediaDevice->m_pDeviceData_Router->m_dwPK_Device] = StreamID;

This is an excerpt from DCERouter.log, where you see
Quote
Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
is when I press pause and fast forward.
Quote
grep -i xbmc DCERouter.log
05      01/06/14 17:59:44.153           Loaded plug-in device: 81 master device: 2245 -- ./Xbmc_Plugin.so <0xb77238e0>
01      01/06/14 17:59:47.214           Starting Xbmc_Plugin::Register() <0xb77238e0>
01      01/06/14 17:59:47.215           Registered in Xbmc_Plugin device 2244 <0xb77238e0>
01      01/06/14 18:00:08.900           Returning this device 83 (xbmc test) <0x863deb70>
01      01/06/14 18:00:08.909           StartMedia Called Xbmc_Plugin <0x863deb70>
01      01/06/14 18:00:08.909           Xbmc_Plugin::StartMedia() Starting media stream playback. pos: 0 <0x863deb70>
01      01/06/14 18:00:08.909           Xbmc_Plugin::StartMedia() Media type 5 /home/public/data/videos/2.73 TB_sdb1_WDC_WD30EFRX-68 [71]/tv_shows/exercise/Shaun T Insanity/05 - Pure Cardio & Cardio Abs.avi <0x863deb70>
01      01/06/14 18:00:08.909           Looking from Xbmc_Plugin into the ent area (0xa5a01890) with id 4 and 0 remotes <0x863deb70>
01      01/06/14 18:00:08.909           Processing from Xbmc_Plugin remote: for orbiter: 70 <0x863deb70>
08      01/06/14 18:00:08.910           Received Message from 81 (Xbmc Plug-in / Closet/Storage Space) to 83 (xbmc test / Living Room), type 1 id 37 Command:Play Media, retry none, parameters: <0x95df7b70>
08      01/06/14 18:00:08.910             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:00:08.910           Received Message from 10 (Media Plug-in / Closet/Storage Space) to 83 (xbmc test / Living Room), type 1 id 192 Command:On, retry none, parameters: <0xa6ff7b70>
08      01/06/14 18:00:08.912             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:00:26.434             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:00:38.802             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:00:48.318             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:01:04.776             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:01:07.995           Received Message from 70 (Windows XP PC/tablet (Horiz) / Bedroomles) to 83 (xbmc test / Living Room), type 1 id 65 Command:Jump Position In Playlist, retry none, parameters: <0xa6ff7b70>
08      01/06/14 18:01:10.578           Received Message from 70 (Windows XP PC/tablet (Horiz) / Bedroomles) to 83 (xbmc test / Living Room), type 1 id 65 Command:Jump Position In Playlist, retry none, parameters: <0xa6ff7b70>
08      01/06/14 18:02:17.469             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:02:20.881             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:02:25.433             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:03:22.101             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>
08      01/06/14 18:04:12.961           Received Message from 81 (Xbmc Plug-in / Closet/Storage Space) to 83 (xbmc test / Living Room), type 1 id 38 Command:Stop Media, retry none, parameters: <0x953f6b70>
08      01/06/14 18:04:14.142           Received Message from 10 (Media Plug-in / Closet/Storage Space) to 83 (xbmc test / Living Room), type 1 id 193 Command:Off, retry none, parameters: <0xa6ff7b70>

I have attached the Plugin Code

CentralMedia

  • Guru
  • ****
  • Posts: 161
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #103 on: January 07, 2014, 01:22:54 am »
Would this be normal, the 0 remotes, the rest is for context

Quote
StartMedia Called Xbmc_Plugin <0x863deb70>
01      01/06/14 18:00:08.909           Xbmc_Plugin::StartMedia() Starting media stream playback. pos: 0 <0x863deb70>
01      01/06/14 18:00:08.909           Xbmc_Plugin::StartMedia() Media type 5 /home/public/data/videos/2.73 TB_sdb1_WDC_WD30EFRX-68 [71]/tv_shows/exercise/Shaun T Insanity/05 - Pure Cardio & Cardio Abs.avi <0x863deb70>
01      01/06/14 18:00:08.909           Looking from Xbmc_Plugin into the ent area (0xa5a01890) with id 4 and 0 remotes <0x863deb70>
01      01/06/14 18:00:08.909           Processing from Xbmc_Plugin remote: for orbiter: 70 <0x863deb70>
08      01/06/14 18:00:08.910           Received Message from 81 (Xbmc Plug-in / Closet/Storage Space) to 83 (xbmc test / Living Room), type 1 id 37 Command:Play Media, retry none, parameters: <0x95df7b70>
08      01/06/14 18:00:08.910             Parameter 5(Value To Assign): Xbmc <0xa6ff7b70>

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Best Approach to Controlling a Network Device
« Reply #104 on: January 07, 2014, 01:26:47 am »
I'll be able to look at it soon, sorry, I've been consumed with needing to take care of work, and a wife/daughter...It has to be something _really_ simple.

-Thom