##// END OF EJS Templates
Last comit before installation on pc-coillot
Last comit before installation on pc-coillot

File last commit:

r50:47b677d190ee default
r50:47b677d190ee default
Show More
rmapplugin.cpp
391 lines | 14.9 KiB | text/x-c | CppLexer
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0 /*------------------------------------------------------------------------------
-- This file is a part of the LPPMON Software
-- Copyright (C) 2012, Laboratory of Plasma Physics - CNRS
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------*/
/*-- Author : Paul LEROY
-- Mail : paul.leroy@lpp.polytechnique.fr
----------------------------------------------------------------------------*/
#include "rmapplugin.h"
#include <QHostAddress>
#include <QIODevice>
#include <QApplication>
#include <rmappluginpythonwrapper.h>
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 #include <PythonQt.h>
#include <QTimer>
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0
rmapplugin::rmapplugin(QWidget *parent)
:lppmonplugin(parent,false)
{
this->UI = new rmapPluginUI();
this->setWindowTitle(tr("RMAP and SPW Communication"));
this->setWidget((QWidget*)this->UI);
class gresb fully functional, writeSPW function not tested yet
r9
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0 timeCode = 0;
time_COARSE = 0;
time_FINE = 0;
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 currentBridge = selectedBridgeIsUnknown;
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 //**************
//Python wrapper
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0 this->pyObject = new rmappluginPythonWrapper();
connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 //**
connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL( WriteSPWSig(char*,uint,char,char) ),
this, SLOT( WriteSPW(char*,uint,char,char)), Qt::DirectConnection );
//**
connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL( updateTargetAddress(unsigned char) ),
this, SLOT( setValueTargetAddress(unsigned char)) );
//**
connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL( updateSourceAddress(unsigned char) ),
this, SLOT( setValueSourceAddress(unsigned char)) );
//**
connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL(sendMessage(QString)),
this, SLOT(displayOnConsole(QString)) );
Last commit before installation on pc-alison
r12 //**
connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL(fetchPacketSig()),
this, SLOT(fetchPacket()), Qt::DirectConnection );
waveform display added for the normal mode...
r19 //***
connect( (rmappluginPythonWrapper*)this->pyObject, SIGNAL(nbPacketHasChanged(int)),
this, SLOT(nbPacketHasChanged(int)));
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 //**************
//**************
// get a smart pointer to the __main__ module of the Python interpreter
PythonQtObjectPtr context = PythonQt::self()->getMainModule();
// add a QObject as variable of name "BUTTON_rmapOpenCommunication" to the namespace of the __main__ module
context.addObject("BUTTON_rmapOpenCommunication", UI->rmapOpenCommunicationButton);
context.addObject("BUTTON_rmapCloseCommunication", UI->rmapCloseCommunicationButton);
context.addObject("BUTTON_selectStarDundee", UI->selectStarDundee_BUTTON);
context.addObject("BUTTON_selectGRESB", UI->selectGRESB_BUTTON);
context.addObject("GRESB_Bridge", UI->gresbBridge);
//**************
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge()));
connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge()));
waveform display added for the normal mode...
r19 connect(this, SIGNAL(
updateStatistics(unsigned char,unsigned char,unsigned char,unsigned char,uint,uint,uint,uint)
),
this->UI->tmStatistics, SLOT(
updateStatistics(unsigned char,unsigned char,unsigned char,unsigned char,uint,uint,uint,uint)
));
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1
first version of the waveform display...
r17 //******
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 // GRESB
class gresb fully functional, writeSPW function not tested yet
r9 connect(this->UI->gresbBridge, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
connect(this->UI->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool)));
connect(this->UI->gresbBridge, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
connect(this->UI->gresbBridge, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
the two bridges, Star Dundee and GRESB are fully functional
r10 connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->gresbBridge, SLOT(ccsdsPacketIsProcessed()));
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 connect(this->UI->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)),
this->UI->gresbBridge, SLOT(targetHasChanged(int)));
connect(this->UI->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)),
this->UI->gresbBridge, SLOT(sourceHasChanged(int)));
first version of the waveform display...
r17 connect(this->UI->gresbBridge, SIGNAL(sendPacket(TMPacketToRead*)),
Waveform display features...
r21 this, SLOT(receivePacketFromBridge(TMPacketToRead*)), Qt::DirectConnection);
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1
first version of the waveform display...
r17 //************
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 // Star Dundee
class gresb fully functional, writeSPW function not tested yet
r9 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool)));
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
the two bridges, Star Dundee and GRESB are fully functional
r10 connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->starDundee, SLOT(ccsdsPacketIsProcessed()));
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 connect(this->UI->rmapTargetLogicalAddressSpinBox, SIGNAL(valueChanged(int)),
this->UI->starDundee, SLOT(targetHasChanged(int)));
connect(this->UI->rmapSourceLogicalAddressSpinBox, SIGNAL(valueChanged(int)),
this->UI->starDundee, SLOT(sourceHasChanged(int)));
first version of the waveform display...
r17 connect(this->UI->starDundee, SIGNAL(sendPacket(TMPacketToRead*)),
Waveform display features...
r21 this, SLOT(receivePacketFromBridge(TMPacketToRead*)), Qt::DirectConnection);
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1
connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge)));
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11
first version of the waveform display...
r17 ((rmappluginPythonWrapper*)this->pyObject)->ccsdsPacketStore = &(this->generalCCSDSPacketStore);
dashboard tab added to the rmapplugin...
r46
//************
// LFR ACtions
connect(this->UI->lfrActions, SIGNAL(WriteSPWSig(char*,uint,char,char)),
this, SLOT(WriteSPW(char*,uint,char,char)));
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0 }
rmapplugin::~rmapplugin()
{
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 switch(currentBridge)
{
case selectedBridgeIsGRESB :
dashboard tab added to the rmapplugin...
r46 this->UI->gresbBridge->writeSettings();
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 break;
case selectedBridgeIsStarDundee :
break;
default:
break;
}
Last comit before installation on pc-coillot
r50 this->UI->tmStatistics->writeSettings();
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0 }
unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address)
{
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 unsigned int result;
switch(currentBridge)
{
case selectedBridgeIsGRESB :
class gresb fully functional, writeSPW function not tested yet
r9 result = UI->gresbBridge->Write(Value, count, address);
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 break;
case selectedBridgeIsStarDundee :
Minor updates
r3 result = UI->starDundee->Write(Value, count, address);
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 break;
default:
result = 1;
break;
}
return result;
}
unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address)
{
unsigned int result;
switch(currentBridge)
{
case selectedBridgeIsGRESB :
class gresb fully functional, writeSPW function not tested yet
r9 result = UI->gresbBridge->Read(Value, count, address);
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 break;
case selectedBridgeIsStarDundee :
Minor updates
r3 result = UI->starDundee->Read(Value, count, address);
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 break;
default:
result = 1;
break;
}
return result;
}
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0 ////////
// SLOTS
unsigned int rmapplugin::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) // SLOT
{
Minor updates
r3 unsigned int result;
switch(currentBridge)
{
case selectedBridgeIsGRESB :
class gresb fully functional, writeSPW function not tested yet
r9 result = UI->gresbBridge->WriteSPW(Value, count, targetLogicalAddress, userApplication);
Minor updates
r3 break;
case selectedBridgeIsStarDundee :
result = UI->starDundee->WriteSPW(Value, count, targetLogicalAddress, userApplication);
break;
default:
result = 1;
break;
}
return result;
}
class gresb fully functional, writeSPW function not tested yet
r9 void rmapplugin::openBridge()
{
switch(currentBridge)
{
case selectedBridgeIsGRESB :
this->UI->gresbBridge->Open();
break;
case selectedBridgeIsStarDundee :
this->UI->starDundee->Open();
break;
default:
break;
}
}
void rmapplugin::closeBridge()
{
switch(currentBridge)
{
case selectedBridgeIsGRESB :
this->UI->gresbBridge->Close();
break;
case selectedBridgeIsStarDundee :
this->UI->starDundee->Close();
break;
default:
break;
}
}
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 void rmapplugin::RMAP_write_reply_setText(QString text)
{
this->UI->RMAP_write_reply->setText(text);
}
void rmapplugin::appendToLog(QString text)
{
APPENDTOLOG(text);
}
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 void rmapplugin::setValueTargetAddress(unsigned char newAddress)
{
this->UI->rmapTargetLogicalAddressSpinBox->setValue(newAddress);
}
void rmapplugin::setValueSourceAddress(unsigned char newAddress)
{
this->UI->rmapSourceLogicalAddressSpinBox->setValue(newAddress);
}
first version of the waveform display...
r17 void rmapplugin::receivePacketFromBridge(TMPacketToRead *packet)
{
preProcessPacket(packet);
First version of the gse-lesia module...
r23
// Send the packet to the TM echo bridge for processing
Minor updates to the rmapplugin...
r45 this->UI->tmEchoBridge->sendTMPacketLESIA(packet);
First version of the gse-lesia module...
r23
first version of the waveform display...
r17 this->generalCCSDSPacketStore.append(packet);
Last comit before installation on pc-coillot
r50 if (this->generalCCSDSPacketStore.size() > 200)
dashboard tab added to the rmapplugin...
r46 {
this->generalCCSDSPacketStore.erase(generalCCSDSPacketStore.begin(),
Last comit before installation on pc-coillot
r50 generalCCSDSPacketStore.begin() + 100);
dashboard tab added to the rmapplugin...
r46 }
waveform display added for the normal mode...
r19 this->UI->nbPacketInStore->setText("nb packets in store: " + QString::number(generalCCSDSPacketStore.size()));
first version of the waveform display...
r17 processPacketStore();
}
void rmapplugin::preProcessPacket(TMPacketToRead *packet)
{
waveform display added for the normal mode...
r19 unsigned char pid = 0;
unsigned char cat = 0;
first version of the waveform display...
r17 unsigned char typ = 0;
unsigned char sub = 0;
waveform display added for the normal mode...
r19 unsigned int sid = 0;
unsigned int length = 0;
unsigned int coarse_t = 0;
unsigned int fine_t = 0;
first version of the waveform display...
r17
waveform display added for the normal mode...
r19 //*********************************
// get the parameters of the packet
Minor updates to the rmapplugin...
r45 pid = this->UI->tmStatistics->getPID( packet );
cat = this->UI->tmStatistics->getCAT( packet );
typ = this->UI->tmStatistics->getTYPE( packet );
sub = this->UI->tmStatistics->getSUBTYPE( packet );
length = this->UI->tmStatistics->getLENGTH( packet );
coarse_t = this->UI->tmStatistics->getCoarseTime( packet );
fine_t = this->UI->tmStatistics->getFineTime( packet );
sid = this->UI->tmStatistics->getSID( packet, pid, cat, typ, sub );
waveform display added for the normal mode...
r19
emit updateStatistics(pid, cat, typ, sub, sid, length, coarse_t, fine_t);
dashboard tab added to the rmapplugin...
r46 //**********************************************
// if the packet is a parameter dump, display it
if ( (typ == TM_TYPE_PARAMETER_DUMP) & (sub == TM_SUBTYPE_PARAMETER_DUMP) & (sid == SID_PARAMETER_DUMP) )
{
this->UI->lfrActions->parameterDump->updateParameterDump(packet);
}
first version of the waveform display...
r17 }
waveform display added for the normal mode...
r19 void rmapplugin::nbPacketHasChanged(int nb)
{
this->UI->nbPacketInStore->setText("nb packets in store: " + QString::number(nb));
}
void rmapplugin::buildWFAndDisplay(TMPacketToRead *packet, WFPacket *wfPacket, unsigned char num_page)
{
unsigned int i = 0;
unsigned int j = 0;
unsigned char *data;
unsigned char pkt_nr = 0;
unsigned int blk_nr = 0;
pkt_nr = packet->Value[23]; // PKT_NR
blk_nr = packet->Value[24] * 256 + packet->Value[25];
data = &packet->Value[26]; // start of the first data block;
j = (pkt_nr-1) * 340;
for ( i=0; i<blk_nr; i++ ){
Waveform display features...
r21 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
wfPacket->wf_b1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
wfPacket->wf_b3[j + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
wfPacket->wf_b2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
waveform display added for the normal mode...
r19 }
if (pkt_nr == 7)
{
Waveform display features...
r21 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_v, num_page, 0);
waveform display added for the normal mode...
r19 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_e1, num_page, 1);
this->UI->wfDisplay->displayOnPlot(wfPacket->wf_e2, num_page, 2);
this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b1, num_page, 3);
this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b2, num_page, 4);
this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b3, num_page, 5);
}
}
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
r0 /////////////////////
// INTERNAL FUNCTIONS
the two bridges, Star Dundee and GRESB are fully functional
r10 void rmapplugin::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 {
the two bridges, Star Dundee and GRESB are fully functional
r10 QString message;
unsigned int fine_time_value = 0;
fine_time_value = ((unsigned int) ccsdsPacket[7]<<24)
+ ((unsigned int) ccsdsPacket[6]<<16)
+ ((unsigned int) ccsdsPacket[5]<<8)
+ ((unsigned int) ccsdsPacket[4]);
message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": ");
message.append("size "
+ QString::number(size)
+" *** header "
+ QString::number(ccsdsPacket[0], 16)
+ " "
+ QString::number(ccsdsPacket[1], 16)
+ " "
+ QString::number(ccsdsPacket[2], 16)
+ " "
+ QString::number(ccsdsPacket[3], 16)
+ " *** coarse time "
+ QString::number(fine_time_value));
//+ QString::number(ccsdsPacket[4], 16)
//+" "
//+ QString::number(ccsdsPacket[5], 16)
//+" "
//+ QString::number(ccsdsPacket[6], 16)
//+" "
//+ QString::number(ccsdsPacket[7], 16));
displayOnConsole(message);
plugin updated, TM packet store reworked to store any TM continuously...
r13 //((rmappluginPythonWrapper*)this->pyObject)->storeCCSDSPacket(ccsdsPacket, size);
the two bridges, Star Dundee and GRESB are fully functional
r10 emit ccsdsPacketIsProcessed();
paul@pc-solar1.lab-lpp.local
First version with the Star Dundee bridge operational
r1 }
Plugin modified to allow the launch of interactiv tests from the python interpreter...
r11 void rmapplugin::processPacketStore()
{
Last commit before installation on pc-alison
r12 ((rmappluginPythonWrapper*)this->pyObject)->processPacketStore();
}
int rmapplugin::fetchPacket()
{
int ret = 0;
switch(currentBridge)
{
case selectedBridgeIsGRESB :
break;
case selectedBridgeIsStarDundee :
ret = this->UI->starDundee->receiveSPWPacketLoop();
break;
default:
break;
}
return ret;
}
dashboard tab added to the rmapplugin...
r46