function PurgeLogFiles($Directory, $Extension, $ID_OutSwitch, $ID_OutDays) {
	   if (GetValue($ID_OutSwitch)) {
			IPSLogger_Dbg(c_LogId, 'Purging *.'.$Extension.' LogFiles in Directory '.$Directory);
			$Days = GetValue($ID_OutDays);
			$ReferenceDate=Date('Ymd', strtotime("-".$Days." days"));
		   if ($Directory == "") {
				$Directory = IPS_GetKernelDir().'logs\\';
		   }

			if (($handle=opendir($Directory))===false) {
			   IPSLogger_Err(c_LogId, 'Error Opening Directory '.$Directory);
				Exit;
			}

			while (($File = readdir($handle))!==false) {
		      $FileDate      = substr($File, strlen('IPSLogger_'), 8);
		      $FileExtension = substr($File, strlen('IPSLogger_')+8+1, 3);
		      if ($Extension==$FileExtension) {
					IPSLogger_Trc(c_LogId, 'Found File: '.$File.', FileDate='.$FileDate.', RefDate='.$ReferenceDate);
					if ($FileDate < $ReferenceDate) {
						IPSLogger_Inf(c_LogId, 'Delete LogFile: '.$Directory.$File);
					   unlink($Directory.$File);
					}
				}
			}
			closedir($handle);
		}
	}
	function Entertainment_Before_SendData($Parameters) {
		if ($Parameters[0]==c_Comm_WinLIRC and $Parameters[1]=='yamahareceiver') {
			$Button      = $Parameters[2];

			// Special Handling for Muting of YamahaReceiver: Use InputSelector Phone for Muting,
			// Switch back to current Input when Muting Off
			// ==================================================================================
			if ($Button == "muteon") {
				IPSLogger_Dbg(__file__, "Set Muting 'On' for Yamaha Receiver (Switch to Phone Input)");
            WinLIRC_SendData(array(c_Comm_WinLIRC, 'yamahareceiver', 'phone'));
				return false; // Abort current Processing

			} else if ($Button=='muteoff') {
				$RoomId = get_RoomId(c_Room_LivingRoom);
				$SourceIdx = get_SourceIdxByRoomId($RoomId);
		   	Entertainment_SendDataBySourceIdx($RoomId, $SourceIdx, c_MessageType_Action);
				return false; // Abort current Processing

		   // Special Handling for Yamaha Tuner, YamahaReceiver supports only Previous/Next Station for Tuner
		   // --> Simulate Buttons for Station "1" - "8" by Previous and Next.
	   	// ===============================================================================================
			} else if ($Button == "0" or $Button == "1" or $Button == "2" or $Button == "3" or $Button == "4" or
			           $Button == "5" or $Button == "6" or $Button == "7") {
				$ControlId   = get_ControlIdByDeviceName(c_Device_YamahaTuner, c_Control_Program);
				$StationNew  = GetValue($ControlId);
				$StationObj  = IPS_GetObject($ControlId);
				$StationCurr = $StationObj["ObjectInfo"];
				IPSLogger_Trc(__file__, "Switch YamahaTuner from StationCurrent=".$StationCurr." to  StationNew=".$StationNew);

				if ($StationNew-$StationCurr <= 4 and $StationNew-$StationCurr >= 0) {
				   $IRButton = 'presetnext';
					$Count = $StationNew-$StationCurr;
				} else if (($StationCurr-$StationNew) < 0) {
				   $IRButton = 'presetlast';
					$Count = 8-($StationNew-$StationCurr);
				} else if (($StationCurr-$StationNew) <= 4) {
				   $IRButton = 'presetlast';
					$Count = $StationCurr-$StationNew;
				} else {
				   $IRButton = 'presetnext';
					$Count = 8-$StationCurr+$StationNew;
				}

				IPS_SetInfo ($ControlId, $StationNew);
				IPSLogger_Dbg(__file__, "Switch Yamaha TunerStation from ".$StationCurr." to ".$StationNew." ==> ".$Count."x ".$IRButton);
				for ($idx=1; $idx<=$Count; $idx++) {
					include_once "Entertainment_InterfaceWinLIRC.ips.php";
               WinLIRC_SendData(array(c_Comm_WinLIRC, 'yamahareceiver', $IRButton));
					sleep(0.2);
				}
				return false; // Abort current Processing
			}
		}
		return true;
	}
