-
Notifications
You must be signed in to change notification settings - Fork 1
/
Entertainment_Custom.ips.php
77 lines (65 loc) · 3.41 KB
/
Entertainment_Custom.ips.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?
include_once "Entertainment.ips.php";
//include_once "Entertainment_InterfaceWinLIRC.ips.php";
// ---------------------------------------------------------------------------------------------------------------------------
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;
}
// ---------------------------------------------------------------------------------------------------------------------------
function Entertainment_After_SendData($Parameters) {
}
// ---------------------------------------------------------------------------------------------------------------------------
function Entertainment_Before_ReceiveData($Parameters, $MessageType) {
return true;
}
// ---------------------------------------------------------------------------------------------------------------------------
function Entertainment_After_ReceiveData($Parameters, $MessageType) {
}
?>