##// END OF EJS Templates
update before compilation on pc-alison
update before compilation on pc-alison

File last commit:

r46:47a6c68a9cf9 default
r49:0d83256ac6de default
Show More
entermode.cpp
95 lines | 3.2 KiB | text/x-c | CppLexer
#include "entermode.h"
EnterMode::EnterMode(QWidget *parent) :
QWidget(parent)
{
button_enterModeStandby = new QPushButton(tr("STANDBY"));
button_enterModeNormal = new QPushButton(tr("NORMAL"));
button_enterModeBurst = new QPushButton(tr("BURST"));
button_enterModeSBM1 = new QPushButton(tr("SBM1"));
button_enterModeSBM2 = new QPushButton(tr("SBM2"));
mainLayout = new QGridLayout();
overallLayout = new QGridLayout();
groupBox = new QGroupBox(tr("ENTER_MODE"));
mainLayout->addWidget(button_enterModeStandby, 0, 0, 1, 1);
mainLayout->addWidget(button_enterModeNormal, 1, 0, 1, 1);
mainLayout->addWidget(button_enterModeBurst, 2, 0, 1, 1);
mainLayout->addWidget(button_enterModeSBM1, 3, 0, 1, 1);
mainLayout->addWidget(button_enterModeSBM2, 4, 0, 1, 1);
mainLayout->setColumnStretch(1, 1);
mainLayout->setRowStretch(5, 1);
groupBox->setLayout(mainLayout);
parameterDump = new ParameterDump();
connect(this->button_enterModeStandby, SIGNAL(clicked()), this, SLOT(enterModeStandby()));
connect(this->button_enterModeNormal, SIGNAL(clicked()), this, SLOT(enterModeNormal()));
connect(this->button_enterModeBurst, SIGNAL(clicked()), this, SLOT(enterModeBurst()));
connect(this->button_enterModeSBM1, SIGNAL(clicked()), this, SLOT(enterModeSBM1()));
connect(this->button_enterModeSBM2, SIGNAL(clicked()), this, SLOT(enterModeSBM2()));
overallLayout->addWidget(groupBox, 0, 0, 1, 1);
this->setLayout(overallLayout);
}
void EnterMode::sendEnterMode( unsigned char mode)
{
Packet_TC_LFR_ENTER_MODE_t packet;
unsigned char crcAsTwoBytes[2];
packet.packetID[0] = (unsigned char) (TC_LFR_PACKET_ID >> 8);
packet.packetID[1] = (unsigned char) (TC_LFR_PACKET_ID );
packet.packetSequenceControl[0] = (unsigned char) (TC_LFR_PACKET_SEQUENCE_CONTROL >> 8);
packet.packetSequenceControl[1] = (unsigned char) (TC_LFR_PACKET_SEQUENCE_CONTROL );
packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_LFR_ENTER_MODE >> 8);
packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_LFR_ENTER_MODE );
packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
packet.serviceType = TC_TYPE_DEFAULT;
packet.serviceSubType = TC_SUBTYPE_ENTER_MODE;
packet.sourceID = SID_DEFAULT;
packet.spare = 0x00;
packet.mode = mode;
packet.enterModeTime[0] = 0x00;
packet.enterModeTime[1] = 0x00;
packet.enterModeTime[2] = 0x00;
packet.enterModeTime[3] = 0x00;
packet.enterModeTime[4] = 0x00;
packet.enterModeTime[5] = 0x00;
parameterDump->GetCRCAsTwoBytes((unsigned char*) &packet, crcAsTwoBytes,
PACKET_LENGTH_TC_LFR_ENTER_MODE + CCSDS_TC_TM_PACKET_OFFSET - 2);
packet.crc[0] = crcAsTwoBytes[0];
packet.crc[1] = crcAsTwoBytes[1];
emit WriteSPWSig((char*) &packet, PACKET_LENGTH_TC_LFR_ENTER_MODE + CCSDS_TC_TM_PACKET_OFFSET,
CCSDS_NODE_ADDRESS, CCSDS_USER_APP);
}
void EnterMode::enterModeStandby()
{
sendEnterMode( 0 );
}
void EnterMode::enterModeNormal()
{
sendEnterMode( 1 );
}
void EnterMode::enterModeBurst()
{
sendEnterMode( 2 );
}
void EnterMode::enterModeSBM1()
{
sendEnterMode( 3 );
}
void EnterMode::enterModeSBM2()
{
sendEnterMode( 4 );
}