18
18
// {"id":668,"jsonrpc":"2.0","result":{"System.ScreenSaverActive":false}}
19
19
20
20
// Request stereoscopicmode example:
21
- // {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":1}
22
- // {"id":1,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
23
-
24
- int xbmcVersion = 0 ;
21
+ // {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669}
22
+ // {"id":669,"jsonrpc":"2.0","result":{"stereoscopicmode":{"label":"Nebeneinander","mode":"split_vertical"}}}
25
23
26
24
XBMCVideoChecker::XBMCVideoChecker (const std::string & address, uint16_t port, bool grabVideo, bool grabPhoto, bool grabAudio, bool grabMenu, bool grabScreensaver, bool enable3DDetection) :
27
25
QObject(),
@@ -30,8 +28,8 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
30
28
_activePlayerRequest(R"( {"id":666,"jsonrpc":"2.0","method":"Player.GetActivePlayers"})" ),
31
29
_currentPlayingItemRequest(R"( {"id":667,"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%1,"properties":["file"]}})" ),
32
30
_checkScreensaverRequest(R"( {"id":668,"jsonrpc":"2.0","method":"XBMC.GetInfoBooleans","params":{"booleans":["System.ScreenSaverActive"]}})" ),
33
- _getStereoscopicMode(R"( {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":1 })" ),
34
- _getXbmcVersion(R"( {"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":1 })" ),
31
+ _getStereoscopicMode(R"( {"jsonrpc":"2.0","method":"GUI.GetProperties","params":{"properties":["stereoscopicmode"]},"id":669 })" ),
32
+ _getXbmcVersion(R"( {"jsonrpc":"2.0","method":"Application.GetProperties","params":{"properties":["version"]},"id":670 })" ),
35
33
_socket(),
36
34
_grabVideo(grabVideo),
37
35
_grabPhoto(grabPhoto),
@@ -41,7 +39,8 @@ XBMCVideoChecker::XBMCVideoChecker(const std::string & address, uint16_t port, b
41
39
_enable3DDetection(enable3DDetection),
42
40
_previousScreensaverMode(false ),
43
41
_previousGrabbingMode(GRABBINGMODE_INVALID),
44
- _previousVideoMode(VIDEO_2D)
42
+ _previousVideoMode(VIDEO_2D),
43
+ _xbmcVersion(0 )
45
44
{
46
45
// setup socket
47
46
connect (&_socket, SIGNAL (readyRead ()), this , SLOT (receiveReply ()));
@@ -124,10 +123,10 @@ void XBMCVideoChecker::receiveReply()
124
123
}
125
124
else if (reply.contains (" \" id\" :667" ))
126
125
{
127
- if (xbmcVersion >= 13 )
126
+ if (_xbmcVersion >= 13 )
128
127
{
129
- // check of active stereoscopicmode
130
- _socket.write (_getStereoscopicMode.toUtf8 ());
128
+ // check of active stereoscopicmode
129
+ _socket.write (_getStereoscopicMode.toUtf8 ());
131
130
}
132
131
else
133
132
{
@@ -162,13 +161,13 @@ void XBMCVideoChecker::receiveReply()
162
161
// check here xbmc version
163
162
if (_socket.state () == QTcpSocket::ConnectedState)
164
163
{
165
- if (xbmcVersion == 0 )
166
- {
164
+ if (_xbmcVersion == 0 )
165
+ {
167
166
_socket.write (_getXbmcVersion.toUtf8 ());
168
167
}
169
168
}
170
169
}
171
- else if (reply.contains (" \" stereoscopicmode \" " ))
170
+ else if (reply.contains (" \" id \" :669 " ))
172
171
{
173
172
QRegExp regex (" \" mode\" :\" (split_vertical|split_horizontal)\" " );
174
173
int pos = regex.indexIn (reply);
@@ -185,13 +184,13 @@ void XBMCVideoChecker::receiveReply()
185
184
}
186
185
}
187
186
}
188
- else if (reply.contains (" \" version \" :" ))
187
+ else if (reply.contains (" \" id \" :670 " ))
189
188
{
190
189
QRegExp regex (" \" major\" :(\\ d+)" );
191
190
int pos = regex.indexIn (reply);
192
191
if (pos > 0 )
193
192
{
194
- xbmcVersion = regex.cap (1 ).toInt ();
193
+ _xbmcVersion = regex.cap (1 ).toInt ();
195
194
}
196
195
}
197
196
}
0 commit comments