function WinLIRC_ReceiveData_Program($Program, $DeviceName) {
     	IPSLogger_Com(__file__, "Received Program '$Program' from WinLIRC-Webfront, Device='$DeviceName'");
     	$ControlId = get_ControlIdByDeviceName($DeviceName, c_Control_Program);
     	if ($Program=='next') {
	     	Entertainment_SetProgramNext($ControlId);
     	} else if ($Program=='prev') {
	     	Entertainment_SetProgramPrev($ControlId);
     	} else {
	     	Entertainment_SetProgram($ControlId, $Program);
     	}
     	return GetValue($ControlId);
	}
	function Entertainment_ReceiveData($CommParams, $MessageType=c_MessageType_Action) {
		if (!Entertainment_Before_ReceiveData($CommParams, $MessageType)) {
		   return true;
		}
	
		$CommProperties = get_CommProperties($CommParams);
		if ($CommProperties !== false) {
		   $CommType   = $CommProperties[c_Property_Comm];
		   $DeviceName = $CommProperties[c_Property_Device];
			IPSLogger_Trc(__File__, 'Received Data "'.implode($CommParams, '.').'" for Device '.$DeviceName);
		   switch ($CommType) {
		      case c_Property_CommPower:
		      case c_Property_CommPower2:
		         Entertainment_SetDevicePower(get_ControlIdByDeviceName($DeviceName, c_Control_DevicePower), c_Value_Toggle, $MessageType);
		      	break;
		      case c_Property_CommPowerOn:
		      case c_Property_CommPowerOn2:
		         Entertainment_SetDevicePower(get_ControlIdByDeviceName($DeviceName, c_Control_DevicePower), true, $MessageType);
		      	break;
		      case c_Property_CommPowerOff:
		      case c_Property_CommPowerOff2:
		         Entertainment_SetDevicePower(get_ControlIdByDeviceName($DeviceName, c_Control_DevicePower), false, $MessageType);
		      	break;
		      case c_Property_CommMute:
		      case c_Property_CommMute2:
		         Entertainment_SetMuting(get_ControlIdByDeviceName($DeviceName, c_Control_Muting), c_Value_Toggle, $MessageType);
		      	break;
		      case c_Property_CommMuteOn:
		      case c_Property_CommMuteOn2:
		         Entertainment_SetMuting(get_ControlIdByDeviceName($DeviceName, c_Control_Muting), true, $MessageType);
		      	break;
		      case c_Property_CommMuteOff:
		      case c_Property_CommMuteOff2:
		         Entertainment_SetMuting(get_ControlIdByDeviceName($DeviceName, c_Control_Muting), false, $MessageType);
		      	break;
		      case c_Property_CommVol:
		      case c_Property_CommVol2:
					Entertainment_SetVolume(get_ControlIdByDeviceName($DeviceName, c_Control_Volume),
					                        (int)$CommProperties[c_Template_Value], $MessageType);
		      	break;
		      case c_Property_CommBal:
		      case c_Property_CommBal2:
					Entertainment_SetBalance(get_ControlIdByDeviceName($DeviceName, c_Control_Balance),
					                        (int)$CommProperties[c_Template_Value], $MessageType);
		      	break;
		      case c_Property_CommTre:
		      case c_Property_CommTre2:
					Entertainment_SetTreble(get_ControlIdByDeviceName($DeviceName, c_Control_Treble),
					                        (int)$CommProperties[c_Template_Value], $MessageType);
		      	break;
		      case c_Property_CommMid:
		      case c_Property_CommMid2:
					Entertainment_SetMiddle(get_ControlIdByDeviceName($DeviceName, c_Control_Middle),
					                        (int)$CommProperties[c_Template_Value], $MessageType);
		      	break;
		      case c_Property_CommBas:
		      case c_Property_CommBas2:
					Entertainment_SetBass(get_ControlIdByDeviceName($DeviceName, c_Control_Bass),
					                        (int)$CommProperties[c_Template_Value], $MessageType);
		      	break;
		      case c_Property_CommMode:
		      case c_Property_CommMode2:
		         Entertainment_SetMode(get_ControlIdByDeviceName($DeviceName, c_Control_Mode),
					                      $CommProperties[c_Template_Value], $MessageType);
		      	break;
		      case c_Property_CommRemSrc:
			      $ControlId = get_ControlIdByDeviceName($DeviceName, c_Control_RemoteSourceType);
			      $Value = $CommProperties[c_Template_Value];
		         Entertainment_SetRemoteControlType($ControlId,
					                                   $Value,
					                                   c_Control_RemoteSource);
		      	break;
		      case c_Property_CommRemVol:
		         Entertainment_SetRemoteControlType(get_ControlIdByDeviceName($DeviceName, c_Control_RemoteVolumeType),
					                                   $CommProperties[c_Template_Value],
																  c_Control_RemoteVolume);
		      	break;
		      case c_Property_CommSrc:
		      case c_Property_CommSrc2:
				   $SourceIdx  = $CommProperties[c_Property_SourceIdx];
				   $RoomName   = $CommProperties[c_Property_Room];
				   IPSLogger_Inf(__file__, "Switch Source for $RoomName to $SourceIdx");
		         Entertainment_SetSource(get_ControlIdByRoomId(get_RoomId($RoomName), c_Control_Source), $SourceIdx, $MessageType);
		      	break;
		      case c_Property_CommPrg:
		      case c_Property_CommPrg2:
		         Entertainment_SetProgram(get_ControlIdByDeviceName($DeviceName, c_Control_Program),
					                         $CommProperties[c_Template_Value], $MessageType);
		      	break;
		      case c_Property_CommPrgPrev:
		      case c_Property_CommPrgPrev2:
		         Entertainment_SetProgramPrev(get_ControlIdByDeviceName($DeviceName, c_Control_Program), $MessageType);
		      	break;
		      case c_Property_CommPrgNext:
		      case c_Property_CommPrgNext2:
		         Entertainment_SetProgramNext(get_ControlIdByDeviceName($DeviceName, c_Control_Program), $MessageType);
		      	break;
		      default:
					IPSLogger_Err(__File__, 'Found unknown CommunicationType "'.$CommType.'"');
		   }
		   Entertainment_After_ReceiveData($CommParams, $MessageType);
			return true;
		}
	   Entertainment_After_ReceiveData($CommParams, $MessageType);
		return false;
	}
	function Entertainment_SetDeviceControl($DeviceControlId, $Value) {
		$ControlType = get_ControlType($DeviceControlId);
		switch ($ControlType) {
		   case c_Control_Volume:
		      Entertainment_SetVolume($DeviceControlId, $Value);
		      break;
		   case c_Control_Balance:
		      Entertainment_SetBalance($DeviceControlId, $Value);
		      break;
		   case c_Control_Treble:
		      Entertainment_SetTreble($DeviceControlId, $Value);
		      break;
		   case c_Control_Middle:
		      Entertainment_SetMiddle($DeviceControlId, $Value);
		      break;
		   case c_Control_Bass:
		      Entertainment_SetBass($DeviceControlId, $Value);
		      break;
		   case c_Control_Muting:
		      Entertainment_SetMuting($DeviceControlId, $Value);
		      break;
		   case c_Control_Mode:
		      Entertainment_SetMode($DeviceControlId, $Value);
		      break;
		   case c_Control_Program:
		      Entertainment_SetProgram($DeviceControlId, $Value);
		      break;
		   case c_Control_Source:
		   case c_Control_RoomPower:
		   case c_Control_DevicePower:
				IPSLogger_Err(__file__, 'Controls of Type "'.$ControlType.'" cannot be handled with this function, ID='.$DeviceControlId.' !');
		      break;
			default:
				IPSLogger_Err(__file__, 'Unknown DeviceControl with ID='.$DeviceControlId.' !');
		}
	}