From be34c3d5dabf3adc2b3639bb0c5a41bf314761d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 2 Apr 2015 22:45:59 +0100 Subject: [PATCH] Make TableData command work after initial pairing. TableData command is modified a bit: 00 00 00 00 -> 72 00 00 00 I don't know yet what 72 stands for but apparently this command still works in normal mode, so let us use it for now. --- socket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socket.cpp b/socket.cpp index d4b9c32..222f4b5 100644 --- a/socket.cpp +++ b/socket.cpp @@ -50,7 +50,7 @@ Socket::Socket ( QHostAddress IPaddress, QByteArray reply ) datagram[Subscribe] = commandID[Subscribe] + mac + twenties + rmac + twenties; datagram[PowerOn] = commandIDPower + mac + twenties + zeros + one; datagram[PowerOff] = commandIDPower + mac + twenties + zeros + zero; - datagram[TableData] = commandID[TableData] + mac + twenties + zeros + QByteArray::fromHex ( "01 00 00" ) + zeros; + datagram[TableData] = commandID[TableData] + mac + twenties + /*zeros*/QByteArray::fromHex ( "72 00 00 00" ) + QByteArray::fromHex ( "01 00 00" ) + zeros; udpSocket = new QUdpSocket(); udpSocket->connectToHost ( ip, 10000 ); @@ -183,7 +183,7 @@ bool Socket::parseReply ( QByteArray reply ) unsigned int datagram = std::distance ( commandID, std::find ( commandID, commandID + MaxCommands, id ) ); // match commandID with enum if ( datagram == TableData ) // determine the table number { - unsigned int table = reply[reply.indexOf ( zeros ) + 4]; // Table number immediately follows zeros + unsigned int table = reply[reply.indexOf ( twenties ) + 11]; switch ( table ) { case 1: