2016-03-24 Fred Gleason <fredg@paravelsystems.com>

* Fixed a buffer size bug in 'lib/rdlivewire.cpp'.
	* Fixed a bug in 'ripcd/livewire_lwrpaudio.cpp' that caused
	spurious errors to be dumped to stderr.
This commit is contained in:
Fred Gleason 2016-03-24 11:43:28 -04:00
commit 9a4a05a5df
5 changed files with 39 additions and 26 deletions

View File

@ -14977,3 +14977,7 @@
methods in 'lib/rdcart.cpp' and 'lib/rdcart.h'. methods in 'lib/rdcart.cpp' and 'lib/rdcart.h'.
* Added 'RDCut::playOrder()' and 'RDCut::setPlayOrder()' methods * Added 'RDCut::playOrder()' and 'RDCut::setPlayOrder()' methods
in 'lib/rdcut.cpp' and 'lib/rdcut.h'. in 'lib/rdcut.cpp' and 'lib/rdcut.h'.
2016-03-24 Fred Gleason <fredg@paravelsystems.com>
* Fixed a buffer size bug in 'lib/rdlivewire.cpp'.
* Fixed a bug in 'ripcd/livewire_lwrpaudio.cpp' that caused
spurious errors to be dumped to stderr.

View File

@ -1 +1 @@
2.11.0 2.11.0

View File

@ -257,8 +257,8 @@ void RDLiveWire::gpiSet(int slot,int line,unsigned interval)
} }
} }
} }
cmd+="\"\r\n"; cmd+="\"";
live_socket->writeBlock(cmd,cmd.length()); SendCommand(cmd);
live_gpi_states[slot][line]=true; live_gpi_states[slot][line]=true;
if(interval>0) { if(interval>0) {
live_gpi_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]-> live_gpi_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]->
@ -284,8 +284,8 @@ void RDLiveWire::gpiReset(int slot,int line,unsigned interval)
} }
} }
} }
cmd+="\"\r\n"; cmd+="\"";
live_socket->writeBlock(cmd,cmd.length()); SendCommand(cmd);
live_gpi_states[slot][line]=false; live_gpi_states[slot][line]=false;
if(interval>0) { if(interval>0) {
live_gpi_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]-> live_gpi_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]->
@ -311,8 +311,7 @@ void RDLiveWire::gpoSet(int slot,int line,unsigned interval)
} }
} }
} }
cmd+="\r\n"; SendCommand(cmd);
live_socket->writeBlock(cmd,cmd.length());
live_gpo_states[slot][line]=true; live_gpo_states[slot][line]=true;
if(interval>0) { if(interval>0) {
live_gpo_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]-> live_gpo_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]->
@ -338,8 +337,7 @@ void RDLiveWire::gpoReset(int slot,int line,unsigned interval)
} }
} }
} }
cmd+="\r\n"; SendCommand(cmd);
live_socket->writeBlock(cmd,cmd.length());
live_gpo_states[slot][line]=false; live_gpo_states[slot][line]=false;
if(interval>0) { if(interval>0) {
live_gpo_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]-> live_gpo_timers[slot*RD_LIVEWIRE_GPIO_BUNDLE_SIZE+line]->
@ -354,7 +352,7 @@ void RDLiveWire::setRoute(int src_num,int dest_slot) const
QString str; QString str;
str=QString().sprintf("DST %d ADDR:\"239.192.%d.%d\"\r\n", str=QString().sprintf("DST %d ADDR:\"239.192.%d.%d\"\r\n",
dest_slot+1,src_num/256,src_num%256); dest_slot+1,src_num/256,src_num%256);
live_socket->writeBlock(str,str.length()); SendCommand(str);
} }
@ -364,9 +362,8 @@ void RDLiveWire::connectedData()
if(!live_password.isEmpty()) { if(!live_password.isEmpty()) {
str+=(" "+live_password); str+=(" "+live_password);
} }
str+="\r\n"; SendCommand(str);
live_socket->writeBlock(str,str.length()); SendCommand("VER");
live_socket->writeBlock("VER\r\n",5);
} }
@ -467,8 +464,8 @@ void RDLiveWire::gpiTimeoutData(int id)
} }
} }
} }
cmd+="\"\r\n"; cmd+="\"";
live_socket->writeBlock(cmd,cmd.length()); SendCommand(cmd);
live_gpi_states[chan][line]=!live_gpi_states[chan][line]; live_gpi_states[chan][line]=!live_gpi_states[chan][line];
emit gpiChanged(live_id,chan,line,live_gpi_states[chan][line]); emit gpiChanged(live_id,chan,line,live_gpi_states[chan][line]);
} }
@ -498,8 +495,7 @@ void RDLiveWire::gpoTimeoutData(int id)
} }
} }
} }
cmd+="\r\n"; SendCommand(cmd);
live_socket->writeBlock(cmd,cmd.length());
live_gpo_states[chan][line]=!live_gpo_states[chan][line]; live_gpo_states[chan][line]=!live_gpo_states[chan][line];
emit gpoChanged(live_id,chan,line,live_gpo_states[chan][line]); emit gpoChanged(live_id,chan,line,live_gpo_states[chan][line]);
} }
@ -507,7 +503,7 @@ void RDLiveWire::gpoTimeoutData(int id)
void RDLiveWire::watchdogData() void RDLiveWire::watchdogData()
{ {
live_socket->writeBlock("VER\r\n",4); SendCommand("VER");
} }
@ -576,6 +572,12 @@ void RDLiveWire::DespatchCommand(const QString &cmd)
} }
void RDLiveWire::SendCommand(const QString &cmd) const
{
live_socket->writeBlock((cmd+"\r\n").ascii(),cmd.length()+2);
}
void RDLiveWire::ReadVersion(const QString &cmd) void RDLiveWire::ReadVersion(const QString &cmd)
{ {
QStringList f0; QStringList f0;
@ -605,7 +607,7 @@ void RDLiveWire::ReadVersion(const QString &cmd)
live_channels=f1[1].right(f1[1].length()-delimiter-1).toInt(); live_channels=f1[1].right(f1[1].length()-delimiter-1).toInt();
} }
if(live_sources>0) { if(live_sources>0) {
live_socket->writeBlock("SRC\r\n",5); SendCommand("SRC");
} }
} }
if(f1[0]=="NDST") { if(f1[0]=="NDST") {
@ -618,7 +620,7 @@ void RDLiveWire::ReadVersion(const QString &cmd)
live_channels=f1[1].right(f1[1].length()-delimiter-1).toInt(); live_channels=f1[1].right(f1[1].length()-delimiter-1).toInt();
} }
if(live_destinations>0) { if(live_destinations>0) {
live_socket->writeBlock("DST\r\n",5); SendCommand("DST");
} }
} }
if(f1[0]=="NGPI") { if(f1[0]=="NGPI") {
@ -639,7 +641,9 @@ void RDLiveWire::ReadVersion(const QString &cmd)
} }
} }
if(!live_gpi_initialized) { if(!live_gpi_initialized) {
live_socket->writeBlock("ADD GPI\r\n",9); if(live_gpis>0) {
SendCommand("ADD GPI");
}
live_gpi_initialized=true; live_gpi_initialized=true;
} }
} }
@ -660,11 +664,13 @@ void RDLiveWire::ReadVersion(const QString &cmd)
connect(live_gpo_timers.back(),SIGNAL(timeout()),mapper,SLOT(map())); connect(live_gpo_timers.back(),SIGNAL(timeout()),mapper,SLOT(map()));
} }
} }
} if(!live_gpo_initialized) {
if(!live_gpo_initialized) { if(live_gpos>0) {
live_socket->writeBlock("CFG GPO\r\n",9); SendCommand("CFG GPO");
live_socket->writeBlock("ADD GPO\r\n",9); SendCommand("ADD GPO");
live_gpo_initialized=true; }
live_gpo_initialized=true;
}
} }
} }
} }