Пример #3
0
	function Entertainment_SetRoomVisible($PowerId, $Value) {
	   $RoomConfig   = get_RoomConfiguration();
	   $RoomId        = IPS_GetParent($PowerId);
	   $RoomName      = IPS_GetName($RoomId);
	   $WFRoomName   = $RoomConfig[$RoomName][c_Property_Name];
	   if ($WFRoomName=="") return;
	   $WFRoomId     = IPS_GetCategoryIDByName($WFRoomName, c_ID_WebFrontRoomes);

		$ChildrenIds = IPS_GetChildrenIDs($WFRoomId);
		foreach($ChildrenIds as $ChildrenIdx => $ChildrenId) {
		   if (IPS_LinkExists($ChildrenId)) {
			   $LinkData = IPS_GetLink($ChildrenId);
			   $LinkedChildId = $LinkData["LinkChildID"];
		  		if ($LinkedChildId <> $PowerId) {
		    		IPSLogger_Trc(__file__, 'Set Control "'.IPS_GetName($ChildrenId).'" of Room "'.IPS_GetName($RoomId).'" Visible='.bool2OnOff($Value));
		  			IPS_SetHidden($ChildrenId, !$Value);
		  		}
			} else {
		  	   $GroupSwitchId = get_ControlIdByRoomId($RoomId, c_Control_Group);
		 		IPS_SetHidden($ChildrenId, !GetValue($GroupSwitchId) or !$Value);
			}
		}
	}
Пример #4
0
	function Entertainment_SetDevicePowerByDeviceName($DeviceName, $Value, $MessageType=c_MessageType_Action) {
		IPSLogger_Trc(__file__, 'Handle Device Power for "'.$DeviceName.'" '.bool2OnOff($Value));
		$PowerId = get_ControlIdByDeviceName($DeviceName, c_Control_DevicePower, false);
		if ($PowerId!==false) {
		   if (!is_bool($Value)) { 												/*Toggle Power Value*/
      		$Value = !GetValue($PowerId);
				IPSLogger_Dbg(__file__, "Toogle Device Power for '$DeviceName' to ".bool2OnOff($Value));
   		}
			if (GetValue($PowerId) <> $Value) {
				IPSLogger_Inf(__file__, 'Set Device Power for "'.$DeviceName.'" '.bool2OnOff($Value));
				if ($Value) {
					Entertainment_SendDataByDeviceName($DeviceName, c_Control_DevicePower,
																	array(c_Property_CommPowerOn, c_Property_CommPower), $MessageType);
				} else {
					Entertainment_SendDataByDeviceName($DeviceName, c_Control_DevicePower,
																	array(c_Property_CommPowerOff, c_Property_CommPower), $MessageType);
				}
				SetValue($PowerId, $Value);
				Entertainment_Connect($DeviceName, $Value, true);
				Entertainment_SetDeviceControlByDeviceName($DeviceName, c_Control_Muting, false);
		      Entertainment_SetRoomPowerByDeviceName($DeviceName, $Value);
			}
		}
	}
