Skip to content

Commit

Permalink
Revert "Try QSL instead of QL1S"
Browse files Browse the repository at this point in the history
This reverts commit 379839f.

Just slowly undoing some of the experiments.
  • Loading branch information
pcolby committed Nov 20, 2023
1 parent 95bbeb3 commit d21f367
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
32 changes: 16 additions & 16 deletions src/cli/abstractcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ QStringList AbstractCommand::requiredOptions(const QCommandLineParser &parser) c
QStringList AbstractCommand::supportedOptions(const QCommandLineParser &parser) const
{
return requiredOptions(parser) + QStringList{
QStringLiteral("debug"),
QStringLiteral("device"), QStringLiteral("d"),
QStringLiteral("output"),
QStringLiteral("timeout"),
QLatin1String("debug"),
QLatin1String("device"), QLatin1String("d"),
QLatin1String("output"),
QLatin1String("timeout"),
};
}

Expand All @@ -108,7 +108,7 @@ QString AbstractCommand::escapeCsvField(const QString &field)
field.contains(QLatin1Char('"'))||field.contains(QLatin1Char('\n')))
{
return QString::fromLatin1(R"("%1")").arg(
QString(field).replace(QLatin1Char('"'), QStringLiteral(R"("")")));
QString(field).replace(QLatin1Char('"'), QLatin1String(R"("")")));
} else return field;
}

Expand Down Expand Up @@ -275,31 +275,31 @@ QStringList AbstractCommand::processOptions(const QCommandLineParser &parser)
QStringList errors;

// Parse the device (name/addr/uuid) option.
if (parser.isSet(QStringLiteral("device"))) {
deviceToScanFor = parser.value(QStringLiteral("device"));
if (parser.isSet(QLatin1String("device"))) {
deviceToScanFor = parser.value(QLatin1String("device"));
}

// Parse the output format options (if supported, and supplied).
if ((supportedOptionNames.contains(QStringLiteral("output"))) && // Derived classes may have removed.
(parser.isSet(QStringLiteral("output"))))
if ((supportedOptionNames.contains(QLatin1String("output"))) && // Derived classes may have removed.
(parser.isSet(QLatin1String("output"))))
{
const QString output = parser.value(QStringLiteral("output")).toLower();
if (output == QStringLiteral("csv")) {
const QString output = parser.value(QLatin1String("output")).toLower();
if (output == QLatin1String("csv")) {
format = OutputFormat::Csv;
} else if (output == QStringLiteral("json")) {
} else if (output == QLatin1String("json")) {
format = OutputFormat::Json;
} else if (output == QStringLiteral("text")) {
} else if (output == QLatin1String("text")) {
format = OutputFormat::Text;
} else {
errors.append(tr("Unknown output format: %1").arg(output));
}
}

// Parse the device scan timeout option.
if (parser.isSet(QStringLiteral("timeout"))) {
const quint32 timeout = parseNumber<std::milli>(parser.value(QStringLiteral("timeout")), QStringLiteral("s"), 500);
if (parser.isSet(QLatin1String("timeout"))) {
const quint32 timeout = parseNumber<std::milli>(parser.value(QLatin1String("timeout")), QLatin1String("s"), 500);
if (timeout == 0) {
errors.append(tr("Invalid timeout: %1").arg(parser.value(QStringLiteral("timeout"))));
errors.append(tr("Invalid timeout: %1").arg(parser.value(QLatin1String("timeout"))));
} else if (discoveryAgent->lowEnergyDiscoveryTimeout() == -1) {
qCWarning(lc).noquote() << tr("Platform does not support Bluetooth scan timeout");
} else {
Expand Down
18 changes: 9 additions & 9 deletions src/cli/infocommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,23 @@ void InfoCommand::serviceDetailsDiscovered()
break;
case OutputFormat::Json: {
QJsonObject jsonObject{
{ QStringLiteral("manufacturerName"), service->manufacturer() },
{ QStringLiteral("modelNumber"), service->modelNumber() },
{ QStringLiteral("hardwareRevision"), service->hardwareRevision() },
{ QStringLiteral("firmwareRevision"), service->firmwareRevision() },
{ QStringLiteral("softwareRevision"), service->softwareRevision() },
{ QLatin1String("manufacturerName"), service->manufacturer() },
{ QLatin1String("modelNumber"), service->modelNumber() },
{ QLatin1String("hardwareRevision"), service->hardwareRevision() },
{ QLatin1String("firmwareRevision"), service->firmwareRevision() },
{ QLatin1String("softwareRevision"), service->softwareRevision() },
};
if (!deviceName.isEmpty()) {
jsonObject.insert(QStringLiteral("deviceName"), deviceName);
jsonObject.insert(QLatin1String("deviceName"), deviceName);
}
if (!deviceAddress.isNull()) {
jsonObject.insert(QStringLiteral("deviceAddress"), deviceAddress.toString());
jsonObject.insert(QLatin1String("deviceAddress"), deviceAddress.toString());
}
if (!deviceUuid.isNull()) {
jsonObject.insert(QStringLiteral("deviceUuid"), deviceUuid.toString());
jsonObject.insert(QLatin1String("deviceUuid"), deviceUuid.toString());
}
if (!serialNumber.isNull()) {
jsonObject.insert(QStringLiteral("serialNumber"), serialNumber);
jsonObject.insert(QLatin1String("serialNumber"), serialNumber);
}
std::cout << QJsonDocument(jsonObject).toJson().toStdString();
} break;
Expand Down

0 comments on commit d21f367

Please sign in to comment.