Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #551

Merged
merged 8 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '/opt/vcpkg'
vcpkgGitCommitId: 'a34c873a9717a888f58dc05268dea15592c2f0ff'
vcpkgGitCommitId: '66a252f70eebdd744c02d7ab8c1cc6fe123c70ee'
vcpkgJsonGlob: 'vcpkg.json'

- name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '/opt/vcpkg'
vcpkgGitCommitId: 'a34c873a9717a888f58dc05268dea15592c2f0ff'
vcpkgGitCommitId: '66a252f70eebdd744c02d7ab8c1cc6fe123c70ee'
vcpkgJsonGlob: 'vcpkg.json'

- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: '/opt/vcpkg'
vcpkgGitCommitId: 'a34c873a9717a888f58dc05268dea15592c2f0ff'
vcpkgGitCommitId: '66a252f70eebdd744c02d7ab8c1cc6fe123c70ee'
vcpkgJsonGlob: 'vcpkg.json'

- name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg.
Expand Down
8 changes: 4 additions & 4 deletions examples/test_rig/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ struct glz::meta<config_struct> {
"servo_cycle",
&config_struct::servo_cycle,
tfc::json::schema{ .description = "Duration between moving the servo",
.default_value = 1000,
.minimum = 20,
.maximum = 5000 },
.defaultValue = 1000UL,
.minimum = 20UL,
.maximum = 5000UL },
"count",
&config_struct::count,
tfc::json::schema{ .description = "Servo wink count", .default_value = 10, .minimum = 1, .maximum = 180 }) };
tfc::json::schema{ .description = "Servo wink count", .defaultValue = 10UL, .minimum = 1UL, .maximum = 180UL }) };
};