Пример #5
0
	 *
	 * @file          NetPlayer_Receiver.php
	 * @author        Andreas Brauneis
	 * @version
	 * Version 2.50.1, 31.01.2012<br/>
	 *
	 * Empfangs Script um Requests (JQuery) der HTML Seiten zu bearbeiten.
	 * Das Script wird durch die Java Script Funktionen im File NetPlayer_Sender.php getriggert.
	 *
	 */

	$id = $_GET['id'];
	IPSUtils_Include ("NetPlayer.inc.php", "IPSLibrary::app::modules::NetPlayer");

	if ($id<>"rc_mp_current" and $id<>"rc_mp_status" and $id<>"rc_mp_length"  and $id<>"rc_mp_interpret" and $id<>"rc_mp_album" and $id<>"rc_mp_titel") {
		IPSLogger_Trc(__file__, "RECEIVED Command '$id'");
	}
	
	// Player Control
	if ($id=="rc_mp_play") {
		NetPlayer_Power(true);
	} else if ($id=="rc_mp_last") {
		NetPlayer_Prev();
	} else if ($id=="rc_mp_next") {
		NetPlayer_Next();
	} else if ($id=="rc_mp_pause") {
		NetPlayer_Pause();
	} else if ($id=="rc_mp_stop") {
		NetPlayer_Power(false);

	// Player State and Data
Пример #6
0
	 * @{
	 *
	 * @file          IPSLogger_SendMail.ips.php
	 * @author        Andreas Brauneis
	 * @version
	 * Version 2.50.1, 31.01.2012<br/>
	 *
	 * Versenden von Mails
	 *
	 * Dieses Script wird vom Script IPSLogger_Output.ips.php durch einen Timer aufgerufen.
	 *
	 */
	include_once "IPSLogger.inc.php";
	define ("c_LogId", "IPSLogger_SendMail");

	IPSLogger_Trc(c_LogId, 'Execute SendEmail for Messages of IPSLogger');

	$MsgList = GetValue(c_ID_EMailOutMsgList);
	if ($MsgList <> "") {
	   if (c_EMail_Address1 <> "") {
			IPSLogger_Dbg(c_LogId, 'Send ErrorMail to '.c_EMail_Address1);
			SMTP_SendMailEx(c_ID_SmtpDevice, c_EMail_Address1,
			                c_EMail_Subject, $MsgList."\n\n".c_EMail_Signature);
		} else {
			IPSLogger_Dbg(c_LogId, 'Send ErrorMail to default SMTP EMail-Address: ');
		   SMTP_SendMail(c_ID_SmtpDevice, "IP-Symcon Error(s)",  $MsgList."\n\n".c_EMail_Signature);
		}
	   if (c_EMail_Address2 <> "") {
			IPSLogger_Dbg(c_LogId, 'Send ErrorMail to '.c_EMail_Address2);
		   SMTP_SendMailEx(c_ID_SmtpDevice, c_EMail_Address2,
			                c_EMail_Subject, $MsgList."\n\n".c_EMail_Signature);
		/**
		 * @public
		 *
		 * Zustand Setzen 
		 *
		 * @param boolean $value Wert für Schalter
		 */
		public function SetState($value) {
			IPSLogger_Trc(__file__, 'Activate Dummy-Switch "'.$this->instanceId.'", Value='.($value?'On':'Off'));
		}
		/**
		 * @public
		 *
		 * Stop
		 */
		public function Stop() {
			IPSLogger_Trc(__file__, 'Activate "Stop" of "DummyShutter" "'.$this->instanceId.'"');
		}
Пример #9
0
		private function ReceiveCodeScript($object) {
			IPSLogger_Trc(__file__, 'Received CategoryCode='.$object['Cmd'].' for ScriptId='.$object['Id'].' from EDIP');
			IPS_RunScriptWaitEx((int)$object['Id'], array( 'IPS_SENDER'=>'WebFront', 'IPS_VALUE'=>null, 'IPS_VARIABLE'=>null, 'REMOTE_ADDR'=>null));
		}
Пример #10
0
	include_once "IPSEDIP.class.php";

	$eventName = IPS_GetName($_IPS['EVENT']);

	foreach (IPSEDIP_GetConfiguration() as $configId=>$configData) {
		if (substr($eventName,0,strlen($configId))==$configId) {

			if ($configData[EDIP_CONFIG_REFRESHMETHOD]==EDIP_REFRESHMETHOD_EVENT or
			    $configData[EDIP_CONFIG_REFRESHMETHOD]==EDIP_REFRESHMETHOD_BOTH) {

				$result = IPS_SemaphoreEnter($configId, 0);
				if (!$result) {
				   IPSLogger_Trc(__file__, "Refresh is already in Process - ignore ...");
					return;
				}
				IPSLogger_Trc(__file__, "Refresh EDIP by Event=$eventName");
				IPS_Sleep(1000);
				IPS_SemaphoreLeave($configId);


				$instanceClass = $configData[EDIP_CONFIG_CLASSNAME];
				$instanceId    = IPS_GetObjectIDByIdent($configId, EDIP_ID_PROGRAM);

				include_once $instanceClass.'.class.php';
				$edip = new $instanceClass($instanceId);
				$edip->RefreshDisplay();
			}
		}
	}

	/** @}*/
	function WinLIRC_ReceiveData_Translation(&$Control, &$Button) {
	   $CommConfig = get_CommunicationConfiguration();
	   $TranslationList = $CommConfig[c_Comm_WinLIRC][c_Property_InpTranslationList];
	   if (array_key_exists($Control.'.'.$Button, $TranslationList)) {
	      $Data = explode('.', $TranslationList[$Control.'.'.$Button]);
     		IPSLogger_Trc(__file__, "Translate RemoteMessage $Control.$Button -> $Data[0].$Data[1]");
	      $Control = $Data[0];
	      $Button  = $Data[1];
	   } else if (array_key_exists($Control, $TranslationList)) {
	      $ControlNew = $TranslationList[$Control];
     		IPSLogger_Trc(__file__, "Translate RemoteMessage $Control.$Button -> $ControlNew.$Button");
	      $Control = $TranslationList[$Control];
		} else {
		  // Nothing to Translate ...
		}
	}
Пример #12
0
	function CalculateCurrentValues($categoryId_Values, $scriptId_Refresh) {
		IPSLogger_Trc(__file__, 'Calculate Sunrise for current Day');

		$timestamp               = time();
		$sunrise                 = date_sunrise($timestamp, SUNFUNCS_RET_TIMESTAMP, IPSTWILIGHT_LATITUDE, IPSTWILIGHT_LONGITUDE, 90+50/60, date("O")/100);
		$sunset                  = date_sunset ($timestamp, SUNFUNCS_RET_TIMESTAMP, IPSTWILIGHT_LATITUDE, IPSTWILIGHT_LONGITUDE, 90+50/60, date("O")/100);
		$civilTwilightStart      = date_sunrise($timestamp, SUNFUNCS_RET_TIMESTAMP, IPSTWILIGHT_LATITUDE, IPSTWILIGHT_LONGITUDE, 96, date("O")/100);
		$civilTwilightEnd        = date_sunset ($timestamp, SUNFUNCS_RET_TIMESTAMP, IPSTWILIGHT_LATITUDE, IPSTWILIGHT_LONGITUDE, 96, date("O")/100);
		$nauticTwilightStart     = date_sunrise($timestamp, SUNFUNCS_RET_TIMESTAMP, IPSTWILIGHT_LATITUDE, IPSTWILIGHT_LONGITUDE, 102, date("O")/100);
		$nauticTwilightEnd       = date_sunset ($timestamp, SUNFUNCS_RET_TIMESTAMP, IPSTWILIGHT_LATITUDE, IPSTWILIGHT_LONGITUDE, 102, date("O")/100);
		$astronomicTwilightStart = date_sunrise($timestamp, SUNFUNCS_RET_TIMESTAMP, IPSTWILIGHT_LATITUDE, IPSTWILIGHT_LONGITUDE, 108, date("O")/100);
		$astronomicTwilightEnd   = date_sunset ($timestamp, SUNFUNCS_RET_TIMESTAMP, IPSTWILIGHT_LATITUDE, IPSTWILIGHT_LONGITUDE, 108, date("O")/100);

		IPSLogger_Dbg (__file__, "Calculation of Sunrise: ".date("H:i", $sunrise).'  -  '.date("H:i", $sunset));
		IPSLogger_Dbg (__file__, "Calculation of CivilTwilight: ".date("H:i", $civilTwilightStart).' - '.date("H:i", $civilTwilightEnd));
		IPSLogger_Dbg (__file__, "Calculation of NauticTwilight: ".date("H:i", $nauticTwilightStart).' - '.date("H:i", $nauticTwilightEnd));
		IPSLogger_Dbg (__file__, "Calculation of AstronomicTwilight: ".date("H:i", $astronomicTwilightStart).' - '.date("H:i", $astronomicTwilightEnd));

		SetValue( IPS_GetVariableIDByName('SunriseBegin',   $categoryId_Values), date("H:i", $sunrise));
		SetValue( IPS_GetVariableIDByName('SunriseEnd',     $categoryId_Values), date("H:i", $sunset));
		SetValue( IPS_GetVariableIDByName('SunriseDisplay', $categoryId_Values), date("H:i", $sunrise).' - '.date("H:i",$sunset));
		SetLimitedValues('SunriseLimits', 'SunriseBeginLimited', 'SunriseEndLimited', $sunrise, $sunset, $categoryId_Values, $scriptId_Refresh);

		SetValue( IPS_GetVariableIDByName('CivilBegin',   $categoryId_Values), date("H:i", $civilTwilightStart));
		SetValue( IPS_GetVariableIDByName('CivilEnd',     $categoryId_Values), date("H:i", $civilTwilightEnd));
		SetValue( IPS_GetVariableIDByName('CivilDisplay', $categoryId_Values), date("H:i", $civilTwilightStart).' - '.date("H:i",$civilTwilightEnd));
		SetLimitedValues('CivilLimits', 'CivilBeginLimited', 'CivilEndLimited', $civilTwilightStart, $civilTwilightEnd, $categoryId_Values, $scriptId_Refresh);

		SetValue( IPS_GetVariableIDByName('NauticBegin',   $categoryId_Values), date("H:i", $nauticTwilightStart));
		SetValue( IPS_GetVariableIDByName('NauticEnd',     $categoryId_Values), date("H:i", $nauticTwilightEnd));
		SetValue( IPS_GetVariableIDByName('NauticDisplay', $categoryId_Values), date("H:i", $nauticTwilightStart).' - '.date("H:i",$nauticTwilightEnd));
		SetLimitedValues('NauticLimits', 'NauticBeginLimited', 'NauticEndLimited', $nauticTwilightStart, $nauticTwilightEnd, $categoryId_Values, $scriptId_Refresh);

		SetValue( IPS_GetVariableIDByName('AstronomicBegin',   $categoryId_Values), date("H:i", $astronomicTwilightStart));
		SetValue( IPS_GetVariableIDByName('AstronomicEnd',     $categoryId_Values), date("H:i", $astronomicTwilightEnd));
		SetValue( IPS_GetVariableIDByName('AstronomicDisplay', $categoryId_Values), date("H:i", $astronomicTwilightStart).' - '.date("H:i",$astronomicTwilightEnd));
		SetLimitedValues('AstronomicLimits', 'AstronomicBeginLimited', 'AstronomicEndLimited', $astronomicTwilightStart, $astronomicTwilightEnd, $categoryId_Values, $scriptId_Refresh);
	}
Пример #13
0
	function NetPlayer_Power($value) {
	   // Set Power State
		if ($value != GetValue(NP_ID_POWER)) {
         SetValue(NP_ID_POWER, $value);
			NetPlayer_RefreshRemoteControl();
		}
		$plaverState = GetValue(NP_ID_CONTROL);
		
		// Set Player Control
		if ($value and $plaverState<>NP_IDX_CONTROLPLAY) {
		   IPSLogger_Trc(__file__, 'Start Netplayer');
		   SetValue(NP_ID_CONTROL, NP_IDX_CONTROLPLAY);
			NetPlayer_GetIPSComponentPlayer()->Play();
		}
		if (!$value and $plaverState<>NP_IDX_CONTROLSTOP) {
		   IPSLogger_Trc(__file__, 'Stop Netplayer');
		   SetValue(NP_ID_CONTROL, NP_IDX_CONTROLSTOP);
			NetPlayer_GetIPSComponentPlayer()->Stop();
		}
	}
	
	// ----------------------------------------------------------------------------------------------------------------------------
	// Some Tests
	// ----------------------------------------------------------------------------------------------------------------------------
	IPSUtils_Include ("IPSLogger.inc.php", "IPSLibrary::app::core::IPSLogger");

	//  Some Test Messages
	IPSLogger_Fat(__file__, 'Test for a Fatal Error');
	IPSLogger_Err(__file__, 'Test for a Error ...');
	IPSLogger_Wrn(__file__, 'Test for a Warning');
	IPSLogger_Not(__file__, 'Test for a Notification with Priority 0 (High)');
	IPSLogger_Not(__file__, 'Test for a Notification with Priority 10 (Low)');
 	IPSLogger_Inf(__file__, 'Test for a Information Message ...');
 	IPSLogger_Dbg(__file__, 'Test for a Debug Message ...');
 	IPSLogger_Com(__file__, 'Test for a Communication Message ...');
 	IPSLogger_Trc(__file__, 'Test for a Trace Message ...');
 	IPSLogger_Tst(__file__, 'Test for a Test Message ...');

	// ------------------------------------------------------------------------------------------------
	function Register_PhpErrorHandler($moduleManager) {
		$file = IPS_GetKernelDir().'scripts\\__autoload.php';

		if (!file_exists($file)) {
			throw new Exception($file.' could NOT be found!', E_USER_ERROR);
		}
		$FileContent = file_get_contents($file);

		$pos = strpos($FileContent, 'IPSLogger_PhpErrorHandler.inc.php');

		if ($pos === false) {
			$includeCommand = '    IPSUtils_Include("IPSLogger_PhpErrorHandler.inc.php", "IPSLibrary::app::core::IPSLogger");';
		$forcast = ExtractData($forcast, '</p>', '<div class="webcamLinks">', true, false);
		$forcastTomorrow  = '<h2>'.ExtractData($forcast, '<h2>', '</h2>').'</h2>'.ExtractData($forcast, '<p>', '</p>', false, false);

		$forcast = ExtractData($forcast, '</p>', '<div class="webcamLinks">', true, false);
		$forcastTomorrow1 = '<h2>'.ExtractData($forcast, '<h2>', '</h2>').'</h2>'.ExtractData($forcast, '<p>', '</p>', false, false);

		$forcast = ExtractData($forcast, '</p>', '<div class="webcamLinks">', true, false);
		$forcastTomorrow2 = '<h2>'.ExtractData($forcast, '<h2>', '</h2>').'</h2>'.ExtractData($forcast, '<p>', '</p>', false, false);

		IPSWeatherFAT_SetValue('TodayForecastLong',     $forcastToday);
		IPSWeatherFAT_SetValue('TomorrowForecastLong',  $forcastTomorrow);
		IPSWeatherFAT_SetValue('Tomorrow1ForecastLong', $forcastTomorrow1);
		IPSWeatherFAT_SetValue('Tomorrow2ForecastLong', $forcastTomorrow2);

	} else {
		IPSLogger_Trc(__file__, "No Connection - Refresh of Weather Data NOT possible");

	}


	function ExtractData($data, $key1, $key2, $removeKey1=true, $removeKey2=true) {
	   $strPos1 = strpos($data, $key1);
	   $strPos2 = strpos($data, $key2);
	   if ($removeKey1 and $removeKey2) {
	   	$result  =substr($data, $strPos1+strlen($key1), $strPos2-$strPos1-strlen($key1));
	   } elseif ($removeKey1) {
	   	$result  =substr($data, $strPos1+strlen($key1), $strPos2-$strPos1-strlen($key1)+strlen($key2));
	   } elseif ($removeKey2) {
	   	$result  =substr($data, $strPos1, $strPos2-$strPos1-strlen($key2));
	   } else {
	   	$result  =substr($data, $strPos1, $strPos2-$strPos1+strlen($key2));
	function Entertainment_SendData($DeviceName, $ControlType, $CommParams, $CommType) {
      $CommConfig     = get_CommunicationConfiguration();
      $CommInterface  = $CommParams[0];
		$FunctionName   = $CommConfig[$CommInterface][c_Property_FunctionSnd];
		$FunctionScript = $CommConfig[$CommInterface][c_Property_ScriptSnd];
		$FunctionParameters = array();
		foreach ($CommParams as $CommIdx=>$CommParam) {
		   if ($CommParam==c_Template_Value) {
			   $FunctionParameters[] = GetValue(get_ControlIdByDeviceName($DeviceName, $ControlType));
		   } else if ($CommParam==c_Template_Code) {
		      $DeviceConfig = get_DeviceConfiguration();
		      $Value = GetValue(get_ControlIdByDeviceName($DeviceName, $ControlType));
			   $FunctionParameters[] = $DeviceConfig[$DeviceName][$ControlType][c_Property_Codes][$Value];
			} else {
			   $FunctionParameters[] = $CommParam;
			}
		}
		if (!Entertainment_Before_SendData($FunctionParameters)) {
		   return;
		}
	   IPSLogger_Trc(__file__, 'SendData '.$CommInterface.'.'.$FunctionName.'('.implode(',',$FunctionParameters).')');
		try {
			include_once $FunctionScript;
			$Function       = new ReflectionFunction($FunctionName);
			$Function->invoke($FunctionParameters);
		} catch (Exception $e) {
	     	IPSLogger_Err(__file__, 'Error Executing Function '.$FunctionName.':'.$e->getMessage());
		}
  		Entertainment_After_SendData($FunctionParameters);
	}
Пример #17
0
	function Entertainment_SyncRoomControls($RoomId) {
		$RoomName     = IPS_GetName($RoomId);
		$RoomPower    = GetValue(get_ControlIdByRoomId($RoomId, c_Control_RoomPower));
	   $RoomConfig   = get_RoomConfiguration();
	   $ControlTypes = $RoomConfig[$RoomName];
	   foreach ($ControlTypes as $ControlType=>$ControlData) {
			if ($ControlType==c_Control_Muting or
				 $ControlType==c_Control_Volume or
				 $ControlType==c_Control_Balance or
				 $ControlType==c_Control_Treble or
				 $ControlType==c_Control_Middle or
				 $ControlType==c_Control_Bass or
				 $ControlType==c_Control_Program or
			    $ControlType==c_Control_RemoteVolume or
			    $ControlType==c_Control_iRemoteVolume or
			    $ControlType==c_Control_RemoteSource or
			    $ControlType==c_Control_iRemoteSource or
			    $ControlType==c_Control_Mode) {
				$RoomControlId   = get_ControlIdByRoomId($RoomId, $ControlType);
				$DeviceControlId = get_DeviceControlIdByRoomControlId($RoomControlId);

				if ($DeviceControlId===false and $ControlType==c_Control_iRemoteVolume) {
					$DeviceControlId = get_DeviceControlIdByRoomControlId($RoomControlId, c_Control_RemoteVolume);
				} else if ($DeviceControlId===false and $ControlType==c_Control_iRemoteSource) {
					$DeviceControlId = get_DeviceControlIdByRoomControlId($RoomControlId, c_Control_RemoteSource);
				} else {
				  //
				}

				IPSLogger_Trc(__file__,'Sync Room="'.$RoomName.'", Control="'.$ControlType.'", DeviceControlId='.$DeviceControlId);
				if ($DeviceControlId!==false) {
					SetValue($RoomControlId, GetValue($DeviceControlId));
					Entertainment_SetRoomControlVisibility($RoomControlId, $RoomPower);
				} else {
					Entertainment_SetRoomControlVisibility($RoomControlId, false);
				}
			}
	   }
	}
Пример #18
0
	function NetPlayer_RefreshTrackListValue() {
		$currentIdx    = -1;
		$player = NetPlayer_GetIPSComponentPlayer();
		$currentName   = $player->GetTrackName();
		$currentName   = NetPlayer_GetTrackName($currentName);
		$currentName   = str_replace(GetValue(NP_ID_CDINTERPRET).' - ', '', $currentName);

		$profileData   = IPS_GetVariableProfile('NetPlayer_CDTrackList');
		$associations  = $profileData['Associations'];
		foreach ($associations as $idx=>$data) {
			IPSLogger_Trc(__file__, "Idx=$idx, '$currentName' --> '".$data['Name']."'");
			if ($currentName == $data['Name']) {
			   $currentIdx = $data['Value'];
			}
		}
		if (GetValue(NP_ID_CDTRACKLIST)<>$currentIdx ) {
		   SetValue(NP_ID_CDTRACKLIST, $currentIdx);
		}
	}
Пример #19
0
	IPSLogger_Trc(__file__, 'Received: '.$log);


	// Message beyond minimum Length
	if (strlen($message) < 4) {
	   RegVar_SetBuffer($registerId, $message);
		IPSLogger_Trc(__file__, 'Message beyond minimum Length of 4');
	   return;
	}

	$messageLength = ord(substr($message, 2,2));

	// Message beyond Message Length (esc cmd len data[])
	if (strlen($message) < 3+$messageLength) {
	   RegVar_SetBuffer($registerId, $message);
		IPSLogger_Trc(__file__, 'Message beyond Message Length of '.$messageLength);
	   return;
	}

	foreach (IPSEDIP_GetConfiguration() as $configId=>$configData) {
		if ($configData[EDIP_CONFIG_REGISTER]==$registerId) {
			$instanceClass = $configData[EDIP_CONFIG_CLASSNAME];
			$instanceId    = IPS_GetObjectIDByIdent($configId, EDIP_ID_PROGRAM);

			include_once $instanceClass.'.class.php';
			$edip = new $instanceClass($instanceId);
			$edip->receiveText($message);
		}
	}

	/** @}*/