@@ -44,12 +44,8 @@ BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocke
4444
4545BoblightClientConnection::~BoblightClientConnection ()
4646{
47- if (_priority < 255 )
48- {
49- // clear the current channel
50- _hyperion->clear (_priority);
51- _priority = 255 ;
52- }
47+ // clear the current channel
48+ _hyperion->clear (_priority);
5349
5450 delete _socket;
5551}
@@ -83,12 +79,8 @@ void BoblightClientConnection::readData()
8379
8480void BoblightClientConnection::socketClosed ()
8581{
86- if (_priority < 255 )
87- {
88- // clear the current channel
89- _hyperion->clear (_priority);
90- _priority = 255 ;
91- }
82+ // clear the current channel
83+ _hyperion->clear (_priority);
9284
9385 emit connectionClosed (this );
9486}
@@ -164,7 +156,7 @@ void BoblightClientConnection::handleMessage(const QString & message)
164156 rgb.blue = blue;
165157
166158 // send current color values to hyperion if this is the last led assuming leds values are send in order of id
167- if (( ledIndex == _ledColors.size () -1 ) && _priority < 255 )
159+ if (ledIndex == _ledColors.size () -1 )
168160 {
169161 _hyperion->setInput (_priority, _ledColors);
170162 }
@@ -188,14 +180,11 @@ void BoblightClientConnection::handleMessage(const QString & message)
188180 int prio = messageParts[2 ].toInt (&rc);
189181 if (rc && prio != _priority)
190182 {
191- if (_priority < 255 )
192- {
193- // clear the current channel
194- _hyperion->clear (_priority);
183+ // clear the current channel
184+ _hyperion->clear (_priority);
195185
196- // register new priority
197- _hyperion->registerInput (prio, hyperion::COMP_BOBLIGHTSERVER, QString (" Boblight@%1" ).arg (_socket->peerAddress ().toString ()));
198- }
186+ // register new priority
187+ _hyperion->registerInput (prio, hyperion::COMP_BOBLIGHTSERVER, QString (" Boblight@%1" ).arg (_socket->peerAddress ().toString ()));
199188
200189 _priority = prio;
201190 return ;
@@ -205,23 +194,14 @@ void BoblightClientConnection::handleMessage(const QString & message)
205194 else if (messageParts[0 ] == " sync" )
206195 {
207196 // send current color values to hyperion
208- if (_priority < 255 )
209- {
210- _hyperion->setInput (_priority, _ledColors);
211- }
197+ _hyperion->setInput (_priority, _ledColors);
212198 return ;
213199 }
214200 }
215201
216202 Debug (_log, " unknown boblight message: %s" , QSTRING_CSTR (message));
217203}
218204
219- void BoblightClientConnection::sendMessage (const QByteArray & message)
220- {
221- // std::cout << "send boblight message: " << message;
222- _socket->write (message);
223- }
224-
225205void BoblightClientConnection::sendLightMessage ()
226206{
227207 char buffer[256 ];
0 commit comments