struct app {
Expand Down
15 changes: 8 additions & 7 deletions exes/ethercat/inc/public/tfc/ec/config/bus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ struct network_interface {
} // namespace tfc::ec::config

template <>
struct tfc::json::detail::to_json_schema<tfc::ec::config::network_interface> {
struct glz::detail::to_json_schema<tfc::ec::config::network_interface> {
template <auto Opts>
static void op(auto& s, auto&) noexcept {
s.oneOf = std::vector<tfc::json::detail::schematic>{};

for (auto const& interface : ec::common::get_interfaces()) {
s.oneOf->emplace_back(tfc::json::detail::schematic{
.attributes{ tfc::json::schema{ .title = interface, .description = interface, .constant = interface } } });
}
s.oneOf = std::vector<glz::detail::schematic>{};
// fix in https://github.com/Skaginn3x/framework/issues/555
// attributes was added initially
// for (auto const& interface : tfc::ec::common::get_interfaces()) {
// s.oneOf->emplace_back(glz::detail::schematic{
// .attributes{ tfc::json::schema{ .title = interface, .description = interface, .constant = interface } } });
// }
}
};

Expand Down
10 changes: 5 additions & 5 deletions exes/ethercat/inc/public/tfc/ec/devices/eilersen/4x60a.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct meta<e4x60a::calibration_zero_t> {
static constexpr std::string_view name{ "4x60a::calibration_zero" };
// clang-format off
static constexpr auto value{ glz::object(
"signal_read", &type::read, tfc::json::schema{ .description = "The read value of the calibration zero", .read_only = true },
"signal_read", &type::read, tfc::json::schema{ .description = "The read value of the calibration zero", .readOnly = true },
"do_calibrate_zero", &type::do_calibrate, "Set to true to calibrate the zero"
) };
// clang-format on
Expand All @@ -189,8 +189,8 @@ struct meta<e4x60a::calibration_weight_t> {
static constexpr std::string_view name{ "4x60a::calibration_weight" };
// clang-format off
static constexpr auto value{ glz::object(
"signal_read", &type::read, tfc::json::schema{ .description="The actual value signal from load cell/cells of the calibration weight", .read_only = true },
"weight", &type::weight, tfc::json::schema{ .description = "Calibration weight", .default_value = 1UL },
"signal_read", &type::read, tfc::json::schema{ .description="The actual value signal from load cell/cells of the calibration weight", .readOnly = true },
"weight", &type::weight, tfc::json::schema{ .description = "Calibration weight", .defaultValue = 1UL },
"do_calibrate_with_load", &type::do_calibrate, "Set to true to calibrate the weight"
) };
// clang-format on
Expand All @@ -215,7 +215,7 @@ struct meta<e4x60a::calibration<mode>> {
"cell/cells", &type::this_cells, "The cells to use for this calibration.",
"group_name", &type::group_name, tfc::json::schema{
.description= "The name of this calibration group, used for naming IPC signal. Requires restart of the process.",
.min_length = 3, .max_length = 30, .pattern = "^[a-zA-Z0-9_]+$" }
.minLength = 3, .maxLength = 30, .pattern = "^[a-zA-Z0-9_]+$" }
) };
// clang-format on
};
Expand All @@ -239,7 +239,7 @@ struct meta<e4x60a::calibration_sealed_config> {
static constexpr std::string_view name{ "Sealed Calibration Config" };
static constexpr auto value{ glz::object("calibration",
&type::calibration_v,
tfc::json::schema{ .read_only = true },
tfc::json::schema{ .readOnly = true },
"sealed",
&type::sealed,
tfc::json::schema{ .constant = true }) };
Expand Down
11 changes: 5 additions & 6 deletions exes/ethercat/inc/public/tfc/ec/devices/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@ struct glz::meta<tfc::ec::util::setting<idx, name_value, desc, value_t, value_t_
static constexpr std::string_view name_suffix = name_value;
static constexpr std::string_view name = tfc::stx::string_view_join_v<name_prefix, name_suffix>;
};
namespace tfc::json::detail {

template <ecx::index_t idx,
tfc::stx::basic_fixed_string name_value,
tfc::stx::basic_fixed_string desc,
typename value_t,
auto... value_t_construct_params>
struct to_json_schema<tfc::ec::util::setting<idx, name_value, desc, value_t, value_t_construct_params...>> {
struct glz::detail::to_json_schema<tfc::ec::util::setting<idx, name_value, desc, value_t, value_t_construct_params...>> {
using setting = tfc::ec::util::setting<idx, name_value, desc, value_t, value_t_construct_params...>;
static constexpr auto name_view{ name_value.view() };
static constexpr auto description{ tfc::stx::string_view_join_v< //
Expand All @@ -107,10 +106,10 @@ struct to_json_schema<tfc::ec::util::setting<idx, name_value, desc, value_t, val
> };
template <auto opts>
static void op(auto& schema, auto& defs) {
schema.attributes.title = desc;
schema.attributes.description = description;
// fix in https://github.com/Skaginn3x/framework/issues/555
// attributes was added initially
// schema.attributes.title = desc;
// schema.attributes.description = description;
to_json_schema<value_t>::template op<opts>(schema, defs);
}
};

} // namespace tfc::json::detail
12 changes: 7 additions & 5 deletions exes/mqtt-bridge/inc/config/bridge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@ struct glz::meta<tfc::mqtt::structs::ssl_active_e> {
};

template <>
struct tfc::json::detail::to_json_schema<tfc::mqtt::config::signal_name> {
struct glz::detail::to_json_schema<tfc::mqtt::config::signal_name> {
template <auto Opts>
static void op(auto& s, auto&) noexcept {
if (!s.oneOf.has_value()) {
s.oneOf = std::vector<schematic>{};
}
for (auto const& signal : global::get_signals()) {
s.oneOf.value().push_back(schematic{
.attributes{ schema{ .title = signal.name, .description = signal.description, .constant = signal.name } } });
}
// fix in https://github.com/Skaginn3x/framework/issues/555
// attributes was added initially
// for (auto const& signal : tfc::global::get_signals()) {
// s.oneOf.value().push_back(schematic{
// .attributes{ schema{ .title = signal.name, .description = signal.description, .constant = signal.name } } });
// }
}
};

Expand Down
2 changes: 1 addition & 1 deletion libs/ipc/testing/tests/filter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ auto main(int, char**) -> int {
expect(generic_config.has_value() >> fatal);
generic_config->at("time_on") = 1; // reduce time to only 1 millisecond
generic_config->at("time_off") = 1;
expect(!config.from_string(glz::write_json(generic_config)) >> fatal);
expect(!config.from_string(glz::write_json(generic_config.value())) >> fatal);
expect(config->time_on == 1ms);
expect(config->time_off == 1ms);

Expand Down
2 changes: 1 addition & 1 deletion libs/motor/inc/public/tfc/motor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,5 +581,5 @@ template <>
struct glz::meta<tfc::motor::details::not_used> {
using self = tfc::motor::details::not_used;
static constexpr std::string_view name{ "Not used" };
static constexpr auto value{ glz::object("value", &self::value, tfc::json::schema{ .read_only = true }) };
static constexpr auto value{ glz::object("value", &self::value, tfc::json::schema{ .readOnly = true }) };
};
6 changes: 3 additions & 3 deletions libs/motor/inc/public/tfc/motor/details/positioner_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ struct glz::meta<tfc::motor::positioner::increment_config<reference>> {
.description = "Displacement per increment\n"
"Mode: tachometer, displacement per pulse or distance between two teeths\n"
"Mode: encoder, displacement per edge, distance between two teeths divided by 4",
.default_value = self::inch.numerical_value_ref_in(reference),
.defaultValue = self::inch.numerical_value_ref_in(reference),
.minimum = 1UL,
},
"standard_deviation_threshold", &self::standard_deviation_threshold, tfc::json::schema{
.description = "Standard deviation between increments, used to determine if signal is stable",
.default_value = 100UL,
.defaultValue = 100UL,
.minimum = 1UL,
}
)
Expand All @@ -364,7 +364,7 @@ struct glz::meta<tfc::motor::positioner::freq_config<velocity_t>> {
glz::object(
"velocity_at_50Hz", &self::velocity_at_50Hz, tfc::json::schema{
.description = "Velocity at 50Hz",
.default_value = 0UL,
.defaultValue = 0UL,
}
)
};
Expand Down
51 changes: 20 additions & 31 deletions libs/stx/inc/public/tfc/stx/glaze_meta.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,6 @@ struct duration_hack {
};
} // namespace tfc::detail

template <typename value_t, typename error_t>
struct glz::meta<std::expected<value_t, error_t>> {
static constexpr std::string_view prefix{ "std::expected<" };
static constexpr std::string_view postfix{ ">" };
static constexpr std::string_view delimiter{ ", " };
static constexpr std::string_view name{
tfc::stx::string_view_join_v<prefix, name_v<value_t>, delimiter, name_v<error_t>, postfix>
};
static constexpr auto value{ [](auto&& self) -> auto& {
// todo this does not support error case
return self.value();
} };
};

template <std::intmax_t num, std::intmax_t den>
struct glz::meta<std::ratio<num, den>> {
using type = std::ratio<num, den>;
Expand All @@ -142,7 +128,7 @@ struct glz::meta<tfc::detail::duration_hack<rep_t, period_t>> {
static constexpr std::string_view postfix{ ">" };
static constexpr std::string_view separator{ "," };
static constexpr auto name{
tfc::stx::string_view_join_v<prefix, glz::name_v<rep_t>, separator, glz::name_v<period_t, true>, postfix>
tfc::stx::string_view_join_v<prefix, glz::name_v<rep_t>, separator, glz::name_v<period_t>, postfix>
};
};

Expand All @@ -152,7 +138,7 @@ struct glz::meta<std::chrono::duration<rep_t, period_t>> {
static constexpr std::string_view postfix{ ">" };
static constexpr std::string_view separator{ "," };
static constexpr auto name{
tfc::stx::string_view_join_v<prefix, glz::name_v<rep_t>, separator, glz::name_v<period_t, true>, postfix>
tfc::stx::string_view_join_v<prefix, glz::name_v<rep_t>, separator, glz::name_v<period_t>, postfix>
};
};

Expand All @@ -167,7 +153,7 @@ struct glz::meta<std::chrono::time_point<clock_t, duration_t>> {
static constexpr std::string_view postfix{ ">" };
static constexpr std::string_view separator{ "," };
static constexpr auto name{
tfc::stx::string_view_join_v<prefix, glz::name_v<clock_t, true>, separator, glz::name_v<duration_t, true>, postfix>
tfc::stx::string_view_join_v<prefix, glz::name_v<clock_t>, separator, glz::name_v<duration_t>, postfix>
};
};

Expand Down Expand Up @@ -270,8 +256,9 @@ template <typename clock_t, typename duration_t>
struct to_json_schema<std::chrono::time_point<clock_t, duration_t>> {
template <auto opts>
static void op(auto& schema, auto&) {
using enum tfc::json::defined_formats;
schema.attributes.format = datetime;
// fix in https://github.com/Skaginn3x/framework/issues/555
// using enum tfc::json::defined_formats;
// schema.attributes.format = datetime;
schema.type = { "string" };
}
};
Expand All @@ -286,13 +273,14 @@ struct to_json_schema<std::chrono::duration<rep_t, period_t>> {

template <auto opts>
static void op(auto& schema, auto& defs) {
auto& data = schema.attributes.tfc_metadata;
if (!data.has_value()) {
data = tfc::json::schema_meta{};
}
data->unit = schema_meta::unit_meta{ .unit_ascii = unit, .unit_unicode = unit };
data->dimension = "time";
data->ratio = tfc::json::schema_meta::ratio_impl{ .numerator = period_t::num, .denominator = period_t::den };
// fix in https://github.com/Skaginn3x/framework/issues/555
// auto& data = schema.attributes.tfc_metadata;
// if (!data.has_value()) {
// data = tfc::json::schema_meta{};
// }
// data->unit = schema_meta::unit_meta{ .unit_ascii = unit, .unit_unicode = unit };
// data->dimension = "time";
// data->ratio = tfc::json::schema_meta::ratio_impl{ .numerator = period_t::num, .denominator = period_t::den };
to_json_schema<rep_t>::template op<opts>(schema, defs);
}
};
Expand All @@ -301,11 +289,12 @@ template <typename rep_t>
struct to_json_schema<std::optional<rep_t>> {
template <auto opts>
static void op(auto& schema, auto& defs) {
auto& data = schema.attributes.tfc_metadata;
if (!data.has_value()) {
data = tfc::json::schema_meta{};
}
data->required = false;
// fix in https://github.com/Skaginn3x/framework/issues/555
// auto& data = schema.attributes.tfc_metadata;
// if (!data.has_value()) {
// data = tfc::json::schema_meta{};
// }
// data->required = false;
to_json_schema<rep_t>::template op<opts>(schema, defs);
}
};
Expand Down
Loading
Loading