I've tried to do some debugging in det code. I've modified the function ProcessInbound in class CPluginProtocolLine (PluginProtocols.cpp, line 101), so I got som debug information:
Code: Select all
void CPluginProtocolLine::ProcessInbound(const ReadEvent* Message)
{
CConnection* pConnection = Message->m_pConnection; //pm
CPlugin* pPlugin = pConnection->pPlugin; //pm
pPlugin->Log(LOG_ERROR, "(%s) entry", __func__); //pm
//
// Handles the cases where a read contains a partial message or multiple messages
//
std::vector<byte> vData = m_sRetainedData; // if there was some data left over from last time add it back in
vData.insert(vData.end(), Message->m_Buffer.begin(), Message->m_Buffer.end()); // add the new data
std::string sData(vData.begin(), vData.end());
int iPos = sData.find_first_of('\r'); // Look for message terminator
pPlugin->Log(LOG_ERROR, "(%s) iPos : %d", __func__, iPos); //pm
pPlugin->Log(LOG_ERROR, "(%s) string: %s", __func__, sData.c_str()); //pm
while (iPos != std::string::npos)
{
Message->m_pConnection->pPlugin->MessagePlugin(new onMessageCallback(Message->m_pConnection, std::vector<byte>(&sData[0], &sData[iPos])));
if (sData[iPos + 1] == '\n') iPos++; // Handle \r\n
sData = sData.substr(iPos + 1);
iPos = sData.find_first_of('\r');
pPlugin->Log(LOG_ERROR, "(%s) iPos : %d", __func__, iPos); //pm
pPlugin->Log(LOG_ERROR, "(%s) string: %s", __func__, sData.c_str()); //pm
}
pPlugin->Log(LOG_ERROR, "(%s) string: %s", __func__, sData.c_str()); //pm
m_sRetainedData.assign(sData.c_str(), sData.c_str() + sData.length()); // retain any residual for next time
pPlugin->Log(LOG_ERROR, "(%s) exit", __func__); //pm
}
The Yamaha plugin sends these commands to the receiver when started:
Code: Select all
@MAIN:PWR=?
@MAIN:VOL=?
@MAIN:INP=?
@MAIN:MUTE=?
@MAIN:SOUNDPRG=?
@MAIN:STRAIGHT=?
and the modificed code gives this result:
Code: Select all
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) entry
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) iPos : 12
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) string: @MAIN:PWR=On
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) iPos : -1
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) string:
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) string:
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) exit
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) entry
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) iPos : 15
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) string: @MAIN:VOL=-50.0
@MAIN:INP=TUNER
@MAIN:MUTE=Off
@MAIN:SOUNDPRG=2ch Stereo
@MAIN:STRAIGHT=Off
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) iPos : 15
2022-03-20 14:19:33.149 Error: AVR Yamaha: (ProcessInbound) string: @MAIN:INP=TUNER
@MAIN:MUTE=Off
@MAIN:SOUNDPRG=2ch Stereo
@MAIN:STRAIGHT=Off
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) iPos : 14
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) string: @MAIN:MUTE=Off
@MAIN:SOUNDPRG=2ch Stereo
@MAIN:STRAIGHT=Off
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) iPos : 25
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) string: @MAIN:SOUNDPRG=2ch Stereo
@MAIN:STRAIGHT=Off
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) iPos : 18
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) string: @MAIN:STRAIGHT=Off
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) iPos : -1
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) string:
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) string:
2022-03-20 14:19:33.150 Error: AVR Yamaha: (ProcessInbound) exit
2022-03-20 14:19:33.150 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.162 Error: AVR Yamaha: Exception: 'SystemError'. No traceback available.
2022-03-20 14:19:33.162 AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.162 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.162 Error: AVR Yamaha: Exception: 'TypeError'. No traceback available.
2022-03-20 14:19:33.162 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.162 Error: AVR Yamaha: Exception: 'SystemError'. No traceback available.
2022-03-20 14:19:33.162 AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.162 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'TypeError'. No traceback available.
2022-03-20 14:19:33.163 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'SystemError'. No traceback available.
2022-03-20 14:19:33.163 AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.163 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'TypeError'. No traceback available.
2022-03-20 14:19:33.163 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'SystemError'. No traceback available.
2022-03-20 14:19:33.163 AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.163 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'TypeError'. No traceback available.
2022-03-20 14:19:33.163 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'SystemError'. No traceback available.
2022-03-20 14:19:33.163 AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.163 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'TypeError'. No traceback available.
2022-03-20 14:19:33.163 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'SystemError'. No traceback available.
2022-03-20 14:19:33.163 AVR Yamaha: (AVR Yamaha) Python exception set prior to callback 'onMessage'
2022-03-20 14:19:33.163 Error: AVR Yamaha: Call to function 'onMessage' failed, exception details:
2022-03-20 14:19:33.163 Error: AVR Yamaha: Exception: 'TypeError'. No traceback available.
2022-03-20 14:19:37.234 Status: AVR Yamaha: Stop directive received.