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.
This commit is contained in:
Andrius Štikonas 2015-04-02 22:45:59 +01:00
parent b30da3495d
commit be34c3d5da
1 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ Socket::Socket ( QHostAddress IPaddress, QByteArray reply )
datagram[Subscribe] = commandID[Subscribe] + mac + twenties + rmac + twenties; datagram[Subscribe] = commandID[Subscribe] + mac + twenties + rmac + twenties;
datagram[PowerOn] = commandIDPower + mac + twenties + zeros + one; datagram[PowerOn] = commandIDPower + mac + twenties + zeros + one;
datagram[PowerOff] = commandIDPower + mac + twenties + zeros + zero; 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 = new QUdpSocket();
udpSocket->connectToHost ( ip, 10000 ); 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 unsigned int datagram = std::distance ( commandID, std::find ( commandID, commandID + MaxCommands, id ) ); // match commandID with enum
if ( datagram == TableData ) // determine the table number 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 ) switch ( table )
{ {
case 1: case 1: