#include #include "../include/uhppoted.hpp" #include "examples.hpp" using namespace std; void getTimeProfile(uhppoted &u, int argc, char **argv) { auto options = parse(argc, argv); uint32_t deviceID = options.device_id; uint32_t profileID = options.time_profile_id; time_profile profile = u.get_time_profile(deviceID, profileID); vector fields = { field("ID", deviceID), field("profile ID", profile.ID), field("linked profile", profile.linked), field("enabled from", profile.from), field(" to", profile.to), field("enabled on Monday", profile.monday), field(" Tuesday", profile.tuesday), field(" Wednesday", profile.wednesday), field(" Thursday", profile.thursday), field(" Friday", profile.friday), field(" Saturday", profile.saturday), field(" Sunday", profile.sunday), field("segment 1 start", profile.segment1start), field(" end", profile.segment1end), field("segment 2 start", profile.segment2start), field(" end", profile.segment2end), field("segment 3 start", profile.segment3start), field(" end", profile.segment3end), }; display("get-time-profile", fields); } void setTimeProfile(uhppoted &u, int argc, char **argv) { auto options = parse(argc, argv); uint32_t deviceID = options.device_id; uint8_t profileID = options.time_profile_id; time_profile profile = { .ID = profileID, .linked = 71, .from = "2022-02-01", .to = "2022-06-30", .monday = true, .tuesday = false, .wednesday = true, .thursday = true, .friday = false, .saturday = false, .sunday = true, .segment1start = "08:30", .segment1end = "11:30", .segment2start = "", .segment2end = "", .segment3start = "", .segment3end = "18:00", }; u.set_time_profile(deviceID, profile); vector fields = { field("ID", deviceID), field("profile ID", profile.ID), field("linked profile", profile.linked), field("enabled from", profile.from), field(" to", profile.to), field("enabled on Monday", profile.monday), field(" Tuesday", profile.tuesday), field(" Wednesday", profile.wednesday), field(" Thursday", profile.thursday), field(" Friday", profile.friday), field(" Saturday", profile.saturday), field(" Sunday", profile.sunday), field("segment 1 start", profile.segment1start), field(" end", profile.segment1end), field("segment 2 start", profile.segment2start), field(" end", profile.segment2end), field("segment 3 start", profile.segment3start), field(" end", profile.segment3end), }; display("set-time-profile", fields); } void clearTimeProfiles(uhppoted &u, int argc, char **argv) { auto options = parse(argc, argv); uint32_t deviceID = options.device_id; u.clear_time_profiles(deviceID); vector fields = { field("ID", deviceID), }; display("clear-time-profiles", fields); }