Skip to content

Commit aa39ec1

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/HEOS-ChangeEvents'
2 parents 19b7409 + 57bc795 commit aa39ec1

File tree

4 files changed

+191
-3
lines changed

4 files changed

+191
-3
lines changed

hardware/HEOS.cpp

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void CHEOS::ParseLine()
9191
if (DEBUG_LOGGING) _log.Log(LOG_NORM, "DENON by HEOS: No players found (No Payload).");
9292
}
9393
}
94-
else if (root["heos"]["command"] == "player/get_play_state" || root["heos"]["command"] == "player/set_play_state")
94+
else if (root["heos"]["command"] == "player/get_play_state" || root["heos"]["command"] == "player/set_play_state" || root["heos"]["command"] == "event/player_state_changed")
9595
{
9696
if (root["heos"].isMember("message"))
9797
{
@@ -126,6 +126,8 @@ void CHEOS::ParseLine()
126126
int PlayerID = atoi(pid.c_str());
127127
SendCommand("getNowPlaying", PlayerID);
128128
}
129+
130+
m_lastUpdate = 0;
129131
}
130132
}
131133
}
@@ -171,10 +173,43 @@ void CHEOS::ParseLine()
171173

172174
sStatus = sLabel;
173175

174-
UpdateNodesStatus(pid, sStatus);
176+
UpdateNodesStatus(pid, sStatus);
177+
178+
m_lastUpdate = 0;
175179
}
176180
}
177181
}
182+
else if (root["heos"]["command"] == "event/players_changed")
183+
{
184+
SendCommand("getPlayers");
185+
}
186+
else if (root["heos"]["command"] == "event/groups_changed")
187+
{
188+
SendCommand("getPlayers");
189+
}
190+
else if (root["heos"]["command"] == "event/player_now_playing_changed")
191+
{
192+
std::vector<std::string> SplitMessage;
193+
StringSplit(root["heos"]["message"].asString(), "=", SplitMessage);
194+
if (SplitMessage.size() > 0)
195+
{
196+
std::string pid = SplitMessage[1];
197+
int PlayerID = atoi(pid.c_str());
198+
SendCommand("getPlayState", PlayerID);
199+
}
200+
}
201+
else if (root["heos"]["command"] == "event/player_mute_changed")
202+
{
203+
204+
}
205+
else if (root["heos"]["command"] == "event/repeat_mode_changed")
206+
{
207+
208+
}
209+
else if (root["heos"]["command"] == "event/shuffle_mode_changed")
210+
{
211+
212+
}
178213
}
179214
}
180215
else
@@ -429,10 +464,13 @@ void CHEOS::Do_Work()
429464
bool bFirstTime=true;
430465
bool bCheckedForPlayers=false;
431466
int sec_counter = 25;
467+
m_lastUpdate = 25;
468+
432469
while (!m_stoprequested)
433470
{
434471
sleep_seconds(1);
435472
sec_counter++;
473+
m_lastUpdate++;
436474

437475
if (sec_counter % 12 == 0) {
438476
m_LastHeartbeat=mytime(NULL);
@@ -454,10 +492,13 @@ void CHEOS::Do_Work()
454492
{
455493
if (!bCheckedForPlayers)
456494
{
495+
// Update all players and groups
457496
SendCommand("getPlayers");
458497
bCheckedForPlayers = true;
498+
// Enable event changes
499+
SendCommand("registerForEvents");
459500
}
460-
if (sec_counter % 30 == 0)//updates every 30 seconds
501+
if (sec_counter % 30 == 0 && m_lastUpdate >= 30)//updates every 30 seconds
461502
{
462503
bFirstTime=false;
463504
std::vector<HEOSNode>::const_iterator itt;
@@ -715,8 +756,12 @@ bool CHEOS::WriteToHardware(const char *pdata, const unsigned char length)
715756
switch (pSen->LIGHTING2.cmnd)
716757
{
717758
case light2_sOn:
759+
SendCommand("setPlayStatePlay", itt->DevID);
760+
return true;
718761
case light2_sGroupOn:
719762
case light2_sOff:
763+
SendCommand("setPlayStateStop", itt->DevID);
764+
return true;
720765
case light2_sGroupOff:
721766
case gswitch_sPlay:
722767
SendCommand("getNowPlaying", itt->DevID);

hardware/HEOS.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class CHEOS : public CDomoticzHardwareBase, ASyncTCP
4949
//bool WriteInt(const unsigned char *pData, const unsigned char Len);
5050
bool WriteInt(const std::string &sendStr);
5151

52+
int m_lastUpdate;
53+
5254
int m_iPollInterval;
5355
int m_iPingTimeoutms;
5456
std::string m_IP;

www/index.html

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,147 @@ <h2 data-i18n="Year">Year</h2>
989989
</g>
990990
</svg>
991991
</div>
992+
<div id="dialog-heosplayer-remote" style="display:none;">
993+
<svg id="HEOSPlayerRemote" class="MediaRemote" viewBox="50 -150 900 1100" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1">
994+
<defs>
995+
<radialGradient id="gradient1" cx="50%" cy="20%" r="50%" fx="50%" fy="50%">
996+
<stop offset="0%" style="stop-color:#cbcccb;" /><stop offset="100%" style="stop-color:#989898;" />
997+
</radialGradient>
998+
<radialGradient id="gradient2" cx="50%" cy="80%" r="50%" fx="50%" fy="50%">
999+
<stop offset="0%" style="stop-color:#cbcccb;" /><stop offset="100%" style="stop-color:#989898;" />
1000+
</radialGradient>
1001+
<radialGradient id="gradient3" cx="20%" cy="50%" r="50%" fx="50%" fy="50%">
1002+
<stop offset="0%" style="stop-color:#cbcccb;" /><stop offset="100%" style="stop-color:#989898;" />
1003+
</radialGradient>
1004+
<radialGradient id="gradient4" cx="80%" cy="50%" r="50%" fx="50%" fy="50%">
1005+
<stop offset="0%" style="stop-color:#cbcccb;" /><stop offset="100%" style="stop-color:#989898;" />
1006+
</radialGradient>
1007+
<path id="symTriangle" d="m 30,580 -60,60 -60,-60 z"/>
1008+
<path id="symFavorites" d="m78.719,27.14565c0,-13.91432 -9.27593,-25.19366 -20.7181,-25.19366c-7.47142,0 -13.99653,4.8253 -17.64171,12.03655c-3.64471,-7.21125 -10.17255,-12.03655 -17.64396,-12.03655c-11.44209,0 -20.71526,11.27936 -20.71526,25.19366c0,7.57557 2.76051,14.35305 7.11123,18.96834l29.35747,35.70179c0.50146,0.60963 1.18136,0.95222 1.89052,0.95222c0.70933,0 1.38924,-0.3426 1.89052,-0.95222l29.35752,-35.70179c4.35098,-4.61546 7.11176,-11.39276 7.11176,-18.96834l0,0z"/>
1009+
<path id="symNowPlaying" d="m33.30051,35.74044l0,42.67448l0,0c0.04173,3.90186 -2.78493,8.30183 -8.64684,11.07083c-8.13374,3.83624 -16.69111,1.96458 -19.8218,-2.4681c-3.13087,-4.43826 -0.84096,-11.43206 7.2991,-15.27369c5.46821,-2.58305 11.13328,-2.57757 15.20631,-0.95218l0,-33.95688l0,-21.8899l59.63288,-10.94499l0,5.47249l0,16.4175l0,47.06338l0,0c0.03584,3.90186 -2.79081,8.29624 -8.64685,11.05997c-8.13385,3.83614 -16.69115,1.96458 -19.82185,-2.4682c-3.13081,-4.43816 -0.8409,-11.43205 7.29905,-15.27368c5.46832,-2.58305 11.13338,-2.57747 15.20631,-0.95218l0,-38.33483l-47.70631,8.75598l0,0zm0,0"/>
1010+
<g id="symRepeat" fill="#393a39">
1011+
<path d="m88.37501,62.33332c0,4.59166 -2.83431,8.33334 -6.31252,8.33334h-56.83774v-16.66666l-25.22475,25l25.22475,25v-16.66668h56.83774c10.44404,0 18.93752,-11.22916 18.93752,-25h-12.625l0,0z"/>
1012+
<path d="m18.9375,37.33338h56.81249v16.66662l25.25,-25l-25.25,-25v16.66662h-56.81249c-10.44403,0 -18.9375,11.2 -18.9375,25h12.625c0,-4.59163 2.83431,-8.33325 6.3125,-8.33325l0,0z"/>
1013+
</g>
1014+
<g id="symShuffle" fill="#393a39">
1015+
<polygon points="98.3429408578821,32.200117042093666 98.3429408578821,50.5339301317116 117.85200781683292,25.864964463319097 98.3429408578821,1.196000099182129 98.3429408578821,19.541192818332433 77.74903262176244,19.541192818332433 77.74903262176244,19.62657460259686 77.69951336897415,19.552575056375872 23.96629133943142,87.49184707361553 2.1525008833052937,87.49184707361553 2.1525008833052937,100.15075303779929 28.07156711271577,100.15075303779929 28.07156711271577,100.09954274852032 28.107582073480756,100.15075303779929 81.84980784321473,32.200117042093666"/>
1016+
<polygon points="46.12218635231315,54.518305578927425 53.19839318808758,45.570538744651344 28.107582073480756,13.849229943282808 28.067066560883717,13.894768025245298 28.067066560883717,13.849229943282808 2.1480000019073486,13.849229943282808 2.1480000019073486,26.508155471299574 23.96179078759937,26.508155471299574"/>
1017+
<polygon points="98.3429408578821,81.79987767728824 81.84980784321473,81.79987767728824 64.8120052323105,60.255803927428474 57.73579839653607,69.20926253285404 77.69951336897415,94.44742096726156 77.75353581012163,94.37342272529611 77.75353581012163,94.45880450956054 98.3429408578821,94.45880450956054 98.3429408578821,112.80400374998851 117.85200781683292,88.13503286457387 98.3429408578821,63.466061979159235"/>
1018+
</g>
1019+
<g id="symBrowse" stroke-miterlimit="10" stroke-linecap="round" stroke-width="12" stroke="#393a39" fill="none">
1020+
<line y2="76.67169" x2="22.98174" y1="9.19837" x1="9.056"/>
1021+
<line y2="77.51706" x2="25.04448" y1="8.353" x1="25.1764"/>
1022+
<line y2="78.60848" x2="26.91019" y1="17.34518" x1="54.42007"/>
1023+
<line y2="79.76611" x2="28.15343" y1="44.42258" x1="79.10156"/>
1024+
<line y2="82.276" x2="29.17687" y1="82.24778" x1="88.448"/>
1025+
</g>
1026+
</defs>
1027+
<g>
1028+
<g transform="translate(0,20)">
1029+
<g transform="translate(-335,0)">
1030+
<g>
1031+
<circle cx="501" cy="20" r="110" class="remoteshadow" />
1032+
<circle cx="500" cy="10" r="110" class="remotehoverable" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('Favorites');">
1033+
<title>Favorites</title>
1034+
</circle>
1035+
<use xlink:href="#symFavorites" class="remoteshadow" transform="translate(460,-30)"/>
1036+
</g>
1037+
<g>
1038+
<circle cx="501" cy="260" r="110" class="remoteshadow" />
1039+
<circle cx="500" cy="250" r="110" class="remotehoverable" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('Browse');">
1040+
<title>Browse</title>
1041+
</circle>
1042+
<use xlink:href="#symBrowse" class="remoteshadow" transform="translate(450,205)"/>
1043+
</g>
1044+
<g>
1045+
<circle cx="501" cy="500" r="110" class="remoteshadow" />
1046+
<circle cx="500" cy="490" r="110" class="remotehoverable" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('NowPlaying');">
1047+
<title>Now playing</title>
1048+
</circle>
1049+
<use xlink:href="#symNowPlaying" class="remoteshadow" transform="translate(450,450)"/>
1050+
</g>
1051+
</g>
1052+
1053+
<g>
1054+
<g>
1055+
<circle cx="501" cy="20" r="110" class="remoteshadow" />
1056+
<circle cx="500" cy="10" r="110" class="remotehoverable" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('Shuffle');">
1057+
<title>Shuffle</title>
1058+
</circle>
1059+
<use xlink:href="#symShuffle" class="remoteshadow" transform="translate(445,-40)"/>
1060+
</g>
1061+
<g>
1062+
<circle cx="501" cy="260" r="110" class="remoteshadow" />
1063+
<circle cx="500" cy="250" r="110" class="remotehoverable" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('Repeat');">
1064+
<title>Repeat</title>
1065+
</circle>
1066+
<use xlink:href="#symRepeat" class="remoteshadow" transform="translate(450,200)"/>
1067+
</g>
1068+
<g>
1069+
<circle cx="501" cy="500" r="110" class="remoteshadow" />
1070+
<circle cx="500" cy="490" r="110" class="remotehoverable" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('stop');">
1071+
<title>Stop</title>
1072+
</circle>
1073+
<path class="remoteshadow" d="m 460 450 l0,80 l80,0 l0,-80z" />
1074+
</g>
1075+
</g>
1076+
<g transform="rotate(90,900,600) translate(0,-440) scale(1.1)">
1077+
<g>
1078+
<circle cx="510" cy="999" r="100" class="remoteshadow" />
1079+
<circle cx="500" cy="1000" r="100" class="remotehoverable" fill="url(#gradient3)" onclick="javascript:click_heosplayer_remote('toggleMute');">
1080+
<title>Mute</title>
1081+
</circle>
1082+
<path class="remoteshadow" d="m 450 970 50,50 50,-50 m -70 20 l0,40 l40,0 l0,-40zz" />
1083+
</g>
1084+
<g>
1085+
<path class="remoteshadow" d="M272 929 l150 0 s -70,70 0,140 l-197 0 s -70,-70 0,-140 z" />
1086+
<path class="remotehoverable" d="M272 930 l140 0 s -70,70 0,140 l-197 0 s -70,-70 0,-140 z" fill="url(#gradient3)" onclick="javascript:click_heosplayer_remote('setVolumeUp');">
1087+
<title>Volume Up</title>
1088+
</path>
1089+
<path transform="rotate(180,320,1000)" d="m 320 960 0,80 40,-40z" class="remoteshadow"/>
1090+
</g>
1091+
<g transform="rotate(180,500,1000)">
1092+
<path class="remoteshadow" d="M265 931 l140 0 s -70,70 0,140 l-200 0 s -70,-70 0,-140 z" />
1093+
<path class="remotehoverable" d="M265 930 l150 0 s -70,70 0,140 l-200 0 s -70,-70 0,-140 z" fill="url(#gradient4)" onclick="javascript:click_heosplayer_remote('setVolumeDown');">
1094+
<title>Volume Down</title>
1095+
</path>
1096+
<path transform="rotate(180,320,1000)" d="m 320 960 0,80 40,-40z" class="remoteshadow"/>
1097+
</g>
1098+
</g>
1099+
</g>
1100+
<g transform="translate(-50,-350) scale(1.1)">
1101+
<g transform="translate(-145,0)">
1102+
<path class="remoteshadow" d="M272 940 l150 0 s -70,70 0,140 l-150 0 s -70,-70 0,-140 z" />
1103+
<path class="remotehoverable" d="M272 930 l150 0 s -70,70 0,140 l-150 0 s -70,-70 0,-140 z" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('playPrev');">
1104+
<title>Play Previous</title>
1105+
</path>
1106+
<path transform="rotate(180,320,1000)" d="m 280 960 0,80 40,-40 m 0 -40 0,80 40,-40z" class="remoteshadow"/>
1107+
</g>
1108+
<g transform="rotate(180,500,1000) translate(-145,0)">
1109+
<path class="remoteshadow" d="M272 920 l150 0 s -70,70 0,140 l-150 0 s -70,-70 0,-140 z" />
1110+
<path class="remotehoverable" d="M272 930 l150 0 s -70,70 0,140 l-150 0 s -70,-70 0,-140 z" fill="url(#gradient2)" onclick="javascript:click_heosplayer_remote('playNext');">
1111+
<title>Play Next</title>
1112+
</path>
1113+
<path class="remoteshadow" transform="rotate(180,320,1000)" d="m 280 960 0,80 40,-40 m 0 -40 0,80 40,-40z"/>
1114+
</g>
1115+
<g transform="translate(-120,0)">
1116+
<circle cx="500" cy="1010" r="100" class="remoteshadow" />
1117+
<circle cx="500" cy="1000" r="100" class="remotehoverable" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('play');">
1118+
<title>Play</title>
1119+
</circle>
1120+
<path class="remoteshadow" d="m 485 960 0,80 40,-40"/>
1121+
</g>
1122+
<g transform="translate(120,0)">
1123+
<circle cx="500" cy="1010" r="100" class="remoteshadow" />
1124+
<circle cx="500" cy="1000" r="100" class="remotehoverable" fill="url(#gradient1)" onclick="javascript:click_heosplayer_remote('pause');">
1125+
<title>Pause</title>
1126+
</circle>
1127+
<path class="remoteshadow" d="m 470 960 l0 70 l25 0 l0 -70 m 10 0 l0 70 l25 0 l0 -70 z"/>
1128+
</g>
1129+
</g>
1130+
</g>
1131+
</svg>
1132+
</div>
9921133
<div id="daymonthyearlog" style="display:none;">
9931134
<h2 data-i18n="Day">Day</h2>
9941135
<div id="daygraph" style="height: 300px;"></div>

www/js/domoticz.js.gz

624 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)