View File

@ -104,6 +104,7 @@ class RDLiveWire : public QObject
private: private:
void DespatchCommand(const QString &cmd); void DespatchCommand(const QString &cmd);
void SendCommand(const QString &cmd) const;
void ReadVersion(const QString &cmd); void ReadVersion(const QString &cmd);
void ReadSources(const QString &cmd); void ReadSources(const QString &cmd);
void ReadDestinations(const QString &cmd); void ReadDestinations(const QString &cmd);

View File

@ -58,6 +58,7 @@ LiveWireLwrpAudio::LiveWireLwrpAudio(RDMatrix *matrix,QObject *parent,const char
SIGNAL(destinationChanged(unsigned,RDLiveWireDestination *)), SIGNAL(destinationChanged(unsigned,RDLiveWireDestination *)),
this, this,
SLOT(destinationChangedData(unsigned,RDLiveWireDestination *))); SLOT(destinationChangedData(unsigned,RDLiveWireDestination *)));
/*
connect(livewire_nodes.back(), connect(livewire_nodes.back(),
SIGNAL(gpoConfigChanged(unsigned,unsigned,unsigned)), SIGNAL(gpoConfigChanged(unsigned,unsigned,unsigned)),
this, this,
@ -70,6 +71,7 @@ LiveWireLwrpAudio::LiveWireLwrpAudio(RDMatrix *matrix,QObject *parent,const char
SIGNAL(gpoChanged(unsigned,unsigned,unsigned,bool)), SIGNAL(gpoChanged(unsigned,unsigned,unsigned,bool)),
this, this,
SLOT(gpoChangedData(unsigned,unsigned,unsigned,bool))); SLOT(gpoChangedData(unsigned,unsigned,unsigned,bool)));
*/
connect(livewire_nodes.back(), connect(livewire_nodes.back(),
SIGNAL(watchdogStateChanged(unsigned,const QString &)), SIGNAL(watchdogStateChanged(unsigned,const QString &)),
this,SLOT(watchdogStateChangedData(unsigned,const QString &))); this,SLOT(watchdogStateChangedData(unsigned,const QString &)));