MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / applyTileRangeUpdates

Function applyTileRangeUpdates

app/src/AI/ToolDispatcher.cpp:1633–1665  ·  view source on GitHub ↗

* @brief Patches dataset min/max ranges from the optional `ranges` request payload. */

Source from the content-addressed store, hash-verified

1631 * @brief Patches dataset min/max ranges from the optional `ranges` request payload.
1632 */
1633static QJsonObject applyTileRangeUpdates(const QJsonObject& args,
1634 const QJsonObject& dataset,
1635 int groupId,
1636 QJsonArray& steps)
1637{
1638 const auto ranges = args.value(QStringLiteral("ranges")).toObject();
1639 if (ranges.isEmpty() || dataset.isEmpty())
1640 return {};
1641
1642 static const QStringList kRangeFields = {QStringLiteral("pltMin"),
1643 QStringLiteral("pltMax"),
1644 QStringLiteral("wgtMin"),
1645 QStringLiteral("wgtMax"),
1646 QStringLiteral("fftMin"),
1647 QStringLiteral("fftMax")};
1648 QJsonObject updateArgs;
1649 updateArgs[QStringLiteral("groupId")] = dataset.value(QStringLiteral("groupId")).toInt(groupId);
1650 updateArgs[Keys::DatasetId] = dataset.value(Keys::DatasetId).toInt();
1651 for (const auto& field : kRangeFields)
1652 if (ranges.contains(field))
1653 updateArgs[field] = ranges.value(field);
1654
1655 if (updateArgs.size() <= 2)
1656 return {};
1657
1658 const auto updateReply = runCommand(QStringLiteral("project.dataset.update"), updateArgs);
1659 steps.append(QJsonObject{
1660 { QStringLiteral("command"), QStringLiteral("project.dataset.update")},
1661 { QStringLiteral("ok"), updateReply.value(QStringLiteral("ok")).toBool()},
1662 {QStringLiteral("arguments"), updateArgs}
1663 });
1664 return updateReply;
1665}
1666
1667/**
1668 * @brief Enables customize mode so subsequent workspace mutations are accepted.

Callers 1

executeAddTileFunction · 0.85

Calls 6

runCommandFunction · 0.85
isEmptyMethod · 0.80
valueMethod · 0.45
containsMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected