Lighting Plugin

From LinuxMCE
Jump to: navigation, search
Version Status Date Updated Updated By
710 Unknown N/A N/A
810 Unknown N/A N/A
1004 Unknown N/A N/A
1204 Unknown N/A N/A
Usage Information

Description

Lighting plugin takes care of lighting devices. Handles commands, events and sets according device states. It also gives content to Orbiter plugin when it renders Lighting devices on Orbiter's floorplans. Although, in 710 no info is displayed beside Lighting devices on floorplan - have yet to discover what is the cause....

Important Code snippets

Lighting_Plugin::GetFloorplanDeviceInfo

This method determines what group of commands will be shown on right column beside floorplan. In the last if, it also determines what will be displayed on floorplan (OSD string is the content that will be displayed on floorplan)... It also determines the color of object on floorplan. But since state of lighting device is something like XX/NN) where :

  1. XX means ON or OFF state of device
  2. NN means Level (0 for OFF, up to 100 for ON)

It seems that OSD is set to show all state info on floorplan. Don't know why this isn't so. Anyway, it can also be seen that all lights have dimmable controls, while if device is in Lighting Category and not one of predefined light types, then it gets only On/Off controls on Orbiter.

IMHO such behaviour should be determined on base of device template, not object type. In such situation, dimmable controls are also displayed for on/off light switches, which is not correct (although we probably got used to that). But this clearly explains that you get On/Off floorplan controls for instance for brightness sensor.

I just wonder what is the correct path out of this inconsistency. Is it adding new floorplan types for on/off lights or determine command groups by device template and not floorplan type... ???


Code of highlighted method:

void Lighting_Plugin::GetFloorplanDeviceInfo(DeviceData_Router *pDeviceData_Router,EntertainArea *pEntertainArea,int iFloorplanObjectType,int &iPK_FloorplanObjectType_Color,int &Color,string &sDescription,string &OSD,int &PK_DesignObj_Toolbar)
{
	switch(iFloorplanObjectType)
	{
	case FLOORPLANOBJECTTYPE_LIGHT_CEILING_LIGHT_CONST:
	case FLOORPLANOBJECTTYPE_LIGHT_TABLE_LAMP_CONST:
	case FLOORPLANOBJECTTYPE_LIGHT_WALL_SCONCE_CONST:
	case FLOORPLANOBJECTTYPE_LIGHT_FLOOR_LAMP_CONST:
	case FLOORPLANOBJECTTYPE_LIGHT_CHANDALIER_CONST:
	case FLOORPLANOBJECTTYPE_LIGHT_PICTURE_LIGHT_CONST:
	case FLOORPLANOBJECTTYPE_LIGHT_ACCENT_LIGHT_CONST:
		OSD = pDeviceData_Router->m_sState_get();
		if(OSD.find("OFF") != string::npos)
			iPK_FloorplanObjectType_Color = FLOORPLANOBJECTTYPE_COLOR_LIGHT_CEILING_LIGHT_OFF_CONST;
		else
			iPK_FloorplanObjectType_Color = FLOORPLANOBJECTTYPE_COLOR_LIGHT_CEILING_LIGHT_ON_CONST;

		PK_DesignObj_Toolbar=DESIGNOBJ_grpLightControls_CONST;
		break;
	default:
		OSD = pDeviceData_Router->m_sState_get();
		if(OSD.find("OFF") != string::npos)
			iPK_FloorplanObjectType_Color = FLOORPLANOBJECTTYPE_COLOR_LIGHT_CEILING_LIGHT_OFF_CONST;
		else
			iPK_FloorplanObjectType_Color = FLOORPLANOBJECTTYPE_COLOR_LIGHT_CEILING_LIGHT_ON_CONST;

		PK_DesignObj_Toolbar=DESIGNOBJ_grpLightControlsOnOff_CONST;
		break;
	};
}

Lighting_Plugin:: Commands and Events

This one processes received messages/events. It can beclearly seen that currently following commands :

	if( pMessage->m_dwID==COMMAND_Set_Level_CONST )
	if( pMessage->m_dwID==COMMAND_Generic_On_CONST )
	else if( pMessage->m_dwID==COMMAND_Generic_Off_CONST )

and events

	if( pMessage->m_dwID == EVENT_Device_OnOff_CONST )
	else if (pMessage->m_dwID == EVENT_State_Changed_CONST) 
        Follow me events
        Get_Video_Frame  (probably cause of automatic lighting on cameras)

are processed.


How to use Lighting devices in Orbiter

Potential problems with current content of Lighting Plugin

'My personal comment(Bulek):

  • Inconsistency of group commands with device template :

Either group of commands should be determined by device template or we should have separate floorplan objects for separate command groups. Don't know which one or third path is correct in here. Any opinions ?


  • why is not state info actually drawn on floorplans ? it seems that OSD is properly set up - the cause must be somewhere else... I guess similar problem is with Blinds, Drapes and Shutter devices...

My plans:

  • I plan to correct that behaviour, if leading developers confirm the right way to do it.
  • I also plan to support use of yet unsupported color gray (if light is dimmed) like:
On 	LIGHT_CEILING_LIGHT_ON 		-256 			yellow
Off 	LIGHT_CEILING_LIGHT_OFF 	-16777216               black
Dim 	LIGHT_CEILING_LIGHT_DIM 	-4144960  		bright gray
Same goes for :
LIGHT_TABLE_LAMP,LIGHT_WALL_SCONCE,LIGHT_FLOOR_LAMP,LIGHT_CHANDALIER,LIGHT_PICTURE_LIGHT,LIGHT_ACCENT_LIGHT

Bulek 15:37, 2 December 2008 (CET)