1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

AIS mod: make it effectively work in server mode with remote control. AIS demod: added baud rate in settings API

This commit is contained in:
f4exb 2021-11-12 00:12:02 +01:00
parent af97c872f8
commit 006da4e872
24 changed files with 522 additions and 346 deletions

View File

@ -233,6 +233,9 @@ void AISDemod::applySettings(const AISDemodSettings& settings, bool force)
QList<QString> reverseAPIKeys;
if ((settings.m_baud != m_settings.m_baud) || force) {
reverseAPIKeys.append("baud");
}
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
reverseAPIKeys.append("inputFrequencyOffset");
}
@ -404,6 +407,9 @@ void AISDemod::webapiUpdateChannelSettings(
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response)
{
if (channelSettingsKeys.contains("baud")) {
settings.m_baud = response.getAisDemodSettings()->getBaud();
}
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
settings.m_inputFrequencyOffset = response.getAisDemodSettings()->getInputFrequencyOffset();
}
@ -462,6 +468,7 @@ void AISDemod::webapiUpdateChannelSettings(
void AISDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const AISDemodSettings& settings)
{
response.getAisDemodSettings()->setBaud(settings.m_baud);
response.getAisDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
response.getAisDemodSettings()->setRfBandwidth(settings.m_rfBandwidth);
response.getAisDemodSettings()->setFmDeviation(settings.m_fmDeviation);
@ -535,6 +542,9 @@ void AISDemod::webapiFormatChannelSettings(
// transfer data that has been modified. When force is on transfer all data except reverse API data
if (channelSettingsKeys.contains("baud") || force) {
swgAISDemodSettings->setBaud(settings.m_baud);
}
if (channelSettingsKeys.contains("fmDeviation") || force) {
swgAISDemodSettings->setFmDeviation(settings.m_fmDeviation);
}

View File

@ -89,9 +89,9 @@ QByteArray AISDemodSettings::serialize() const
s.writeU32(19, m_reverseAPIDeviceIndex);
s.writeU32(20, m_reverseAPIChannelIndex);
s.writeBlob(21, m_scopeGUI->serialize());
s.writeString(22, m_logFilename);
s.writeBool(23, m_logEnabled);
s.writeS32(24, m_baud);
for (int i = 0; i < AISDEMOD_MESSAGE_COLUMNS; i++)
s.writeS32(100 + i, m_messageColumnIndexes[i]);
@ -161,6 +161,7 @@ bool AISDemodSettings::deserialize(const QByteArray& data)
d.readString(22, &m_logFilename, "ais_log.csv");
d.readBool(23, &m_logEnabled, false);
d.readS32(24, &m_baud, 9600);
for (int i = 0; i < AISDEMOD_MESSAGE_COLUMNS; i++)
d.readS32(100 + i, &m_messageColumnIndexes[i], i);

View File

@ -45,7 +45,9 @@
#include "aismod.h"
MESSAGE_CLASS_DEFINITION(AISMod::MsgConfigureAISMod, Message)
MESSAGE_CLASS_DEFINITION(AISMod::MsgTXAISMod, Message)
MESSAGE_CLASS_DEFINITION(AISMod::MsgReportData, Message)
MESSAGE_CLASS_DEFINITION(AISMod::MsgTx, Message)
MESSAGE_CLASS_DEFINITION(AISMod::MsgEncode, Message)
MESSAGE_CLASS_DEFINITION(AISMod::MsgTXPacketBytes, Message)
const char* const AISMod::m_channelIdURI = "sdrangel.channel.modais";
@ -117,15 +119,21 @@ bool AISMod::handleMessage(const Message& cmd)
return true;
}
else if (MsgTXAISMod::match(cmd))
else if (MsgTx::match(cmd))
{
// Forward a copy to baseband
MsgTXAISMod* rep = new MsgTXAISMod((MsgTXAISMod&)cmd);
qDebug() << "AISMod::handleMessage: MsgTXAISMod";
MsgTx* rep = new MsgTx((MsgTx&)cmd);
qDebug() << "AISMod::handleMessage: MsgTx";
m_basebandSource->getInputMessageQueue()->push(rep);
return true;
}
else if (MsgEncode::match(cmd))
{
qDebug() << "AISMod::handleMessage: MsgEncode";
encode();
return true;
}
else if (DSPSignalNotification::match(cmd))
{
// Forward to the source
@ -153,6 +161,118 @@ ScopeVis *AISMod::getScopeSink()
return m_basebandSource->getScopeSink();
}
// Convert decimal degrees to 1/10000 minutes
int AISMod::degToMinFracs(float decimal)
{
return std::round(decimal * 60.0f * 10000.0f);
}
void AISMod::encode()
{
unsigned char bytes[168/8];
int mmsi;
int latitude;
int longitude;
mmsi = m_settings.m_mmsi.toInt();
latitude = degToMinFracs(m_settings.m_latitude);
longitude = degToMinFracs(m_settings.m_longitude);
if (m_settings.getMsgId() == 4)
{
// Base station report
QDateTime currentDateTime = QDateTime::currentDateTimeUtc();
QDate currentDate = currentDateTime.date();
QTime currentTime = currentDateTime.time();
int year = currentDate.year();
int month = currentDate.month();
int day = currentDate.day();
int hour = currentTime.hour();
int minute = currentTime.minute();
int second = currentTime.second();
bytes[0] = (m_settings.getMsgId() << 2); // Repeat indicator = 0
bytes[1] = (mmsi >> 22) & 0xff;
bytes[2] = (mmsi >> 14) & 0xff;
bytes[3] = (mmsi >> 6) & 0xff;
bytes[4] = ((mmsi & 0x3f) << 2) | ((year >> 12) & 0x3);
bytes[5] = (year >> 4) & 0xff;
bytes[6] = ((year & 0xf) << 4) | month;
bytes[7] = (day << 3) | ((hour >> 2) & 0x7);
bytes[8] = ((hour & 0x3) << 6) | minute;
bytes[9] = (second << 2) | (0 << 1) | ((longitude >> 27) & 1);
bytes[10] = (longitude >> 19) & 0xff;
bytes[11] = (longitude >> 11) & 0xff;
bytes[12] = (longitude >> 3) & 0xff;
bytes[13] = ((longitude & 0x7) << 5) | ((latitude >> 22) & 0x1f);
bytes[14] = (latitude >> 14) & 0xff;
bytes[15] = (latitude >> 6) & 0xff;
bytes[16] = ((latitude & 0x3f) << 2);
bytes[17] = 0;
bytes[18] = 0;
bytes[19] = 0;
bytes[20] = 0;
}
else
{
// Position report
int status;
int rateOfTurn = 0x80; // Not available as not currently in GUI
int speedOverGround;
int courseOverGround;
int timestamp;
timestamp = QDateTime::currentDateTimeUtc().time().second();
if (m_settings.m_speed >= 102.2)
speedOverGround = 1022;
else
speedOverGround = std::round(m_settings.m_speed * 10.0);
courseOverGround = std::floor(m_settings.m_course * 10.0);
if (m_settings.m_status == AISModSettings::StatusNotDefined) // Not defined (last in combo box)
status = 15;
else
status = (int) m_settings.m_status;
bytes[0] = (m_settings.getMsgId() << 2); // Repeat indicator = 0
bytes[1] = (mmsi >> 22) & 0xff;
bytes[2] = (mmsi >> 14) & 0xff;
bytes[3] = (mmsi >> 6) & 0xff;
bytes[4] = ((mmsi & 0x3f) << 2) | (status >> 2);
bytes[5] = ((status & 0x3) << 6) | ((rateOfTurn >> 2) & 0x3f);
bytes[6] = ((rateOfTurn & 0x3) << 6) | ((speedOverGround >> 4) & 0x3f);
bytes[7] = ((speedOverGround & 0xf) << 4) | (0 << 3) | ((longitude >> 25) & 0x7); // Position accuracy = 0
bytes[8] = (longitude >> 17) & 0xff;
bytes[9] = (longitude >> 9) & 0xff;
bytes[10] = (longitude >> 1) & 0xff;
bytes[11] = ((longitude & 0x1) << 7) | ((latitude >> 20) & 0x7f);
bytes[12] = (latitude >> 12) & 0xff;
bytes[13] = (latitude >> 4) & 0xff;
bytes[14] = ((latitude & 0xf) << 4) | ((courseOverGround >> 8) & 0xf);
bytes[15] = courseOverGround & 0xff;
bytes[16] = ((m_settings.m_heading >> 1) & 0xff);
bytes[17] = ((m_settings.m_heading & 0x1) << 7) | ((timestamp & 0x3f) << 1);
bytes[18] = 0;
bytes[19] = 0;
bytes[20] = 0;
}
QByteArray ba((const char *)bytes, sizeof(bytes));
m_settings.m_data = ba.toHex();
if (getMessageQueueToGUI())
{
MsgReportData *msg = MsgReportData::create(m_settings.m_data);
getMessageQueueToGUI()->push(msg);
}
}
void AISMod::applySettings(const AISModSettings& settings, bool force)
{
qDebug() << "AISMod::applySettings:"
@ -197,6 +317,10 @@ void AISMod::applySettings(const AISModSettings& settings, bool force)
reverseAPIKeys.append("repeat");
}
if ((settings.m_baud != m_settings.m_baud) || force) {
reverseAPIKeys.append("baud");
}
if ((settings.m_repeatDelay != m_settings.m_repeatDelay) || force) {
reverseAPIKeys.append("repeatDelay");
}
@ -225,8 +349,8 @@ void AISMod::applySettings(const AISModSettings& settings, bool force)
reverseAPIKeys.append("writeToFile");
}
if ((settings.m_msgId != m_settings.m_msgId) || force) {
reverseAPIKeys.append("msgId");
if ((settings.m_msgType != m_settings.m_msgType) || force) {
reverseAPIKeys.append("msgType");
}
if ((settings.m_mmsi != m_settings.m_mmsi) || force) {
@ -426,6 +550,9 @@ void AISMod::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("repeat")) {
settings.m_repeat = response.getAisModSettings()->getRepeat() != 0;
}
if (channelSettingsKeys.contains("baud")) {
settings.m_baud = response.getAisModSettings()->getBaud();
}
if (channelSettingsKeys.contains("repeatDelay")) {
settings.m_repeatDelay = response.getAisModSettings()->getRepeatDelay();
}
@ -447,11 +574,14 @@ void AISMod::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("writeToFile")) {
settings.m_writeToFile = response.getAisModSettings()->getWriteToFile() != 0;
}
if (channelSettingsKeys.contains("msgType")) {
settings.m_msgType = (AISModSettings::MsgType) response.getAisModSettings()->getMsgType();
}
if (channelSettingsKeys.contains("mmsi")) {
settings.m_mmsi = *response.getAisModSettings()->getMmsi();
}
if (channelSettingsKeys.contains("status")) {
settings.m_status = response.getAisModSettings()->getStatus();
settings.m_status = (AISModSettings::Status) response.getAisModSettings()->getStatus();
}
if (channelSettingsKeys.contains("latitude")) {
settings.m_latitude = response.getAisModSettings()->getLatitude();
@ -532,23 +662,25 @@ int AISMod::webapiActionsPost(
if (swgAISModActions)
{
if (channelActionsKeys.contains("encode"))
{
if (swgAISModActions->getEncode() != 0)
{
AISMod::MsgEncode *msg = AISMod::MsgEncode::create();
getInputMessageQueue()->push(msg);
}
return 202;
}
if (channelActionsKeys.contains("tx"))
{
SWGSDRangel::SWGAISModActions_tx* tx = swgAISModActions->getTx();
QString *dataP = tx->getData();
if (dataP)
if (swgAISModActions->getTx() != 0)
{
QString data(*dataP);
AISMod::MsgTXAISMod *msg = AISMod::MsgTXAISMod::create(data);
AISMod::MsgTx *msg = AISMod::MsgTx::create();
m_basebandSource->getInputMessageQueue()->push(msg);
return 202;
}
else
{
errorMessage = "Message must contain data";
return 400;
}
return 202;
}
else
{
@ -571,6 +703,7 @@ void AISMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
response.getAisModSettings()->setRfBandwidth(settings.m_rfBandwidth);
response.getAisModSettings()->setGain(settings.m_gain);
response.getAisModSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
response.getAisModSettings()->setBaud(settings.m_baud);
response.getAisModSettings()->setRepeat(settings.m_repeat ? 1 : 0);
response.getAisModSettings()->setRepeatDelay(settings.m_repeatDelay);
response.getAisModSettings()->setRepeatCount(settings.m_repeatCount);
@ -579,13 +712,14 @@ void AISMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
response.getAisModSettings()->setRampRange(settings.m_rampRange);
response.getAisModSettings()->setRfNoise(settings.m_rfNoise ? 1 : 0);
response.getAisModSettings()->setWriteToFile(settings.m_writeToFile ? 1 : 0);
response.getAisModSettings()->setMsgType((int) settings.m_msgType);
if (response.getAisModSettings()->getMmsi()) {
*response.getAisModSettings()->getMmsi() = settings.m_mmsi;
} else {
response.getAisModSettings()->setMmsi(new QString(settings.m_mmsi));
}
response.getAisModSettings()->setStatus(settings.m_status);
response.getAisModSettings()->setStatus((int) settings.m_status);
response.getAisModSettings()->setLatitude(settings.m_latitude);
response.getAisModSettings()->setLongitude(settings.m_longitude);
response.getAisModSettings()->setCourse(settings.m_course);
@ -709,6 +843,9 @@ void AISMod::webapiFormatChannelSettings(
if (channelSettingsKeys.contains("channelMute") || force) {
swgAISModSettings->setChannelMute(settings.m_channelMute ? 1 : 0);
}
if (channelSettingsKeys.contains("baud") || force) {
swgAISModSettings->setBaud(settings.m_baud);
}
if (channelSettingsKeys.contains("repeat") || force) {
swgAISModSettings->setRepeat(settings.m_repeat ? 1 : 0);
}
@ -733,11 +870,14 @@ void AISMod::webapiFormatChannelSettings(
if (channelSettingsKeys.contains("writeToFile")) {
swgAISModSettings->setWriteToFile(settings.m_writeToFile ? 1 : 0);
}
if (channelSettingsKeys.contains("msgType")) {
swgAISModSettings->setMsgType((int) settings.m_msgType);
}
if (channelSettingsKeys.contains("mmsi")) {
swgAISModSettings->setMmsi(new QString(settings.m_mmsi));
}
if (channelSettingsKeys.contains("status")) {
swgAISModSettings->setStatus(settings.m_status);
swgAISModSettings->setStatus((int) settings.m_status);
}
if (channelSettingsKeys.contains("latitude")) {
swgAISModSettings->setLatitude(settings.m_latitude);

View File

@ -66,22 +66,49 @@ public:
{ }
};
class MsgTXAISMod : public Message {
class MsgReportData : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgTXAISMod* create(QString data)
{
return new MsgTXAISMod(data);
static MsgReportData* create(const QString& data) {
return new MsgReportData(data);
}
const QString& getData() const { return m_data; }
private:
QString m_data;
private:
MsgTXAISMod(QString data) :
MsgReportData(const QString& data) :
Message(),
m_data(data)
{}
};
class MsgTx : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgTx* create() {
return new MsgTx();
}
private:
MsgTx() :
Message()
{ }
};
class MsgEncode : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgEncode* create() {
return new MsgEncode();
}
private:
MsgEncode() :
Message()
{ }
};
@ -89,8 +116,7 @@ public:
MESSAGE_CLASS_DECLARATION
public:
static MsgTXPacketBytes* create(QByteArray data)
{
static MsgTXPacketBytes* create(const QByteArray& data) {
return new MsgTXPacketBytes(data);
}
@ -98,7 +124,7 @@ public:
private:
MsgTXPacketBytes(QByteArray data) :
MsgTXPacketBytes(const QByteArray& data) :
Message(),
m_data(data)
{ }
@ -165,6 +191,7 @@ public:
double getMagSq() const;
void setLevelMeter(QObject *levelMeter);
uint32_t getNumberOfDeviceStreams() const;
void encode();
static const char* const m_channelIdURI;
static const char* const m_channelId;
@ -201,6 +228,7 @@ private:
);
void openUDP(const AISModSettings& settings);
void closeUDP();
static int degToMinFracs(float decimal);
private slots:
void networkManagerFinished(QNetworkReply *reply);

View File

@ -151,17 +151,16 @@ bool AISModBaseband::handleMessage(const Message& cmd)
return true;
}
else if (AISMod::MsgTXAISMod::match(cmd))
else if (AISMod::MsgTx::match(cmd)) // immediate transmission of stored message
{
AISMod::MsgTXAISMod& tx = (AISMod::MsgTXAISMod&) cmd;
m_source.addTXPacket(tx.m_data);
m_source.transmit();
return true;
}
else if (AISMod::MsgTXPacketBytes::match(cmd))
else if (AISMod::MsgTXPacketBytes::match(cmd)) // This is packet from UDP with immediate transmission
{
AISMod::MsgTXPacketBytes& tx = (AISMod::MsgTXPacketBytes&) cmd;
m_source.addTXPacket(tx.m_data);
m_source.transmit();
return true;
}

View File

@ -88,6 +88,13 @@ bool AISModGUI::handleMessage(const Message& message)
blockApplySettings(false);
return true;
}
else if (AISMod::MsgReportData::match(message))
{
const AISMod::MsgReportData& report = (AISMod::MsgReportData&) message;
m_settings.m_data = report.getData();
ui->message->setText(m_settings.m_data);
return true;
}
else
{
return false;
@ -104,8 +111,9 @@ void AISModGUI::channelMarkerChangedByCursor()
void AISModGUI::handleSourceMessages()
{
Message* message;
MessageQueue *messageQueue = getInputMessageQueue();
while ((message = getInputMessageQueue()->pop()) != 0)
while ((message = messageQueue->pop()) != 0)
{
if (handleMessage(*message))
{
@ -123,13 +131,16 @@ void AISModGUI::on_deltaFrequency_changed(qint64 value)
void AISModGUI::on_mode_currentIndexChanged(int value)
{
QString mode = ui->mode->currentText();
// If m_doApplySettings is set, we are here from a call to displaySettings,
// so we only want to display the current settings, not update them
// as though a user had selected a new mode
if (m_doApplySettings)
m_settings.setMode(mode);
{
m_settings.m_rfBandwidth = m_settings.getRfBandwidth(value);
m_settings.m_fmDeviation = m_settings.getFMDeviation(value);
m_settings.m_bt = m_settings.getBT(value);
}
ui->rfBWText->setText(QString("%1k").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1));
ui->rfBW->setValue(m_settings.m_rfBandwidth / 100.0);
@ -138,10 +149,6 @@ void AISModGUI::on_mode_currentIndexChanged(int value)
ui->btText->setText(QString("%1").arg(m_settings.m_bt, 0, 'f', 1));
ui->bt->setValue(m_settings.m_bt * 10);
applySettings();
// Remove custom mode when deselected, as we no longer know how to set it
if (value < 2)
ui->mode->removeItem(2);
}
void AISModGUI::on_rfBW_valueChanged(int value)
@ -196,12 +203,13 @@ void AISModGUI::on_txButton_clicked()
void AISModGUI::on_message_returnPressed()
{
transmit();
m_settings.m_data = ui->message->text();
applySettings();
}
void AISModGUI::on_msgId_currentIndexChanged(int index)
{
m_settings.m_msgId = index + 1;
m_settings.m_msgType = (AISModSettings::MsgType) index;
applySettings();
}
@ -213,7 +221,7 @@ void AISModGUI::on_mmsi_editingFinished()
void AISModGUI::on_status_currentIndexChanged(int index)
{
m_settings.m_status = index;
m_settings.m_status = (AISModSettings::Status) index;
applySettings();
}
@ -253,114 +261,11 @@ void AISModGUI::on_message_editingFinished()
applySettings();
}
// Convert decimal degrees to 1/10000 minutes
static int degToMinFracs(float decimal)
{
return std::round(decimal * 60.0f * 10000.0f);
}
// Encode the message specified by the GUI controls in to a hex string and put in message field
// Encode the message specified in individual settings in to a hex string (data settings) and put in message field
void AISModGUI::on_encode_clicked()
{
unsigned char bytes[168/8];
int mmsi;
int latitude;
int longitude;
mmsi = m_settings.m_mmsi.toInt();
latitude = degToMinFracs(m_settings.m_latitude);
longitude = degToMinFracs(m_settings.m_longitude);
if (m_settings.m_msgId == 4)
{
// Base station report
QDateTime currentDateTime = QDateTime::currentDateTimeUtc();
QDate currentDate = currentDateTime.date();
QTime currentTime = currentDateTime.time();
int year = currentDate.year();
int month = currentDate.month();
int day = currentDate.day();
int hour = currentTime.hour();
int minute = currentTime.minute();
int second = currentTime.second();
bytes[0] = (m_settings.m_msgId << 2); // Repeat indicator = 0
bytes[1] = (mmsi >> 22) & 0xff;
bytes[2] = (mmsi >> 14) & 0xff;
bytes[3] = (mmsi >> 6) & 0xff;
bytes[4] = ((mmsi & 0x3f) << 2) | ((year >> 12) & 0x3);
bytes[5] = (year >> 4) & 0xff;
bytes[6] = ((year & 0xf) << 4) | month;
bytes[7] = (day << 3) | ((hour >> 2) & 0x7);
bytes[8] = ((hour & 0x3) << 6) | minute;
bytes[9] = (second << 2) | (0 << 1) | ((longitude >> 27) & 1);
bytes[10] = (longitude >> 19) & 0xff;
bytes[11] = (longitude >> 11) & 0xff;
bytes[12] = (longitude >> 3) & 0xff;
bytes[13] = ((longitude & 0x7) << 5) | ((latitude >> 22) & 0x1f);
bytes[14] = (latitude >> 14) & 0xff;
bytes[15] = (latitude >> 6) & 0xff;
bytes[16] = ((latitude & 0x3f) << 2);
bytes[17] = 0;
bytes[18] = 0;
bytes[19] = 0;
bytes[20] = 0;
}
else
{
// Position report
int status;
int rateOfTurn = 0x80; // Not available as not currently in GUI
int speedOverGround;
int courseOverGround;
int timestamp;
timestamp = QDateTime::currentDateTimeUtc().time().second();
if (m_settings.m_speed >= 102.2)
speedOverGround = 1022;
else
speedOverGround = std::round(m_settings.m_speed * 10.0);
courseOverGround = std::floor(m_settings.m_course * 10.0);
if (m_settings.m_status == 9) // Not defined (last in combo box)
status = 15;
else
status = m_settings.m_status;
bytes[0] = (m_settings.m_msgId << 2); // Repeat indicator = 0
bytes[1] = (mmsi >> 22) & 0xff;
bytes[2] = (mmsi >> 14) & 0xff;
bytes[3] = (mmsi >> 6) & 0xff;
bytes[4] = ((mmsi & 0x3f) << 2) | (status >> 2);
bytes[5] = ((status & 0x3) << 6) | ((rateOfTurn >> 2) & 0x3f);
bytes[6] = ((rateOfTurn & 0x3) << 6) | ((speedOverGround >> 4) & 0x3f);
bytes[7] = ((speedOverGround & 0xf) << 4) | (0 << 3) | ((longitude >> 25) & 0x7); // Position accuracy = 0
bytes[8] = (longitude >> 17) & 0xff;
bytes[9] = (longitude >> 9) & 0xff;
bytes[10] = (longitude >> 1) & 0xff;
bytes[11] = ((longitude & 0x1) << 7) | ((latitude >> 20) & 0x7f);
bytes[12] = (latitude >> 12) & 0xff;
bytes[13] = (latitude >> 4) & 0xff;
bytes[14] = ((latitude & 0xf) << 4) | ((courseOverGround >> 8) & 0xf);
bytes[15] = courseOverGround & 0xff;
bytes[16] = ((m_settings.m_heading >> 1) & 0xff);
bytes[17] = ((m_settings.m_heading & 0x1) << 7) | ((timestamp & 0x3f) << 1);
bytes[18] = 0;
bytes[19] = 0;
bytes[20] = 0;
}
QByteArray ba((const char *)bytes, sizeof(bytes));
ui->message->setText(ba.toHex());
m_settings.m_data = ui->message->text();
applySettings();
AISMod::MsgEncode *msg = AISMod::MsgEncode::create();
m_aisMod->getInputMessageQueue()->push(msg);
}
void AISModGUI::on_repeat_toggled(bool checked)
@ -383,11 +288,11 @@ void AISModGUI::repeatSelect()
void AISModGUI::txSettingsSelect()
{
AISModTXSettingsDialog dialog(m_settings.m_rampUpBits, m_settings.m_rampDownBits,
m_settings.m_rampRange,
m_settings.m_baud,
m_settings.m_symbolSpan,
m_settings.m_rfNoise,
m_settings.m_writeToFile);
m_settings.m_rampRange,
m_settings.m_baud,
m_settings.m_symbolSpan,
m_settings.m_rfNoise,
m_settings.m_writeToFile);
if (dialog.exec() == QDialog::Accepted)
{
m_settings.m_rampUpBits = dialog.m_rampUpBits;
@ -577,9 +482,8 @@ AISModGUI::~AISModGUI()
void AISModGUI::transmit()
{
QString data = ui->message->text();
ui->transmittedText->appendPlainText(data + "\n");
AISMod::MsgTXAISMod *msg = AISMod::MsgTXAISMod::create(data);
ui->transmittedText->appendPlainText(m_settings.m_data);
AISMod::MsgTx *msg = AISMod::MsgTx::create();
m_aisMod->getInputMessageQueue()->push(msg);
}
@ -613,17 +517,6 @@ void AISModGUI::displaySettings()
blockApplySettings(true);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
if ((m_settings.m_rfBandwidth == 12500.0f) && (m_settings.m_bt == 0.3f))
ui->mode->setCurrentIndex(0);
else if ((m_settings.m_rfBandwidth == 25000.0f) && (m_settings.m_bt == 0.4f))
ui->mode->setCurrentIndex(1);
else
{
ui->mode->removeItem(2);
ui->mode->addItem(m_settings.getMode());
ui->mode->setCurrentIndex(2);
}
ui->rfBWText->setText(QString("%1k").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1));
ui->rfBW->setValue(m_settings.m_rfBandwidth / 100.0);
@ -643,9 +536,9 @@ void AISModGUI::displaySettings()
ui->channelMute->setChecked(m_settings.m_channelMute);
ui->repeat->setChecked(m_settings.m_repeat);
ui->msgId->setCurrentIndex(m_settings.m_msgId - 1);
ui->msgId->setCurrentIndex((int) m_settings.m_msgType);
ui->mmsi->setText(m_settings.m_mmsi);
ui->status->setCurrentIndex(m_settings.m_status);
ui->status->setCurrentIndex((int) m_settings.m_status);
ui->latitude->setValue(m_settings.m_latitude);
ui->longitude->setValue(m_settings.m_longitude);
ui->course->setValue(m_settings.m_course);

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<width>437</width>
<height>925</height>
</rect>
</property>
@ -42,7 +42,7 @@
<rect>
<x>2</x>
<y>2</y>
<width>341</width>
<width>431</width>
<height>271</height>
</rect>
</property>
@ -994,7 +994,7 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="txButton">
<widget class="QPushButton" name="txButton">
<property name="toolTip">
<string>Press to transmit the message</string>
</property>
@ -1012,7 +1012,7 @@
<rect>
<x>0</x>
<y>290</y>
<width>351</width>
<width>431</width>
<height>141</height>
</rect>
</property>
@ -1055,7 +1055,7 @@
<rect>
<x>0</x>
<y>450</y>
<width>351</width>
<width>431</width>
<height>331</height>
</rect>
</property>
@ -1104,7 +1104,7 @@
<rect>
<x>0</x>
<y>790</y>
<width>351</width>
<width>431</width>
<height>311</height>
</rect>
</property>

View File

@ -32,7 +32,7 @@ AISModSettings::AISModSettings()
void AISModSettings::resetToDefaults()
{
m_inputFrequencyOffset = 0;
m_baud = 9600;
m_baud = 9600; // nominal value
m_rfBandwidth = 25000.0f; // 12.5k for narrow, 25k for wide (narrow is obsolete)
m_fmDeviation = 4800.0f; // To give modulation index of 0.5 for 9600 baud
m_gain = -1.0f; // To avoid overflow, which results in out-of-band RF
@ -45,9 +45,9 @@ void AISModSettings::resetToDefaults()
m_rampRange = 60;
m_rfNoise = false;
m_writeToFile = false;
m_msgId = 1;
m_msgType = MsgTypeScheduledPositionReport;
m_mmsi = "0000000000";
m_status = 0;
m_status = StatusUnderWayUsingEngine;
m_latitude = 0.0f;
m_longitude = 0.0f;
m_course = 0.0f;
@ -91,11 +91,43 @@ bool AISModSettings::setMode(QString mode)
}
}
Real AISModSettings::getRfBandwidth(int modeIndex)
{
if (modeIndex == 0) { // Narrow
return 12500.0f;
} else { // Wide or other
return 25000.0f;
}
}
Real AISModSettings::getFMDeviation(int modeIndex)
{
if (modeIndex == 0) { // Narrow
return m_baud * 0.25;
} else { // Wide or other
return m_baud * 0.5;
}
}
float AISModSettings::getBT(int modeIndex)
{
if (modeIndex == 0) { // Narrow
return 0.3f;
} else { // Wide or other
return 0.4f;
}
}
QString AISModSettings::getMode() const
{
return QString("%1 %2 %3").arg(m_rfBandwidth).arg(m_fmDeviation).arg(m_bt);
}
int AISModSettings::getMsgId() const
{
return ((int) m_msgType) + 1;
}
QByteArray AISModSettings::serialize() const
{
SimpleSerializer s(1);
@ -114,9 +146,9 @@ QByteArray AISModSettings::serialize() const
s.writeS32(12, m_rampRange);
s.writeBool(14, m_rfNoise);
s.writeBool(15, m_writeToFile);
s.writeS32(17, m_msgId);
s.writeS32(17, (int) m_msgType);
s.writeString(18, m_mmsi);
s.writeS32(19, m_status);
s.writeS32(19, (int) m_status);
s.writeFloat(20, m_latitude);
s.writeFloat(21, m_longitude);
s.writeFloat(22, m_course);
@ -174,9 +206,11 @@ bool AISModSettings::deserialize(const QByteArray& data)
d.readS32(12, &m_rampRange, 8);
d.readBool(14, &m_rfNoise, false);
d.readBool(15, &m_writeToFile, false);
d.readS32(17, &m_msgId, 1);
d.readS32(17, &tmp, 0);
m_msgType = (MsgType) tmp;
d.readString(18, &m_mmsi, "0000000000");
d.readS32(19, &m_status, 0);
d.readS32(19, &tmp, 0);
m_status = (Status) tmp;
d.readFloat(20, &m_latitude, 0.0f);
d.readFloat(21, &m_longitude, 0.0f);
d.readFloat(22, &m_course, 0.0f);

View File

@ -27,6 +27,26 @@ class Serializable;
struct AISModSettings
{
enum Status {
StatusUnderWayUsingEngine,
StatusAtAnchor,
StatusNotUnderCommand,
StatusRestrictedManoeuverability,
StatusConstrainedByHerDraught,
StatusMoored,
StatusAground,
StatusEngagedInFishing,
StatusUnderWaySailing,
StatusNotDefined
};
enum MsgType {
MsgTypeScheduledPositionReport,
MsgTypeAssignedPositionReport,
MsgTypeSpecialPositionReport,
MsgBaseStationReport
};
static const int infinitePackets = -1;
qint64 m_inputFrequencyOffset;
@ -43,9 +63,9 @@ struct AISModSettings
int m_rampRange;
bool m_rfNoise;
bool m_writeToFile;
int m_msgId;
MsgType m_msgType;
QString m_mmsi;
int m_status;
Status m_status;
float m_latitude;
float m_longitude;
float m_course;
@ -78,6 +98,10 @@ struct AISModSettings
bool deserialize(const QByteArray& data);
bool setMode(QString mode);
QString getMode() const;
int getMsgId() const;
Real getRfBandwidth(int modeIndex);
Real getFMDeviation(int modeIndex);
float getBT(int modeIndex);
};
#endif /* PLUGINS_CHANNELTX_MODAIS_AISMODSETTINGS_H */

View File

@ -307,16 +307,25 @@ void AISModSource::calculateLevel(Real& sample)
void AISModSource::applySettings(const AISModSettings& settings, bool force)
{
if ((settings.m_bt != m_settings.m_bt) || (settings.m_symbolSpan != m_settings.m_symbolSpan) || (settings.m_baud != m_settings.m_baud) || force)
if ((settings.m_bt != m_settings.m_bt)
|| (settings.m_symbolSpan != m_settings.m_symbolSpan)
|| (settings.m_baud != m_settings.m_baud) || force)
{
qDebug() << "AISModSource::applySettings: Recreating pulse shaping filter: "
<< " SampleRate:" << AISModSettings::AISMOD_SAMPLE_RATE
<< " bt: " << settings.m_bt
<< " symbolSpan: " << settings.m_symbolSpan
<< " baud:" << settings.m_baud;
<< " baud:" << settings.m_baud
<< " data:" << settings.m_data;
m_pulseShape.create(settings.m_bt, settings.m_symbolSpan, AISModSettings::AISMOD_SAMPLE_RATE/settings.m_baud);
}
if ((settings.m_data != m_settings.m_data) || force)
{
qDebug() << "AISModSource::applySettings: new data: " << settings.m_data;
addTXPacket(settings.m_data);
}
m_settings = settings;
// Precalculate FM sensensity and linear gain to save doing it in the loop
@ -410,6 +419,7 @@ void AISModSource::initTX()
m_bitIdx = 0;
m_bitCount = m_bitCountTotal; // Reset to allow retransmission
m_nrziBit = 1;
if (m_settings.m_rampUpBits == 0)
{
m_state = tx;
@ -448,9 +458,12 @@ void AISModSource::addTXPacket(QByteArray data)
// Flag
*p++ = AIS_FLAG;
crc_start = p;
// Copy packet payload
for (int i = 0; i < data.size(); i++)
for (int i = 0; i < data.size(); i++) {
*p++ = data[i];
}
// CRC (do not include flags)
crc.calculate(crc_start, p-crc_start);
crcValue = crc.get();
@ -497,6 +510,10 @@ void AISModSource::encodePacket(uint8_t *packet, int packet_length, uint8_t *crc
}
//m_samplesPerSymbol = AISMOD_SAMPLE_RATE / m_settings.m_baud;
m_packetRepeatCount = m_settings.m_repeatCount;
}
void AISModSource::transmit()
{
initTX();
// Only reset phases at start of new packet TX, not in initTX(), so that
// there isn't a discontinuity in phase when repeatedly transmitting a

View File

@ -72,6 +72,7 @@ public:
void addTXPacket(QByteArray data);
void encodePacket(uint8_t *packet, int packet_length, uint8_t *crc_start, uint8_t *packet_end);
void setChannel(ChannelAPI *channel) { m_channel = channel; }
void transmit();
private:
int m_channelSampleRate;

View File

@ -920,6 +920,10 @@ margin-bottom: 20px;
};
defs.AISDemodSettings = {
"properties" : {
"baud" : {
"type" : "integer",
"description" : "baud rate (nominal is 9600)"
},
"inputFrequencyOffset" : {
"type" : "integer",
"format" : "int64"
@ -990,18 +994,15 @@ margin-bottom: 20px;
defs.AISModActions = {
"properties" : {
"tx" : {
"$ref" : "#/definitions/AISModActions_tx"
"type" : "integer",
"description" : "Transmit stored message\n * 0 - do nothing\n * 1 - transmit\n"
},
"encode" : {
"type" : "integer",
"description" : "Encode message from discrete data\n * 0 - do nothing\n * 1 - encode\n"
}
},
"description" : "AISMod"
};
defs.AISModActions_tx = {
"properties" : {
"data" : {
"type" : "string"
}
},
"description" : "Transmit a message\n"
};
defs.AISModReport = {
"properties" : {
@ -1061,9 +1062,6 @@ margin-bottom: 20px;
"rampRange" : {
"type" : "integer"
},
"lpfTaps" : {
"type" : "integer"
},
"rfNoise" : {
"type" : "integer",
"description" : "Boolean\n * 0 - off\n * 1 - on\n"
@ -1072,17 +1070,16 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Boolean\n * 0 - off\n * 1 - on\n"
},
"spectrumRate" : {
"type" : "integer"
},
"msgId" : {
"type" : "integer"
"msgType" : {
"type" : "integer",
"description" : "Message Type\n * 0 - Scheduled position report\n * 1 - Assigned position report\n * 2 - Special position report\n * 3 - Base station report\n"
},
"mmsi" : {
"type" : "string"
},
"status" : {
"type" : "integer"
"type" : "integer",
"description" : "Ship status\n * 0 - Under way using engine\n * 1 - At anchor\n * 2 - Not under command\n * 3 - Restricted manoeuvrability\n * 4 - Constrained by her draught\n * 4 - Moored\n * 5 - Aground\n * 6 - Engaged in fishing\n * 7 - Under way sailing\n * 8 - Not defined\n"
},
"latitude" : {
"type" : "number",
@ -51301,7 +51298,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-11-08T23:01:01.926+01:00
Generated 2021-11-11T23:23:22.877+01:00
</div>
</div>
</div>

View File

@ -1,6 +1,9 @@
AISDemodSettings:
description: AISDemod
properties:
baud:
type: integer
description: baud rate (nominal is 9600)
inputFrequencyOffset:
type: integer
format: int64

View File

@ -32,8 +32,6 @@ AISModSettings:
type: integer
rampRange:
type: integer
lpfTaps:
type: integer
rfNoise:
type: integer
description: >
@ -46,14 +44,30 @@ AISModSettings:
Boolean
* 0 - off
* 1 - on
spectrumRate:
type: integer
msgId:
msgType:
type: integer
description: >
Message Type
* 0 - Scheduled position report
* 1 - Assigned position report
* 2 - Special position report
* 3 - Base station report
mmsi:
type: string
status:
type: integer
description: >
Ship status
* 0 - Under way using engine
* 1 - At anchor
* 2 - Not under command
* 3 - Restricted manoeuvrability
* 4 - Constrained by her draught
* 4 - Moored
* 5 - Aground
* 6 - Engaged in fishing
* 7 - Under way sailing
* 8 - Not defined
latitude:
type: number
format: float
@ -117,9 +131,14 @@ AISModActions:
description: AISMod
properties:
tx:
type: object
properties:
data:
type: string
type: integer
description: >
Transmit a message
Transmit stored message
* 0 - do nothing
* 1 - transmit
encode:
type: integer
description: >
Encode message from discrete data
* 0 - do nothing
* 1 - encode

View File

@ -1,6 +1,9 @@
AISDemodSettings:
description: AISDemod
properties:
baud:
type: integer
description: baud rate (nominal is 9600)
inputFrequencyOffset:
type: integer
format: int64

View File

@ -32,8 +32,6 @@ AISModSettings:
type: integer
rampRange:
type: integer
lpfTaps:
type: integer
rfNoise:
type: integer
description: >
@ -46,14 +44,30 @@ AISModSettings:
Boolean
* 0 - off
* 1 - on
spectrumRate:
type: integer
msgId:
msgType:
type: integer
description: >
Message Type
* 0 - Scheduled position report
* 1 - Assigned position report
* 2 - Special position report
* 3 - Base station report
mmsi:
type: string
status:
type: integer
description: >
Ship status
* 0 - Under way using engine
* 1 - At anchor
* 2 - Not under command
* 3 - Restricted manoeuvrability
* 4 - Constrained by her draught
* 4 - Moored
* 5 - Aground
* 6 - Engaged in fishing
* 7 - Under way sailing
* 8 - Not defined
latitude:
type: number
format: float
@ -117,9 +131,14 @@ AISModActions:
description: AISMod
properties:
tx:
type: object
properties:
data:
type: string
type: integer
description: >
Transmit a message
Transmit stored message
* 0 - do nothing
* 1 - transmit
encode:
type: integer
description: >
Encode message from discrete data
* 0 - do nothing
* 1 - encode

View File

@ -920,6 +920,10 @@ margin-bottom: 20px;
};
defs.AISDemodSettings = {
"properties" : {
"baud" : {
"type" : "integer",
"description" : "baud rate (nominal is 9600)"
},
"inputFrequencyOffset" : {
"type" : "integer",
"format" : "int64"
@ -990,18 +994,15 @@ margin-bottom: 20px;
defs.AISModActions = {
"properties" : {
"tx" : {
"$ref" : "#/definitions/AISModActions_tx"
"type" : "integer",
"description" : "Transmit stored message\n * 0 - do nothing\n * 1 - transmit\n"
},
"encode" : {
"type" : "integer",
"description" : "Encode message from discrete data\n * 0 - do nothing\n * 1 - encode\n"
}
},
"description" : "AISMod"
};
defs.AISModActions_tx = {
"properties" : {
"data" : {
"type" : "string"
}
},
"description" : "Transmit a message\n"
};
defs.AISModReport = {
"properties" : {
@ -1061,9 +1062,6 @@ margin-bottom: 20px;
"rampRange" : {
"type" : "integer"
},
"lpfTaps" : {
"type" : "integer"
},
"rfNoise" : {
"type" : "integer",
"description" : "Boolean\n * 0 - off\n * 1 - on\n"
@ -1072,17 +1070,16 @@ margin-bottom: 20px;
"type" : "integer",
"description" : "Boolean\n * 0 - off\n * 1 - on\n"
},
"spectrumRate" : {
"type" : "integer"
},
"msgId" : {
"type" : "integer"
"msgType" : {
"type" : "integer",
"description" : "Message Type\n * 0 - Scheduled position report\n * 1 - Assigned position report\n * 2 - Special position report\n * 3 - Base station report\n"
},
"mmsi" : {
"type" : "string"
},
"status" : {
"type" : "integer"
"type" : "integer",
"description" : "Ship status\n * 0 - Under way using engine\n * 1 - At anchor\n * 2 - Not under command\n * 3 - Restricted manoeuvrability\n * 4 - Constrained by her draught\n * 4 - Moored\n * 5 - Aground\n * 6 - Engaged in fishing\n * 7 - Under way sailing\n * 8 - Not defined\n"
},
"latitude" : {
"type" : "number",
@ -51301,7 +51298,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-11-08T23:01:01.926+01:00
Generated 2021-11-11T23:23:22.877+01:00
</div>
</div>
</div>

View File

@ -28,6 +28,8 @@ SWGAISDemodSettings::SWGAISDemodSettings(QString* json) {
}
SWGAISDemodSettings::SWGAISDemodSettings() {
baud = 0;
m_baud_isSet = false;
input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f;
@ -72,6 +74,8 @@ SWGAISDemodSettings::~SWGAISDemodSettings() {
void
SWGAISDemodSettings::init() {
baud = 0;
m_baud_isSet = false;
input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f;
@ -117,6 +121,7 @@ SWGAISDemodSettings::cleanup() {
if(udp_address != nullptr) {
delete udp_address;
}
@ -151,6 +156,8 @@ SWGAISDemodSettings::fromJson(QString &json) {
void
SWGAISDemodSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&baud, pJson["baud"], "qint32", "");
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
@ -203,6 +210,9 @@ SWGAISDemodSettings::asJson ()
QJsonObject*
SWGAISDemodSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_baud_isSet){
obj->insert("baud", QJsonValue(baud));
}
if(m_input_frequency_offset_isSet){
obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
}
@ -261,6 +271,16 @@ SWGAISDemodSettings::asJsonObject() {
return obj;
}
qint32
SWGAISDemodSettings::getBaud() {
return baud;
}
void
SWGAISDemodSettings::setBaud(qint32 baud) {
this->baud = baud;
this->m_baud_isSet = true;
}
qint64
SWGAISDemodSettings::getInputFrequencyOffset() {
return input_frequency_offset;
@ -446,6 +466,9 @@ bool
SWGAISDemodSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_baud_isSet){
isObjectUpdated = true; break;
}
if(m_input_frequency_offset_isSet){
isObjectUpdated = true; break;
}

View File

@ -42,6 +42,9 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGAISDemodSettings* fromJson(QString &jsonString) override;
qint32 getBaud();
void setBaud(qint32 baud);
qint64 getInputFrequencyOffset();
void setInputFrequencyOffset(qint64 input_frequency_offset);
@ -100,6 +103,9 @@ public:
virtual bool isSet() override;
private:
qint32 baud;
bool m_baud_isSet;
qint64 input_frequency_offset;
bool m_input_frequency_offset_isSet;

View File

@ -28,8 +28,10 @@ SWGAISModActions::SWGAISModActions(QString* json) {
}
SWGAISModActions::SWGAISModActions() {
tx = nullptr;
tx = 0;
m_tx_isSet = false;
encode = 0;
m_encode_isSet = false;
}
SWGAISModActions::~SWGAISModActions() {
@ -38,15 +40,16 @@ SWGAISModActions::~SWGAISModActions() {
void
SWGAISModActions::init() {
tx = new SWGAISModActions_tx();
tx = 0;
m_tx_isSet = false;
encode = 0;
m_encode_isSet = false;
}
void
SWGAISModActions::cleanup() {
if(tx != nullptr) {
delete tx;
}
}
SWGAISModActions*
@ -60,7 +63,9 @@ SWGAISModActions::fromJson(QString &json) {
void
SWGAISModActions::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&tx, pJson["tx"], "SWGAISModActions_tx", "SWGAISModActions_tx");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
::SWGSDRangel::setValue(&encode, pJson["encode"], "qint32", "");
}
@ -78,29 +83,45 @@ SWGAISModActions::asJson ()
QJsonObject*
SWGAISModActions::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if((tx != nullptr) && (tx->isSet())){
toJsonValue(QString("tx"), tx, obj, QString("SWGAISModActions_tx"));
if(m_tx_isSet){
obj->insert("tx", QJsonValue(tx));
}
if(m_encode_isSet){
obj->insert("encode", QJsonValue(encode));
}
return obj;
}
SWGAISModActions_tx*
qint32
SWGAISModActions::getTx() {
return tx;
}
void
SWGAISModActions::setTx(SWGAISModActions_tx* tx) {
SWGAISModActions::setTx(qint32 tx) {
this->tx = tx;
this->m_tx_isSet = true;
}
qint32
SWGAISModActions::getEncode() {
return encode;
}
void
SWGAISModActions::setEncode(qint32 encode) {
this->encode = encode;
this->m_encode_isSet = true;
}
bool
SWGAISModActions::isSet(){
bool isObjectUpdated = false;
do{
if(tx && tx->isSet()){
if(m_tx_isSet){
isObjectUpdated = true; break;
}
if(m_encode_isSet){
isObjectUpdated = true; break;
}
}while(false);

View File

@ -22,7 +22,6 @@
#include <QJsonObject>
#include "SWGAISModActions_tx.h"
#include "SWGObject.h"
#include "export.h"
@ -42,16 +41,22 @@ public:
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGAISModActions* fromJson(QString &jsonString) override;
SWGAISModActions_tx* getTx();
void setTx(SWGAISModActions_tx* tx);
qint32 getTx();
void setTx(qint32 tx);
qint32 getEncode();
void setEncode(qint32 encode);
virtual bool isSet() override;
private:
SWGAISModActions_tx* tx;
qint32 tx;
bool m_tx_isSet;
qint32 encode;
bool m_encode_isSet;
};
}

View File

@ -52,16 +52,12 @@ SWGAISModSettings::SWGAISModSettings() {
m_ramp_down_bits_isSet = false;
ramp_range = 0;
m_ramp_range_isSet = false;
lpf_taps = 0;
m_lpf_taps_isSet = false;
rf_noise = 0;
m_rf_noise_isSet = false;
write_to_file = 0;
m_write_to_file_isSet = false;
spectrum_rate = 0;
m_spectrum_rate_isSet = false;
msg_id = 0;
m_msg_id_isSet = false;
msg_type = 0;
m_msg_type_isSet = false;
mmsi = nullptr;
m_mmsi_isSet = false;
status = 0;
@ -136,16 +132,12 @@ SWGAISModSettings::init() {
m_ramp_down_bits_isSet = false;
ramp_range = 0;
m_ramp_range_isSet = false;
lpf_taps = 0;
m_lpf_taps_isSet = false;
rf_noise = 0;
m_rf_noise_isSet = false;
write_to_file = 0;
m_write_to_file_isSet = false;
spectrum_rate = 0;
m_spectrum_rate_isSet = false;
msg_id = 0;
m_msg_id_isSet = false;
msg_type = 0;
m_msg_type_isSet = false;
mmsi = new QString("");
m_mmsi_isSet = false;
status = 0;
@ -207,8 +199,6 @@ SWGAISModSettings::cleanup() {
if(mmsi != nullptr) {
delete mmsi;
}
@ -277,15 +267,11 @@ SWGAISModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&ramp_range, pJson["rampRange"], "qint32", "");
::SWGSDRangel::setValue(&lpf_taps, pJson["lpfTaps"], "qint32", "");
::SWGSDRangel::setValue(&rf_noise, pJson["rfNoise"], "qint32", "");
::SWGSDRangel::setValue(&write_to_file, pJson["writeToFile"], "qint32", "");
::SWGSDRangel::setValue(&spectrum_rate, pJson["spectrumRate"], "qint32", "");
::SWGSDRangel::setValue(&msg_id, pJson["msgId"], "qint32", "");
::SWGSDRangel::setValue(&msg_type, pJson["msgType"], "qint32", "");
::SWGSDRangel::setValue(&mmsi, pJson["mmsi"], "QString", "QString");
@ -381,20 +367,14 @@ SWGAISModSettings::asJsonObject() {
if(m_ramp_range_isSet){
obj->insert("rampRange", QJsonValue(ramp_range));
}
if(m_lpf_taps_isSet){
obj->insert("lpfTaps", QJsonValue(lpf_taps));
}
if(m_rf_noise_isSet){
obj->insert("rfNoise", QJsonValue(rf_noise));
}
if(m_write_to_file_isSet){
obj->insert("writeToFile", QJsonValue(write_to_file));
}
if(m_spectrum_rate_isSet){
obj->insert("spectrumRate", QJsonValue(spectrum_rate));
}
if(m_msg_id_isSet){
obj->insert("msgId", QJsonValue(msg_id));
if(m_msg_type_isSet){
obj->insert("msgType", QJsonValue(msg_type));
}
if(mmsi != nullptr && *mmsi != QString("")){
toJsonValue(QString("mmsi"), mmsi, obj, QString("QString"));
@ -583,16 +563,6 @@ SWGAISModSettings::setRampRange(qint32 ramp_range) {
this->m_ramp_range_isSet = true;
}
qint32
SWGAISModSettings::getLpfTaps() {
return lpf_taps;
}
void
SWGAISModSettings::setLpfTaps(qint32 lpf_taps) {
this->lpf_taps = lpf_taps;
this->m_lpf_taps_isSet = true;
}
qint32
SWGAISModSettings::getRfNoise() {
return rf_noise;
@ -614,23 +584,13 @@ SWGAISModSettings::setWriteToFile(qint32 write_to_file) {
}
qint32
SWGAISModSettings::getSpectrumRate() {
return spectrum_rate;
SWGAISModSettings::getMsgType() {
return msg_type;
}
void
SWGAISModSettings::setSpectrumRate(qint32 spectrum_rate) {
this->spectrum_rate = spectrum_rate;
this->m_spectrum_rate_isSet = true;
}
qint32
SWGAISModSettings::getMsgId() {
return msg_id;
}
void
SWGAISModSettings::setMsgId(qint32 msg_id) {
this->msg_id = msg_id;
this->m_msg_id_isSet = true;
SWGAISModSettings::setMsgType(qint32 msg_type) {
this->msg_type = msg_type;
this->m_msg_type_isSet = true;
}
QString*
@ -884,19 +844,13 @@ SWGAISModSettings::isSet(){
if(m_ramp_range_isSet){
isObjectUpdated = true; break;
}
if(m_lpf_taps_isSet){
isObjectUpdated = true; break;
}
if(m_rf_noise_isSet){
isObjectUpdated = true; break;
}
if(m_write_to_file_isSet){
isObjectUpdated = true; break;
}
if(m_spectrum_rate_isSet){
isObjectUpdated = true; break;
}
if(m_msg_id_isSet){
if(m_msg_type_isSet){
isObjectUpdated = true; break;
}
if(mmsi && *mmsi != QString("")){

View File

@ -78,20 +78,14 @@ public:
qint32 getRampRange();
void setRampRange(qint32 ramp_range);
qint32 getLpfTaps();
void setLpfTaps(qint32 lpf_taps);
qint32 getRfNoise();
void setRfNoise(qint32 rf_noise);
qint32 getWriteToFile();
void setWriteToFile(qint32 write_to_file);
qint32 getSpectrumRate();
void setSpectrumRate(qint32 spectrum_rate);
qint32 getMsgId();
void setMsgId(qint32 msg_id);
qint32 getMsgType();
void setMsgType(qint32 msg_type);
QString* getMmsi();
void setMmsi(QString* mmsi);
@ -196,20 +190,14 @@ private:
qint32 ramp_range;
bool m_ramp_range_isSet;
qint32 lpf_taps;
bool m_lpf_taps_isSet;
qint32 rf_noise;
bool m_rf_noise_isSet;
qint32 write_to_file;
bool m_write_to_file_isSet;
qint32 spectrum_rate;
bool m_spectrum_rate_isSet;
qint32 msg_id;
bool m_msg_id_isSet;
qint32 msg_type;
bool m_msg_type_isSet;
QString* mmsi;
bool m_mmsi_isSet;

View File

@ -22,7 +22,6 @@
#include "SWGAISDemodReport.h"
#include "SWGAISDemodSettings.h"
#include "SWGAISModActions.h"
#include "SWGAISModActions_tx.h"
#include "SWGAISModReport.h"
#include "SWGAISModSettings.h"
#include "SWGAISSettings.h"
@ -350,11 +349,6 @@ namespace SWGSDRangel {
obj->init();
return obj;
}
if(QString("SWGAISModActions_tx").compare(type) == 0) {
SWGAISModActions_tx *obj = new SWGAISModActions_tx();
obj->init();
return obj;
}
if(QString("SWGAISModReport").compare(type) == 0) {
SWGAISModReport *obj = new SWGAISModReport();
obj->init();