##// END OF EJS Templates
Changes to lfrsge...
Changes to lfrsge Minor changes to the rmap plugin

File last commit:

r57:71cb087f0080 default
r58:6bfd3f59df14 default
Show More
entermode.cpp
270 lines | 10.6 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"));
button_reset = new QPushButton(tr("RESET"));
button_updateInfo = new QPushButton(tr("UPDATE_INFO"));
button_enableCalibration = new QPushButton(tr("ENABLE_CAL"));
button_disableCalibration = new QPushButton(tr("DISABLE_CAL"));
button_updateTime = new QPushButton(tr("UPDATE_TIME"));
mainLayout = new QGridLayout();
overallLayout = new QGridLayout();
layout_updateTime = new QVBoxLayout();
layout_otherTC = new QVBoxLayout();
// arbitraryTime = new ArbitraryTime(0);
layout_otherTC->addWidget(button_reset);
layout_otherTC->addWidget(button_updateInfo);
layout_otherTC->addWidget(button_enableCalibration);
layout_otherTC->addWidget(button_disableCalibration);
layout_otherTC->addStretch();
layout_updateTime->addWidget(button_updateTime);
// layout_updateTime->addWidget(arbitraryTime);
layout_updateTime->addStretch();
groupBox = new QGroupBox(tr("ENTER_MODE"));
groupBox_updateTime = new QGroupBox(tr("UPDATE_TIME"));
groupBox_otherTC = new QGroupBox(tr("OTHER TC"));
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);
groupBox_otherTC->setLayout(layout_otherTC);
groupBox_updateTime->setLayout(layout_updateTime);
parameterDump = new ParameterDump();
connect(this->button_reset, SIGNAL(clicked()), this, SLOT(sendReset()));
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()));
connect(this->button_updateInfo, SIGNAL(clicked()), this, SLOT(sendUpdateInfo()));
connect(this->button_enableCalibration, SIGNAL(clicked()), this, SLOT(sendEnableCalibration()));
connect(this->button_disableCalibration, SIGNAL(clicked()), this, SLOT(sendDisableCalibration()));
// connect(this->button_updateTime, SIGNAL(clicked()), this->arbitraryTime, SLOT(sendCurrentTimeToSend()));
overallLayout->addWidget(groupBox, 0, 0, 1, 1);
overallLayout->addWidget(groupBox_updateTime, 1, 0, 1, 1);
overallLayout->addWidget(groupBox_otherTC, 2, 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_TC_GROUND;
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 );
}
void EnterMode::sendReset()
{
Packet_TC_LFR_RESET_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_RESET >> 8);
packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_LFR_RESET );
packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
packet.serviceType = TC_TYPE_DEFAULT;
packet.serviceSubType = TC_SUBTYPE_RESET;
packet.sourceID = SID_TC_GROUND;
parameterDump->GetCRCAsTwoBytes((unsigned char*) &packet, crcAsTwoBytes,
PACKET_LENGTH_TC_LFR_RESET + CCSDS_TC_TM_PACKET_OFFSET - 2);
packet.crc[0] = crcAsTwoBytes[0];
packet.crc[1] = crcAsTwoBytes[1];
emit WriteSPWSig((char*) &packet, PACKET_LENGTH_TC_LFR_RESET + CCSDS_TC_TM_PACKET_OFFSET,
CCSDS_NODE_ADDRESS, CCSDS_USER_APP);
}
void EnterMode::sendUpdateInfo()
{
Packet_TC_LFR_UPDATE_INFO_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_UPDATE_INFO >> 8);
packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_LFR_UPDATE_INFO );
packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
packet.serviceType = TC_TYPE_DEFAULT;
packet.serviceSubType = TC_SUBTYPE_UPDATE_INFO;
packet.sourceID = SID_TC_GROUND;
packet.set1 = 0x00;
packet.set2 = 0x00;
packet.set3_bias_setting_set1[0] = 0x00;
packet.set3_bias_setting_set1[1] = 0x00;
packet.set3_bias_setting_set1[2] = 0x00;
packet.set3_bias_setting_set1[3] = 0x00;
packet.set3_bias_setting_set1[4] = 0x00;
packet.set3_bias_setting_set2[5] = 0x00;
packet.set3_bias_voltage[0] = 0x00;
packet.set3_bias_voltage[1] = 0x00;
packet.set3_bias_voltage[2] = 0x00;
packet.set3_bias_voltage[3] = 0x00;
packet.set4[0] = 0x00;
packet.set4[1] = 0x00;
packet.set4[2] = 0x00;
packet.set4[3] = 0x00;
packet.set4[4] = 0x00;
packet.set4[5] = 0x00;
packet.set4[6] = 0x00;
packet.set4[7] = 0x00;
packet.set5 = 0x00;
packet.set6 = 0x00;
packet.set7[0] = 0x00;
packet.set7[1] = 0x00;
packet.set7[2] = 0x00;
packet.set7[3] = 0x00;
packet.set7[4] = 0x00;
packet.set7[5] = 0x00;
packet.set7[6] = 0x00;
packet.set7[7] = 0x00;
parameterDump->GetCRCAsTwoBytes((unsigned char*) &packet, crcAsTwoBytes,
PACKET_LENGTH_TC_LFR_UPDATE_INFO + CCSDS_TC_TM_PACKET_OFFSET - 2);
packet.crc[0] = crcAsTwoBytes[0];
packet.crc[1] = crcAsTwoBytes[1];
emit WriteSPWSig((char*) &packet, PACKET_LENGTH_TC_LFR_UPDATE_INFO + CCSDS_TC_TM_PACKET_OFFSET,
CCSDS_NODE_ADDRESS, CCSDS_USER_APP);
}
void EnterMode::sendEnableCalibration()
{
Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_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_ENABLE_CALIBRATION >> 8);
packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_LFR_ENABLE_CALIBRATION );
packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
packet.serviceType = TC_TYPE_DEFAULT;
packet.serviceSubType = TC_SUBTYPE_ENABLE_CALIBRATION;
packet.sourceID = SID_TC_GROUND;
parameterDump->GetCRCAsTwoBytes((unsigned char*) &packet, crcAsTwoBytes,
PACKET_LENGTH_TC_LFR_ENABLE_CALIBRATION + CCSDS_TC_TM_PACKET_OFFSET - 2);
packet.crc[0] = crcAsTwoBytes[0];
packet.crc[1] = crcAsTwoBytes[1];
emit WriteSPWSig((char*) &packet, PACKET_LENGTH_TC_LFR_ENABLE_CALIBRATION + CCSDS_TC_TM_PACKET_OFFSET,
CCSDS_NODE_ADDRESS, CCSDS_USER_APP);
}
void EnterMode::sendDisableCalibration()
{
Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_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_DISABLE_CALIBRATION >> 8);
packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_LFR_DISABLE_CALIBRATION );
packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
packet.serviceType = TC_TYPE_DEFAULT;
packet.serviceSubType = TC_SUBTYPE_DISABLE_CALIBRATION;
packet.sourceID = SID_TC_GROUND;
parameterDump->GetCRCAsTwoBytes((unsigned char*) &packet, crcAsTwoBytes,
PACKET_LENGTH_TC_LFR_DISABLE_CALIBRATION + CCSDS_TC_TM_PACKET_OFFSET - 2);
packet.crc[0] = crcAsTwoBytes[0];
packet.crc[1] = crcAsTwoBytes[1];
emit WriteSPWSig((char*) &packet, PACKET_LENGTH_TC_LFR_DISABLE_CALIBRATION + CCSDS_TC_TM_PACKET_OFFSET,
CCSDS_NODE_ADDRESS, CCSDS_USER_APP);
}