@@ -91,7 +91,7 @@ void CHEOS::ParseLine()
91
91
if (DEBUG_LOGGING) _log.Log (LOG_NORM, " DENON by HEOS: No players found (No Payload)." );
92
92
}
93
93
}
94
- else if (root[" heos" ][" command" ] == " player/get_play_state" || root[" heos" ][" command" ] == " player/set_play_state" || root[ " heos " ][ " command " ] == " event/player_state_changed " )
94
+ else if (root[" heos" ][" command" ] == " player/get_play_state" || root[" heos" ][" command" ] == " player/set_play_state" )
95
95
{
96
96
if (root[" heos" ].isMember (" message" ))
97
97
{
@@ -179,45 +179,91 @@ void CHEOS::ParseLine()
179
179
}
180
180
}
181
181
}
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" )
182
+ }
183
+ }
184
+ else
185
+ {
186
+ if (root[" heos" ].isMember (" command" ))
187
+ {
188
+ if (DEBUG_LOGGING) _log.Log (LOG_NORM, " DENON by HEOS: Failed: '%s'." , root[" heos" ][" command" ].asCString ());
189
+ }
190
+ }
191
+ }
192
+ else
193
+ {
194
+ if (root[" heos" ].isMember (" command" ))
195
+ {
196
+ if (root[" heos" ][" command" ] == " event/player_state_changed" )
197
+ {
198
+ if (root[" heos" ].isMember (" message" ))
191
199
{
192
200
std::vector<std::string> SplitMessage;
193
- StringSplit (root[" heos" ][" message" ].asString (), " = " , SplitMessage);
201
+ StringSplit (root[" heos" ][" message" ].asString (), " & " , SplitMessage);
194
202
if (SplitMessage.size () > 0 )
195
203
{
196
- std::string pid = SplitMessage[1 ];
197
- int PlayerID = atoi (pid.c_str ());
198
- SendCommand (" getPlayState" , PlayerID);
204
+ std::vector<std::string> SplitMessagePlayer;
205
+ StringSplit (SplitMessage[0 ], " =" , SplitMessagePlayer);
206
+ std::vector<std::string> SplitMessageState;
207
+ StringSplit (SplitMessage[1 ], " =" , SplitMessageState);
208
+ std::string pid = SplitMessagePlayer[1 ];
209
+ std::string state = SplitMessageState[1 ];
210
+
211
+ _eMediaStatus nStatus = MSTAT_UNKNOWN;
212
+
213
+ if (state == " play" )
214
+ nStatus = MSTAT_PLAYING;
215
+ else if (state == " pause" )
216
+ nStatus = MSTAT_PAUSED;
217
+ else if (state == " stop" )
218
+ nStatus = MSTAT_STOPPED;
219
+ else
220
+ nStatus = MSTAT_ON;
221
+
222
+ std::string sStatus = " " ;
223
+
224
+ UpdateNodeStatus (pid, nStatus, sStatus );
225
+
226
+ /* If playing request now playing information */
227
+ if (state == " play" ) {
228
+ int PlayerID = atoi (pid.c_str ());
229
+ SendCommand (" getNowPlaying" , PlayerID);
230
+ }
231
+
232
+ m_lastUpdate = 0 ;
199
233
}
200
234
}
201
- else if (root[" heos" ][" command" ] == " event/player_mute_changed" )
235
+ }
236
+ else if (root[" heos" ][" command" ] == " event/players_changed" )
237
+ {
238
+ SendCommand (" getPlayers" );
239
+ }
240
+ else if (root[" heos" ][" command" ] == " event/groups_changed" )
241
+ {
242
+ SendCommand (" getPlayers" );
243
+ }
244
+ else if (root[" heos" ][" command" ] == " event/player_now_playing_changed" )
245
+ {
246
+ std::vector<std::string> SplitMessage;
247
+ StringSplit (root[" heos" ][" message" ].asString (), " =" , SplitMessage);
248
+ if (SplitMessage.size () > 0 )
202
249
{
203
-
250
+ std::string pid = SplitMessage[1 ];
251
+ int PlayerID = atoi (pid.c_str ());
252
+ SendCommand (" getPlayState" , PlayerID);
204
253
}
205
- else if (root[" heos" ][" command" ] == " event/repeat_mode_changed" )
206
- {
254
+ }
255
+ else if (root[" heos" ][" command" ] == " event/player_mute_changed" )
256
+ {
207
257
208
- }
209
- else if (root[" heos" ][" command" ] == " event/shuffle_mode_changed " )
210
- {
258
+ }
259
+ else if (root[" heos" ][" command" ] == " event/repeat_mode_changed " )
260
+ {
211
261
212
- }
213
262
}
214
- }
215
- else
216
- {
217
- if (root[" heos" ].isMember (" command" ))
263
+ else if (root[" heos" ][" command" ] == " event/shuffle_mode_changed" )
218
264
{
219
- if (DEBUG_LOGGING) _log. Log (LOG_NORM, " DENON by HEOS: Failed: '%s'. " , root[ " heos " ][ " command " ]. asCString ());
220
- }
265
+
266
+ }
221
267
}
222
268
}
223
269
}
0 commit comments