1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

KiwiSDR: implemented file record name

This commit is contained in:
f4exb 2019-06-09 01:44:04 +02:00
parent dc15668469
commit 2cefa0ed69
9 changed files with 94 additions and 3 deletions

View File

@ -214,7 +214,12 @@ bool KiwiSDRInput::handleMessage(const Message& message)
if (conf.getStartStop())
{
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
if (m_settings.m_fileRecordName.size() != 0) {
m_fileSink->setFileName(m_settings.m_fileRecordName);
} else {
m_fileSink->genUniqueFileName(m_deviceAPI->getDeviceUID());
}
m_fileSink->startRecording();
}
else
@ -264,10 +269,32 @@ int KiwiSDRInput::getStatus() const
bool KiwiSDRInput::applySettings(const KiwiSDRSettings& settings, bool force)
{
qDebug() << "KiwiSDRInput::applySettings: "
<< " m_serverAddress: " << settings.m_serverAddress
<< " m_centerFrequency: " << settings.m_centerFrequency
<< " m_gain: " << settings.m_gain
<< " m_useAGC: " << settings.m_useAGC
<< " m_fileRecordName: " << settings.m_fileRecordName
<< " m_useAGC: " << settings.m_useAGC
<< " m_useReverseAPI: " << settings.m_useReverseAPI
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort
<< " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex;
QList<QString> reverseAPIKeys;
if (m_settings.m_serverAddress != settings.m_serverAddress || force)
{
reverseAPIKeys.append("serverAddress");
emit setWorkerServerAddress(settings.m_serverAddress);
}
if (m_settings.m_gain != settings.m_gain || force) {
reverseAPIKeys.append("gain");
}
if (m_settings.m_useAGC != settings.m_useAGC || force) {
reverseAPIKeys.append("useAGC");
}
if (m_settings.m_gain != settings.m_gain ||
m_settings.m_useAGC != settings.m_useAGC || force)
@ -361,6 +388,9 @@ int KiwiSDRInput::webapiSettingsPutPatch(
if (deviceSettingsKeys.contains("serverAddress")) {
settings.m_serverAddress = *response.getKiwiSdrSettings()->getServerAddress();
}
if (deviceSettingsKeys.contains("fileRecordName")) {
settings.m_fileRecordName = *response.getKiwiSdrSettings()->getFileRecordName();
}
if (deviceSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getKiwiSdrSettings()->getUseReverseApi() != 0;
}
@ -409,6 +439,23 @@ void KiwiSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
} else {
response.getKiwiSdrSettings()->setServerAddress(new QString(settings.m_serverAddress));
}
if (response.getKiwiSdrSettings()->getFileRecordName()) {
*response.getKiwiSdrSettings()->getFileRecordName() = settings.m_fileRecordName;
} else {
response.getKiwiSdrSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
}
response.getKiwiSdrSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getKiwiSdrSettings()->getReverseApiAddress()) {
*response.getKiwiSdrSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
} else {
response.getKiwiSdrSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
}
response.getKiwiSdrSettings()->setReverseApiPort(settings.m_reverseAPIPort);
response.getKiwiSdrSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
}
void KiwiSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
@ -439,6 +486,9 @@ void KiwiSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
if (deviceSettingsKeys.contains("serverAddress") || force) {
swgKiwiSDRSettings->setServerAddress(new QString(settings.m_serverAddress));
}
if (deviceSettingsKeys.contains("fileRecordName") || force) {
swgKiwiSDRSettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
.arg(settings.m_reverseAPIAddress)

View File

@ -33,6 +33,7 @@ void KiwiSDRSettings::resetToDefaults()
m_serverAddress = "127.0.0.1:8073";
m_fileRecordName = "";
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;

View File

@ -28,6 +28,7 @@ struct KiwiSDRSettings {
quint64 m_centerFrequency;
QString m_serverAddress;
QString m_fileRecordName;
bool m_useReverseAPI;
QString m_reverseAPIAddress;

View File

@ -3106,6 +3106,9 @@ margin-bottom: 20px;
"type" : "string",
"description" : "Distant KiwiSDR instance URL or IPv4 address with port"
},
"fileRecordName" : {
"type" : "string"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
@ -25148,7 +25151,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-06-08T23:46:41.204+02:00
Generated 2019-06-09T01:28:52.118+02:00
</div>
</div>
</div>

View File

@ -12,6 +12,8 @@ KiwiSDRSettings:
serverAddress:
description: Distant KiwiSDR instance URL or IPv4 address with port
type: string
fileRecordName:
type: string
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer

View File

@ -12,6 +12,8 @@ KiwiSDRSettings:
serverAddress:
description: Distant KiwiSDR instance URL or IPv4 address with port
type: string
fileRecordName:
type: string
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer

View File

@ -3106,6 +3106,9 @@ margin-bottom: 20px;
"type" : "string",
"description" : "Distant KiwiSDR instance URL or IPv4 address with port"
},
"fileRecordName" : {
"type" : "string"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
@ -25148,7 +25151,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-06-08T23:46:41.204+02:00
Generated 2019-06-09T01:28:52.118+02:00
</div>
</div>
</div>

View File

@ -36,6 +36,8 @@ SWGKiwiSDRSettings::SWGKiwiSDRSettings() {
m_center_frequency_isSet = false;
server_address = nullptr;
m_server_address_isSet = false;
file_record_name = nullptr;
m_file_record_name_isSet = false;
use_reverse_api = 0;
m_use_reverse_api_isSet = false;
reverse_api_address = nullptr;
@ -60,6 +62,8 @@ SWGKiwiSDRSettings::init() {
m_center_frequency_isSet = false;
server_address = new QString("");
m_server_address_isSet = false;
file_record_name = new QString("");
m_file_record_name_isSet = false;
use_reverse_api = 0;
m_use_reverse_api_isSet = false;
reverse_api_address = new QString("");
@ -78,6 +82,9 @@ SWGKiwiSDRSettings::cleanup() {
if(server_address != nullptr) {
delete server_address;
}
if(file_record_name != nullptr) {
delete file_record_name;
}
if(reverse_api_address != nullptr) {
delete reverse_api_address;
@ -105,6 +112,8 @@ SWGKiwiSDRSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&server_address, pJson["serverAddress"], "QString", "QString");
::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString");
::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
@ -141,6 +150,9 @@ SWGKiwiSDRSettings::asJsonObject() {
if(server_address != nullptr && *server_address != QString("")){
toJsonValue(QString("serverAddress"), server_address, obj, QString("QString"));
}
if(file_record_name != nullptr && *file_record_name != QString("")){
toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString"));
}
if(m_use_reverse_api_isSet){
obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
}
@ -197,6 +209,16 @@ SWGKiwiSDRSettings::setServerAddress(QString* server_address) {
this->m_server_address_isSet = true;
}
QString*
SWGKiwiSDRSettings::getFileRecordName() {
return file_record_name;
}
void
SWGKiwiSDRSettings::setFileRecordName(QString* file_record_name) {
this->file_record_name = file_record_name;
this->m_file_record_name_isSet = true;
}
qint32
SWGKiwiSDRSettings::getUseReverseApi() {
return use_reverse_api;
@ -246,6 +268,7 @@ SWGKiwiSDRSettings::isSet(){
if(m_use_agc_isSet){ isObjectUpdated = true; break;}
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(server_address != nullptr && *server_address != QString("")){ isObjectUpdated = true; break;}
if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}

View File

@ -54,6 +54,9 @@ public:
QString* getServerAddress();
void setServerAddress(QString* server_address);
QString* getFileRecordName();
void setFileRecordName(QString* file_record_name);
qint32 getUseReverseApi();
void setUseReverseApi(qint32 use_reverse_api);
@ -82,6 +85,9 @@ private:
QString* server_address;
bool m_server_address_isSet;
QString* file_record_name;
bool m_file_record_name_isSet;
qint32 use_reverse_api;
bool m_use_reverse_api_isSet;