M module-apps/application-calendar/ApplicationCalendar.cpp => module-apps/application-calendar/ApplicationCalendar.cpp +1 -1
@@ 147,7 147,7 @@ namespace app
void ApplicationCalendar::destroyUserInterface()
{}
- void ApplicationCalendar::switchToNoEventsWindow(const std::string &title, const TimePoint &dateFilter)
+ void ApplicationCalendar::switchToNoEventsWindow(const std::string &title, const calendar::TimePoint &dateFilter)
{
if (equivalentWindow == EquivalentWindow::DayEventsWindow) {
popToWindow(gui::name::window::main_window);
M module-apps/application-calendar/ApplicationCalendar.hpp => module-apps/application-calendar/ApplicationCalendar.hpp +2 -1
@@ 55,7 55,8 @@ namespace app
}
void createUserInterface() override;
void destroyUserInterface() override;
- void switchToNoEventsWindow(const std::string &title = "", const TimePoint &dateFilter = TimePoint());
+ void switchToNoEventsWindow(const std::string &title = "",
+ const calendar::TimePoint &dateFilter = calendar::TimePoint());
static const std::map<Reminder, const char *> reminderOptions;
static const std::map<Repeat, const char *> repeatOptions;
M module-apps/application-calendar/data/CalendarData.hpp => module-apps/application-calendar/data/CalendarData.hpp +3 -3
@@ 42,7 42,7 @@ class DayMonthData : public gui::SwitchData
{
protected:
std::string dayMonth;
- TimePoint dateFilter;
+ calendar::TimePoint dateFilter;
public:
DayMonthData() = default;
@@ 52,12 52,12 @@ class DayMonthData : public gui::SwitchData
return dayMonth;
};
- TimePoint getDateFilter()
+ calendar::TimePoint getDateFilter()
{
return dateFilter;
};
- virtual void setData(std::string dayMonthText, const TimePoint &dateNumb)
+ virtual void setData(std::string dayMonthText, const calendar::TimePoint &dateNumb)
{
dayMonth = dayMonthText;
dateFilter = dateNumb;
M module-apps/application-calendar/data/dateCommon.hpp => module-apps/application-calendar/data/dateCommon.hpp +35 -35
@@ 9,13 9,13 @@
#include <Utils.hpp>
#include <random>
-using namespace std::chrono;
-using namespace std::chrono_literals;
-
-using Clock = system_clock;
-using TimePoint = time_point<Clock>;
-using YearMonthDay = date::year_month_day;
-using YearMonthDayLast = date::year_month_day_last;
+namespace calendar
+{
+ using Clock = std::chrono::system_clock;
+ using TimePoint = std::chrono::time_point<Clock>;
+ using YearMonthDay = date::year_month_day;
+ using YearMonthDayLast = date::year_month_day_last;
+} // namespace calendar
inline constexpr auto max_month_day = 48;
@@ 43,7 43,7 @@ enum class Repeat
yearly
};
-inline constexpr TimePoint TIME_POINT_INVALID = date::sys_days{date::January / 1 / 1970};
+inline constexpr calendar::TimePoint TIME_POINT_INVALID = date::sys_days{date::January / 1 / 1970};
inline constexpr uint32_t yearDigitsNumb = 4, monthDigitsNumb = 2, dayDigitsNumb = 2, HourDigitsNumb = 2,
MinDigitsNumb = 2, SecDigitsNumb = 2;
@@ 88,34 88,34 @@ inline time_t GetAsUTCTime(int year, int month, int day, int hour = 0, int minut
return basetime + GetDiffLocalWithUTCTime();
}
-inline TimePoint TimePointFromTimeT(const time_t &time)
+inline calendar::TimePoint TimePointFromTimeT(const time_t &time)
{
- return system_clock::from_time_t(time);
+ return std::chrono::system_clock::from_time_t(time);
}
-inline time_t TimePointToTimeT(const TimePoint &tp)
+inline time_t TimePointToTimeT(const calendar::TimePoint &tp)
{
- return system_clock::to_time_t(tp);
+ return std::chrono::system_clock::to_time_t(tp);
}
-inline TimePoint TimePointNow()
+inline calendar::TimePoint TimePointNow()
{
utils::time::Timestamp timestamp;
return TimePointFromTimeT(timestamp.getTime());
}
-inline std::string TimePointToString(const TimePoint &tp)
+inline std::string TimePointToString(const calendar::TimePoint &tp)
{
- return date::format("%F %T", time_point_cast<seconds>(tp));
+ return date::format("%F %T", std::chrono::time_point_cast<std::chrono::seconds>(tp));
}
-inline auto TimePointToHourMinSec(const TimePoint &tp)
+inline auto TimePointToHourMinSec(const calendar::TimePoint &tp)
{
auto dp = date::floor<date::days>(tp);
return date::make_time(tp - dp);
}
-inline uint32_t TimePointToHour24H(const TimePoint &tp)
+inline uint32_t TimePointToHour24H(const calendar::TimePoint &tp)
{
auto time = TimePointToTimeT(tp);
utils::time::Timestamp timestamp(time);
@@ 123,7 123,7 @@ inline uint32_t TimePointToHour24H(const TimePoint &tp)
return hour;
}
-inline uint32_t TimePointToMinutes(const TimePoint &tp)
+inline uint32_t TimePointToMinutes(const calendar::TimePoint &tp)
{
auto time = TimePointToTimeT(tp);
utils::time::Timestamp timestamp(time);
@@ 131,7 131,7 @@ inline uint32_t TimePointToMinutes(const TimePoint &tp)
return minute;
}
-inline TimePoint getFirstWeekDay(const TimePoint &tp)
+inline calendar::TimePoint getFirstWeekDay(const calendar::TimePoint &tp)
{
date::year_month_day yearMonthDay = date::year_month_day{date::floor<date::days>(tp)};
auto hourV = TimePointToHour24H(tp);
@@ 146,12 146,12 @@ inline TimePoint getFirstWeekDay(const TimePoint &tp)
return finalDateTime;
}
-inline std::string TimePointToString(const TimePoint &tp, date::months months)
+inline std::string TimePointToString(const calendar::TimePoint &tp, date::months months)
{
date::year_month_day yearMonthDay = date::year_month_day{date::floor<date::days>(tp)};
date::year_month_day yearMonthDayLast = yearMonthDay.year() / yearMonthDay.month() / date::last;
- TimePoint timePoint;
+ calendar::TimePoint timePoint;
if ((static_cast<unsigned>(yearMonthDay.month()) + months.count()) <= 12) {
if (yearMonthDayLast.day() == yearMonthDay.day()) {
@@ 173,41 173,41 @@ inline std::string TimePointToString(const TimePoint &tp, date::months months)
timePoint = date::sys_days{yearMonthDay.year() / yearMonthDay.month() / yearMonthDay.day()};
}
}
- return date::format("%F %T", time_point_cast<seconds>(timePoint));
+ return date::format("%F %T", std::chrono::time_point_cast<std::chrono::seconds>(timePoint));
}
-inline std::string TimePointToLocalizedDateString(const TimePoint &tp, const std::string format = "")
+inline std::string TimePointToLocalizedDateString(const calendar::TimePoint &tp, const std::string format = "")
{
auto time = TimePointToTimeT(tp);
utils::time::Date timestamp(time);
return timestamp.str(format);
}
-inline std::string TimePointToLocalizedTimeString(const TimePoint &tp, const std::string format = "")
+inline std::string TimePointToLocalizedTimeString(const calendar::TimePoint &tp, const std::string format = "")
{
auto time = TimePointToTimeT(tp);
utils::time::Time timestamp(time);
return timestamp.str(format);
}
-inline TimePoint TimePointFromString(const char *s1)
+inline calendar::TimePoint TimePointFromString(const char *s1)
{
- TimePoint tp;
+ calendar::TimePoint tp;
std::istringstream(s1) >> date::parse("%F %T", tp);
return tp;
}
-inline YearMonthDay TimePointToYearMonthDay(const TimePoint &tp)
+inline calendar::YearMonthDay TimePointToYearMonthDay(const calendar::TimePoint &tp)
{
return date::year_month_day{date::floor<date::days>(tp)};
}
-inline TimePoint TimePointFromYearMonthDay(const YearMonthDay &ymd)
+inline calendar::TimePoint TimePointFromYearMonthDay(const calendar::YearMonthDay &ymd)
{
return date::sys_days{ymd.year() / ymd.month() / ymd.day()};
}
-inline time_t TimePointToMin(const TimePoint &tp)
+inline time_t TimePointToMin(const calendar::TimePoint &tp)
{
auto time = TimePointToTimeT(tp);
auto duration = new utils::time::Duration(time);
@@ 215,7 215,7 @@ inline time_t TimePointToMin(const TimePoint &tp)
return minutes;
}
-inline uint32_t TimePointToHour12H(const TimePoint &tp)
+inline uint32_t TimePointToHour12H(const calendar::TimePoint &tp)
{
auto time = TimePointToTimeT(tp);
utils::time::Timestamp timestamp(time);
@@ 226,7 226,7 @@ inline uint32_t TimePointToHour12H(const TimePoint &tp)
return hour;
}
-inline std::string TimePointToHourString12H(const TimePoint &tp)
+inline std::string TimePointToHourString12H(const calendar::TimePoint &tp)
{
auto hour =
utils::time::Timestamp(TimePointToTimeT(tp)).get_UTC_date_time_sub_value(utils::time::GetParameters::Hour);
@@ 234,14 234,14 @@ inline std::string TimePointToHourString12H(const TimePoint &tp)
return utils::to_string(hour12h);
}
-inline std::string TimePointToHourString24H(const TimePoint &tp)
+inline std::string TimePointToHourString24H(const calendar::TimePoint &tp)
{
auto hour =
utils::time::Timestamp(TimePointToTimeT(tp)).get_UTC_date_time_sub_value(utils::time::GetParameters::Hour);
return utils::to_string(hour);
}
-inline std::string TimePointToMinutesString(const TimePoint &tp)
+inline std::string TimePointToMinutesString(const calendar::TimePoint &tp)
{
auto minute = TimePointToMinutes(tp);
auto minuteString = std::to_string(minute);
@@ 252,9 252,9 @@ inline std::string TimePointToMinutesString(const TimePoint &tp)
}
// 0: Monday, 1: Tuesday ... 6: Sunday
-inline unsigned int WeekdayIndexFromTimePoint(const TimePoint &tp)
+inline unsigned int WeekdayIndexFromTimePoint(const calendar::TimePoint &tp)
{
- auto ymw = date::year_month_weekday{floor<date::days>(tp)};
+ auto ymw = date::year_month_weekday{std::chrono::floor<date::days>(tp)};
return ymw.weekday().iso_encoding() - 1;
}
M module-apps/application-calendar/models/AllEventsModel.cpp => module-apps/application-calendar/models/AllEventsModel.cpp +2 -2
@@ 83,8 83,8 @@ auto AllEventsModel::handleQueryResponse(db::QueryResult *queryResult) -> bool
auto eventShift = app->getEventShift();
if (eventShift) {
for (auto &record : records) {
- record.date_from += hours(eventShift);
- record.date_till += hours(eventShift);
+ record.date_from += std::chrono::hours(eventShift);
+ record.date_till += std::chrono::hours(eventShift);
}
}
return this->updateRecords(std::move(records));
M module-apps/application-calendar/models/DayEventsModel.cpp => module-apps/application-calendar/models/DayEventsModel.cpp +3 -3
@@ 82,8 82,8 @@ auto DayEventsModel::handleQueryResponse(db::QueryResult *queryResult) -> bool
auto eventShift = app->getEventShift();
if (eventShift) {
for (auto &record : records) {
- record.date_from += hours(eventShift);
- record.date_till += hours(eventShift);
+ record.date_from += std::chrono::hours(eventShift);
+ record.date_till += std::chrono::hours(eventShift);
}
}
return updateRecords(std::move(records));
@@ 95,7 95,7 @@ auto DayEventsModel::handleQueryResponse(db::QueryResult *queryResult) -> bool
return false;
}
-void DayEventsModel::setFilters(TimePoint from, TimePoint till, const std::string &dayMonth)
+void DayEventsModel::setFilters(calendar::TimePoint from, calendar::TimePoint till, const std::string &dayMonth)
{
this->filterFrom = from;
this->filterTill = till;
M module-apps/application-calendar/models/DayEventsModel.hpp => module-apps/application-calendar/models/DayEventsModel.hpp +3 -3
@@ 15,13 15,13 @@ class DayEventsModel : public app::DatabaseModel<EventsRecord>,
{
app::Application *application = nullptr;
std::string dayMonthTitle;
- TimePoint filterFrom = TIME_POINT_INVALID;
- TimePoint filterTill = TIME_POINT_INVALID;
+ calendar::TimePoint filterFrom = TIME_POINT_INVALID;
+ calendar::TimePoint filterTill = TIME_POINT_INVALID;
public:
DayEventsModel(app::Application *app);
- void setFilters(TimePoint from, TimePoint till, const std::string &dayMonth);
+ void setFilters(calendar::TimePoint from, calendar::TimePoint till, const std::string &dayMonth);
bool updateRecords(std::vector<EventsRecord> records) override;
auto handleQueryResponse(db::QueryResult *) -> bool;
M module-apps/application-calendar/widgets/EventDateItem.cpp => module-apps/application-calendar/widgets/EventDateItem.cpp +3 -3
@@ 149,7 149,7 @@ namespace gui
return true;
}
- YearMonthDay EventDateItem::validateDate()
+ calendar::YearMonthDay EventDateItem::validateDate()
{
auto actualDate = TimePointToYearMonthDay(TimePointNow());
uint32_t day;
@@ 185,7 185,7 @@ namespace gui
}
month = std::clamp(static_cast<unsigned>(month), 1u, static_cast<unsigned>(date::dec));
- YearMonthDayLast max_date = date::year(year) / date::month(month) / date::last;
+ calendar::YearMonthDayLast max_date = date::year(year) / date::month(month) / date::last;
if (day > static_cast<unsigned>(max_date.day())) {
dayInput->setText(std::to_string(static_cast<unsigned>(max_date.day())));
}
@@ 194,7 194,7 @@ namespace gui
return date::year(year) / date::month(month) / date::day(day);
}
- const YearMonthDay EventDateItem::getChosenDate()
+ const calendar::YearMonthDay EventDateItem::getChosenDate()
{
return validateDate();
}
M module-apps/application-calendar/widgets/EventDateItem.hpp => module-apps/application-calendar/widgets/EventDateItem.hpp +2 -2
@@ 24,12 24,12 @@ namespace gui
void buildInterface();
void applyItemSpecificProperties(gui::Text *item);
void applyCallbacks();
- YearMonthDay validateDate();
+ calendar::YearMonthDay validateDate();
public:
EventDateItem();
- const YearMonthDay getChosenDate();
+ const calendar::YearMonthDay getChosenDate();
// virtual methods from Item
bool onDimensionChanged(const BoundingBox &oldDim, const BoundingBox &newDim) override;
};
M module-apps/application-calendar/widgets/EventTimeItem.cpp => module-apps/application-calendar/widgets/EventTimeItem.cpp +3 -3
@@ 433,9 433,9 @@ namespace gui
}
}
- TimePoint EventTimeItem::calculateEventTime(YearMonthDay date,
- std::chrono::hours hours,
- std::chrono::minutes minutes)
+ calendar::TimePoint EventTimeItem::calculateEventTime(calendar::YearMonthDay date,
+ std::chrono::hours hours,
+ std::chrono::minutes minutes)
{
return TimePointFromYearMonthDay(date) + hours + minutes;
}
M module-apps/application-calendar/widgets/EventTimeItem.hpp => module-apps/application-calendar/widgets/EventTimeItem.hpp +3 -1
@@ 43,7 43,9 @@ namespace gui
std::chrono::minutes end_hour,
uint32_t start_minutes,
uint32_t end_minutes);
- TimePoint calculateEventTime(YearMonthDay date, std::chrono::hours hours, std::chrono::minutes minutes);
+ calendar::TimePoint calculateEventTime(calendar::YearMonthDay date,
+ std::chrono::hours hours,
+ std::chrono::minutes minutes);
public:
EventTimeItem(const std::string &description,
M module-apps/application-calendar/widgets/MonthBox.cpp => module-apps/application-calendar/widgets/MonthBox.cpp +1 -1
@@ 58,7 58,7 @@ namespace gui
auto mainWindow = dynamic_cast<CalendarMainWindow *>(parent);
if (mainWindow->returnedFromWindow) {
focusChangedCallback = [=](Item &item) {
- YearMonthDay date = monthFilterValue.year() / monthFilterValue.month() / date::last;
+ calendar::YearMonthDay date = monthFilterValue.year() / monthFilterValue.month() / date::last;
if (unsigned(date.day()) < mainWindow->dayFocusedBefore) {
setFocusOnElement(unsigned(date.day()) - 1);
}
M module-apps/application-calendar/windows/AllEventsWindow.hpp => module-apps/application-calendar/windows/AllEventsWindow.hpp +1 -1
@@ 16,7 16,7 @@ namespace gui
gui::Image *leftArrowImage = nullptr;
gui::Image *newDayEventImage = nullptr;
- TimePoint dateFilter = TimePointNow();
+ calendar::TimePoint dateFilter = TimePointNow();
gui::ListView *allEventsList = nullptr;
std::shared_ptr<AllEventsModel> allEventsModel = nullptr;
M module-apps/application-calendar/windows/CalendarMainWindow.cpp => module-apps/application-calendar/windows/CalendarMainWindow.cpp +2 -2
@@ 197,8 197,8 @@ namespace gui
void CalendarMainWindow::filterRequest()
{
- YearMonthDay date_from = actualDate.year() / actualDate.month() / 1;
- YearMonthDay date_till = date_from + date::months{1};
+ calendar::YearMonthDay date_from = actualDate.year() / actualDate.month() / 1;
+ calendar::YearMonthDay date_till = date_from + date::months{1};
auto filter_from = TimePointFromYearMonthDay(date_from);
auto filter_till = TimePointFromYearMonthDay(date_till);
LOG_DEBUG("filter: %s", TimePointToString(filter_till).c_str());
M module-apps/application-calendar/windows/DayEventsWindow.hpp => module-apps/application-calendar/windows/DayEventsWindow.hpp +1 -1
@@ 19,7 19,7 @@ namespace gui
class DayEventsWindow : public gui::AppWindow
{
std::string dayMonthTitle;
- TimePoint filterFrom;
+ calendar::TimePoint filterFrom;
gui::Image *leftArrowImage = nullptr;
gui::Image *newDayEventImage = nullptr;
gui::ListView *dayEventsList = nullptr;
M module-apps/application-settings/windows/CellularPassthroughWindow.hpp => module-apps/application-settings/windows/CellularPassthroughWindow.hpp +1 -3
@@ 30,8 30,6 @@ namespace gui
} // namespace cellular_passthrough
} // namespace window
- using namespace bsp::cellular::USB;
-
class CellularPassthroughWindow : public AppWindow
{
private:
@@ 76,7 74,7 @@ namespace gui
CellularPassthroughWindow::State getInitialState();
- bool set(PassthroughState pass_to_set, BootPinState dfu_to_set);
+ bool set(bsp::cellular::USB::PassthroughState pass_to_set, bsp::cellular::USB::BootPinState dfu_to_set);
void setWindowState(State state);
M module-audio/Audio/StreamQueuedEventsListener.cpp => module-audio/Audio/StreamQueuedEventsListener.cpp +2 -1
@@ 5,7 5,8 @@
using namespace audio;
-StreamQueuedEventsListener::StreamQueuedEventsListener(std::shared_ptr<Queue> eventsQueue) : queue(eventsQueue)
+StreamQueuedEventsListener::StreamQueuedEventsListener(std::shared_ptr<cpp_freertos::Queue> eventsQueue)
+ : queue(eventsQueue)
{}
void StreamQueuedEventsListener::onEvent(Stream *stream, Stream::Event event, Stream::EventSourceMode source)
M module-audio/Audio/StreamQueuedEventsListener.hpp => module-audio/Audio/StreamQueuedEventsListener.hpp +2 -4
@@ 13,8 13,6 @@
namespace audio
{
- using namespace cpp_freertos;
-
class StreamQueuedEventsListener : public Stream::EventListener
{
private:
@@ 29,7 27,7 @@ namespace audio
using queuedEvent = std::pair<Stream *, Stream::Event>;
static constexpr auto listenerElementSize = sizeof(EventStorage);
- StreamQueuedEventsListener(std::shared_ptr<Queue> eventsQueue);
+ StreamQueuedEventsListener(std::shared_ptr<cpp_freertos::Queue> eventsQueue);
void onEvent(Stream *stream, Stream::Event event, Stream::EventSourceMode source);
@@ 39,7 37,7 @@ namespace audio
std::size_t getEventsCount() const;
private:
- std::shared_ptr<Queue> queue;
+ std::shared_ptr<cpp_freertos::Queue> queue;
};
}; // namespace audio
M module-db/Common/Query.cpp => module-db/Common/Query.cpp +1 -1
@@ 21,7 21,7 @@ bool QueryCallback::handleQueryResponse(QueryResult *response)
return callback(response);
}
-EndpointListener::EndpointListener(EndpointQueryCallbackFunction &&_callback, Context &_context)
+EndpointListener::EndpointListener(EndpointQueryCallbackFunction &&_callback, parserFSM::Context &_context)
: callback{std::move(_callback)}, context{_context}
{}
M module-db/Common/Query.hpp => module-db/Common/Query.hpp +3 -5
@@ 9,13 9,11 @@
#include <log/log.hpp>
#include <module-services/service-desktop/endpoints/Context.hpp>
-using namespace parserFSM;
-
namespace db
{
class QueryResult; // Forward declaration
using QueryCallbackFunction = std::function<bool(db::QueryResult *)>;
- using EndpointQueryCallbackFunction = std::function<bool(db::QueryResult *, Context &)>;
+ using EndpointQueryCallbackFunction = std::function<bool(db::QueryResult *, parserFSM::Context &)>;
class QueryListener
{
@@ 42,13 40,13 @@ namespace db
{
public:
EndpointListener() = default;
- EndpointListener(EndpointQueryCallbackFunction &&_callback, Context &_context);
+ EndpointListener(EndpointQueryCallbackFunction &&_callback, parserFSM::Context &_context);
bool handleQueryResponse(db::QueryResult *result) override;
private:
EndpointQueryCallbackFunction callback;
- Context context;
+ parserFSM::Context context;
};
/// virtual query input interface
M module-db/Interface/AlarmsRecord.hpp => module-db/Interface/AlarmsRecord.hpp +1 -1
@@ 28,7 28,7 @@ namespace db::query::alarms
struct AlarmsRecord : public Record
{
- TimePoint time = TIME_POINT_INVALID;
+ calendar::TimePoint time = TIME_POINT_INVALID;
uint32_t snooze = 0;
AlarmStatus status = AlarmStatus::On;
uint32_t repeat = 0;
M module-db/Interface/EventsRecord.cpp => module-db/Interface/EventsRecord.cpp +5 -4
@@ 70,8 70,8 @@ bool EventsRecordInterface::Add(const EventsRecord &rec)
return false;
}
-std::vector<EventsRecord> EventsRecordInterface::Select(TimePoint filter_from,
- TimePoint filter_till,
+std::vector<EventsRecord> EventsRecordInterface::Select(calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till,
uint32_t offset,
uint32_t limit)
{
@@ 265,12 265,13 @@ uint32_t EventsRecordInterface::GetCount()
return eventsDb->events.count();
}
-uint32_t EventsRecordInterface::GetCountFiltered(TimePoint from, TimePoint till)
+uint32_t EventsRecordInterface::GetCountFiltered(calendar::TimePoint from, calendar::TimePoint till)
{
return eventsDb->events.countFromFilter(from, till);
}
-std::vector<EventsRecord> EventsRecordInterface::SelectFirstUpcoming(TimePoint filter_from, TimePoint filter_till)
+std::vector<EventsRecord> EventsRecordInterface::SelectFirstUpcoming(calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till)
{
auto rows = eventsDb->events.SelectFirstUpcoming(filter_from, filter_till);
M module-db/Interface/EventsRecord.hpp => module-db/Interface/EventsRecord.hpp +9 -6
@@ 41,11 41,11 @@ struct EventsRecord : public Record
{
std::string UID;
std::string title;
- TimePoint date_from;
- TimePoint date_till;
+ calendar::TimePoint date_from;
+ calendar::TimePoint date_till;
uint32_t reminder = 0;
uint32_t repeat = 0;
- TimePoint reminder_fired;
+ calendar::TimePoint reminder_fired;
std::string provider_type;
std::string provider_id;
std::string provider_iCalUid;
@@ 77,15 77,18 @@ class EventsRecordInterface : public RecordInterface<EventsRecord, EventsRecordF
EventsRecord GetByID(uint32_t id) override final;
EventsRecord GetByUID(const std::string &uid);
uint32_t GetCount() override final;
- uint32_t GetCountFiltered(TimePoint from, TimePoint till);
- std::vector<EventsRecord> Select(TimePoint filter_from, TimePoint filter_till, uint32_t offset, uint32_t limit);
+ uint32_t GetCountFiltered(calendar::TimePoint from, calendar::TimePoint till);
+ std::vector<EventsRecord> Select(calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till,
+ uint32_t offset,
+ uint32_t limit);
std::unique_ptr<std::vector<EventsRecord>> GetLimitOffset(uint32_t offset, uint32_t limit) override final;
std::unique_ptr<std::vector<EventsRecord>> GetLimitOffsetByField(uint32_t offset,
uint32_t limit,
EventsRecordField field,
const char *str) override final;
std::vector<EventsRecord> GetLimitOffsetByDate(uint32_t offset, uint32_t limit);
- std::vector<EventsRecord> SelectFirstUpcoming(TimePoint filter_from, TimePoint filter_till);
+ std::vector<EventsRecord> SelectFirstUpcoming(calendar::TimePoint filter_from, calendar::TimePoint filter_till);
std::unique_ptr<db::QueryResult> runQuery(std::shared_ptr<db::Query> query) override;
M module-db/Tables/AlarmsTable.cpp => module-db/Tables/AlarmsTable.cpp +1 -1
@@ 9,7 9,7 @@ AlarmsTableRow::AlarmsTableRow(const AlarmsRecord &rec)
{}
AlarmsTableRow::AlarmsTableRow(
- uint32_t id, TimePoint time, uint32_t snooze, AlarmStatus status, uint32_t repeat, UTF8 path)
+ uint32_t id, calendar::TimePoint time, uint32_t snooze, AlarmStatus status, uint32_t repeat, UTF8 path)
: Record{id}, time{time}, snooze{snooze}, status{status}, repeat{repeat}, path{std::move(path)}
{}
M module-db/Tables/AlarmsTable.hpp => module-db/Tables/AlarmsTable.hpp +3 -2
@@ 25,14 25,15 @@ enum class AlarmStatus
struct AlarmsTableRow : public Record
{
- TimePoint time = TIME_POINT_INVALID;
+ calendar::TimePoint time = TIME_POINT_INVALID;
uint32_t snooze = 0;
AlarmStatus status = AlarmStatus::On;
uint32_t repeat = 0;
UTF8 path;
AlarmsTableRow() = default;
- AlarmsTableRow(uint32_t id, TimePoint time, uint32_t snooze, AlarmStatus status, uint32_t repeat, UTF8 path);
+ AlarmsTableRow(
+ uint32_t id, calendar::TimePoint time, uint32_t snooze, AlarmStatus status, uint32_t repeat, UTF8 path);
explicit AlarmsTableRow(const AlarmsRecord &rec);
explicit AlarmsTableRow(const QueryResult &result);
};
M module-db/Tables/EventsTable.cpp => module-db/Tables/EventsTable.cpp +5 -4
@@ 643,8 643,8 @@ EventsTableRow EventsTable::getByUID(const std::string &UID)
};
}
-std::vector<EventsTableRow> EventsTable::selectByDatePeriod(TimePoint date_filter,
- TimePoint filter_till,
+std::vector<EventsTableRow> EventsTable::selectByDatePeriod(calendar::TimePoint date_filter,
+ calendar::TimePoint filter_till,
uint32_t offset,
uint32_t limit)
{
@@ 770,7 770,7 @@ uint32_t EventsTable::count()
return (*queryRet)[0].getUInt32();
}
-uint32_t EventsTable::countFromFilter(TimePoint from, TimePoint till)
+uint32_t EventsTable::countFromFilter(calendar::TimePoint from, calendar::TimePoint till)
{
auto queryRet = db->query(
"SELECT COUNT(*) FROM events WHERE date_from >= date('%q') AND date_from < date('%q', 'start of day');",
@@ 791,7 791,8 @@ uint32_t EventsTable::countByFieldId(const char *field, uint32_t id)
return 0;
}
-std::vector<EventsTableRow> EventsTable::SelectFirstUpcoming(TimePoint filter_from, TimePoint filter_till)
+std::vector<EventsTableRow> EventsTable::SelectFirstUpcoming(calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till)
{
auto retQuery = db->query("SELECT DATETIME(date_from, '-' || reminder || ' minutes') AS calc_dt, * "
"FROM events "
M module-db/Tables/EventsTable.hpp => module-db/Tables/EventsTable.hpp +7 -7
@@ 14,11 14,11 @@ struct EventsTableRow : public Record
{
std::string UID;
std::string title;
- TimePoint date_from = TIME_POINT_INVALID;
- TimePoint date_till = TIME_POINT_INVALID;
+ calendar::TimePoint date_from = TIME_POINT_INVALID;
+ calendar::TimePoint date_till = TIME_POINT_INVALID;
uint32_t reminder = 0;
uint32_t repeat = 0;
- TimePoint reminder_fired = TIME_POINT_INVALID;
+ calendar::TimePoint reminder_fired = TIME_POINT_INVALID;
std::string provider_type;
std::string provider_id;
std::string provider_iCalUid;
@@ 53,12 53,12 @@ class EventsTable : public Table<EventsTableRow, EventsTableFields>
bool drop();
EventsTableRow getByUID(const std::string &UID);
EventsTableRow getById(uint32_t id) override final;
- std::vector<EventsTableRow> selectByDatePeriod(TimePoint filter_from,
- TimePoint filter_till,
+ std::vector<EventsTableRow> selectByDatePeriod(calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till,
uint32_t offset,
uint32_t limit);
uint32_t count() override final;
- uint32_t countFromFilter(TimePoint from, TimePoint till);
+ uint32_t countFromFilter(calendar::TimePoint from, calendar::TimePoint till);
uint32_t countByFieldId(const char *field, uint32_t id) override final;
std::vector<EventsTableRow> getLimitOffset(uint32_t offset, uint32_t limit) override final;
std::vector<EventsTableRow> getLimitOffsetByField(uint32_t offset,
@@ 67,7 67,7 @@ class EventsTable : public Table<EventsTableRow, EventsTableFields>
const char *str) override final;
std::vector<EventsTableRow> getLimitOffsetByDate(uint32_t offset, uint32_t limit);
- std::vector<EventsTableRow> SelectFirstUpcoming(TimePoint filter_from, TimePoint filter_till);
+ std::vector<EventsTableRow> SelectFirstUpcoming(calendar::TimePoint filter_from, calendar::TimePoint filter_till);
private:
const char *createTableQuery = "CREATE TABLE IF NOT EXISTS events("
M module-db/queries/calendar/QueryEventsGetFiltered.cpp => module-db/queries/calendar/QueryEventsGetFiltered.cpp +4 -1
@@ 5,7 5,10 @@
namespace db::query::events
{
- GetFiltered::GetFiltered(TimePoint filter_from, TimePoint filter_till, uint32_t offset, uint32_t limit)
+ GetFiltered::GetFiltered(calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till,
+ uint32_t offset,
+ uint32_t limit)
: Query(Query::Type::Read), filter_from(filter_from), filter_till(filter_till), offset(offset), limit(limit)
{}
M module-db/queries/calendar/QueryEventsGetFiltered.hpp => module-db/queries/calendar/QueryEventsGetFiltered.hpp +6 -3
@@ 13,11 13,14 @@ namespace db::query::events
class GetFiltered : public Query
{
public:
- GetFiltered(TimePoint filter_from, TimePoint filter_till, uint32_t offset = 0, uint32_t limit = UINT32_MAX);
+ GetFiltered(calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till,
+ uint32_t offset = 0,
+ uint32_t limit = UINT32_MAX);
[[nodiscard]] auto debugInfo() const -> std::string override;
- TimePoint filter_from;
- TimePoint filter_till;
+ calendar::TimePoint filter_from;
+ calendar::TimePoint filter_till;
uint32_t offset;
uint32_t limit;
};
M module-db/queries/calendar/QueryEventsSelectFirstUpcoming.cpp => module-db/queries/calendar/QueryEventsSelectFirstUpcoming.cpp +1 -1
@@ 5,7 5,7 @@
namespace db::query::events
{
- SelectFirstUpcoming::SelectFirstUpcoming(TimePoint filter_from, TimePoint filter_till)
+ SelectFirstUpcoming::SelectFirstUpcoming(calendar::TimePoint filter_from, calendar::TimePoint filter_till)
: Query(Query::Type::Read), filter_from(filter_from), filter_till(filter_till)
{}
M module-db/queries/calendar/QueryEventsSelectFirstUpcoming.hpp => module-db/queries/calendar/QueryEventsSelectFirstUpcoming.hpp +3 -3
@@ 14,11 14,11 @@ namespace db::query::events
class SelectFirstUpcoming : public Query
{
public:
- SelectFirstUpcoming(TimePoint filter_from, TimePoint filter_till);
+ SelectFirstUpcoming(calendar::TimePoint filter_from, calendar::TimePoint filter_till);
[[nodiscard]] auto debugInfo() const -> std::string override;
- TimePoint filter_from;
- TimePoint filter_till;
+ calendar::TimePoint filter_from;
+ calendar::TimePoint filter_till;
};
/// Result of SelectFirstUpcoming query
M module-db/tests/AlarmsRecord_tests.cpp => module-db/tests/AlarmsRecord_tests.cpp +1 -1
@@ 184,7 184,7 @@ TEST_CASE("Alarms Record tests")
}
auto getQuery = [&](uint32_t id,
- TimePoint alarmTime,
+ calendar::TimePoint alarmTime,
uint32_t snooze,
AlarmStatus status,
uint32_t repeat,
M module-db/tests/AlarmsTable_tests.cpp => module-db/tests/AlarmsTable_tests.cpp +5 -5
@@ 139,11 139,11 @@ TEST_CASE("Alarms Table tests")
REQUIRE(alarmsTbl.add(
AlarmsTableRow(5, TimePointFromString("2020-12-11 07:15:00"), 1, AlarmStatus::On, 1, "file2.mp3")));
- const std::array<TimePoint, 5> paramTime{TimePointFromString("2020-12-11 07:15:00"),
- TimePointFromString("2020-11-11 15:10:00"),
- TimePointFromString("2020-11-11 15:15:00"),
- TimePointFromString("2020-11-12 17:10:00"),
- TimePointFromString("2020-11-11 19:25:00")};
+ const std::array<calendar::TimePoint, 5> paramTime{TimePointFromString("2020-12-11 07:15:00"),
+ TimePointFromString("2020-11-11 15:10:00"),
+ TimePointFromString("2020-11-11 15:15:00"),
+ TimePointFromString("2020-11-12 17:10:00"),
+ TimePointFromString("2020-11-11 19:25:00")};
REQUIRE(alarmsTbl.count() == 5);
auto entries = alarmsTbl.getLimitOffset(0, 5);
M module-db/tests/EventsRecord_tests.cpp => module-db/tests/EventsRecord_tests.cpp +8 -3
@@ 24,6 24,8 @@
#include <algorithm>
#include <iostream>
+using namespace std::chrono_literals;
+
static auto remove_events(EventsDB &db) -> bool
{
auto count = db.events.count();
@@ 728,7 730,7 @@ TEST_CASE("Events Record tests")
SECTION("Select first upcoming event")
{
- TimePoint start_date = TimePointFromString("2019-10-19 14:24:00");
+ calendar::TimePoint start_date = TimePointFromString("2019-10-19 14:24:00");
auto nextUpcoming = eventsRecordInterface.SelectFirstUpcoming(start_date, start_date);
REQUIRE(nextUpcoming.size() == 1);
EventsRecord nextEventsRecord = nextUpcoming.at(0);
@@ 797,7 799,9 @@ TEST_CASE("Events Record tests")
getAll(expectedRecords, numberOfEvents);
}
- auto getFiltered = [&](TimePoint filter_from, TimePoint filter_till, std::vector<EventsRecord> expected_records) {
+ auto getFiltered = [&](calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till,
+ std::vector<EventsRecord> expected_records) {
auto query = std::make_shared<db::query::events::GetFiltered>(filter_from, filter_till);
auto ret = eventsRecordInterface.runQuery(query);
auto result = dynamic_cast<db::query::events::GetFilteredResult *>(ret.get());
@@ 1009,7 1013,8 @@ TEST_CASE("Events Record tests")
EditQueryICS(testRecord6.UID, testRecord6);
}
- [[maybe_unused]] auto selectFirstUpcomingEvent = [&](TimePoint filter_from, TimePoint filter_till) {
+ [[maybe_unused]] auto selectFirstUpcomingEvent = [&](calendar::TimePoint filter_from,
+ calendar::TimePoint filter_till) {
auto query = std::make_shared<db::query::events::SelectFirstUpcoming>(filter_from, filter_till);
auto ret = eventsRecordInterface.runQuery(query);
auto result = dynamic_cast<db::query::events::SelectFirstUpcomingResult *>(ret.get());
M module-db/tests/EventsTable_tests.cpp => module-db/tests/EventsTable_tests.cpp +39 -37
@@ 15,6 15,8 @@
#include <purefs/filesystem_paths.hpp>
#include <unistd.h>
+using namespace std::chrono_literals;
+
static auto remove_events(EventsDB &db) -> bool
{
auto count = db.events.count();
@@ 164,8 166,8 @@ TEST_CASE("Events Table tests")
CHECK(eventsTbl.count() == 0);
uint32_t numberOfEvents = 7;
- TimePoint startDate = TimePointFromString("2019-10-20 14:30:00");
- TimePoint endDate = TimePointFromString("2019-10-20 15:30:00");
+ calendar::TimePoint startDate = TimePointFromString("2019-10-20 14:30:00");
+ calendar::TimePoint endDate = TimePointFromString("2019-10-20 15:30:00");
testRow1.date_from = startDate;
testRow1.date_till = endDate;
CHECK(eventsTbl.addDaily(testRow1));
@@ 199,8 201,8 @@ TEST_CASE("Events Table tests")
CHECK(eventsTbl.count() == 0);
uint32_t numberOfEvents = 4;
- TimePoint startDate = TimePointFromString("2019-10-20 14:30:00");
- TimePoint endDate = TimePointFromString("2019-10-20 15:30:00");
+ calendar::TimePoint startDate = TimePointFromString("2019-10-20 14:30:00");
+ calendar::TimePoint endDate = TimePointFromString("2019-10-20 15:30:00");
testRow1.date_from = startDate;
testRow1.date_till = endDate;
CHECK(eventsTbl.addWeekly(testRow1));
@@ 234,8 236,8 @@ TEST_CASE("Events Table tests")
CHECK(eventsTbl.count() == 0);
uint32_t numberOfEvents = 4;
- TimePoint startDate = TimePointFromString("2019-10-20 14:30:00");
- TimePoint endDate = TimePointFromString("2019-10-20 15:30:00");
+ calendar::TimePoint startDate = TimePointFromString("2019-10-20 14:30:00");
+ calendar::TimePoint endDate = TimePointFromString("2019-10-20 15:30:00");
testRow1.date_from = startDate;
testRow1.date_till = endDate;
CHECK(eventsTbl.addTwoWeeks(testRow1));
@@ 269,7 271,7 @@ TEST_CASE("Events Table tests")
CHECK(eventsTbl.count() == 0);
uint32_t numberOfEvents = 12;
- const std::array<TimePoint, 24> dates{
+ const std::array<calendar::TimePoint, 24> dates{
TimePointFromString("2019-01-20 14:30:00"), TimePointFromString("2019-01-20 15:30:00"),
TimePointFromString("2019-02-20 14:30:00"), TimePointFromString("2019-02-20 15:30:00"),
TimePointFromString("2019-03-20 14:30:00"), TimePointFromString("2019-03-20 15:30:00"),
@@ 316,14 318,14 @@ TEST_CASE("Events Table tests")
REQUIRE(eventsTbl.count() == 0);
uint32_t numberOfEvents = 4;
- std::array<TimePoint, 8> dates{TimePointFromString("2019-02-20 14:30:00"),
- TimePointFromString("2019-02-20 15:30:00"),
- TimePointFromString("2020-02-20 14:30:00"),
- TimePointFromString("2020-02-20 15:30:00"),
- TimePointFromString("2021-02-20 14:30:00"),
- TimePointFromString("2021-02-20 15:30:00"),
- TimePointFromString("2022-02-20 14:30:00"),
- TimePointFromString("2022-02-20 15:30:00")};
+ std::array<calendar::TimePoint, 8> dates{TimePointFromString("2019-02-20 14:30:00"),
+ TimePointFromString("2019-02-20 15:30:00"),
+ TimePointFromString("2020-02-20 14:30:00"),
+ TimePointFromString("2020-02-20 15:30:00"),
+ TimePointFromString("2021-02-20 14:30:00"),
+ TimePointFromString("2021-02-20 15:30:00"),
+ TimePointFromString("2022-02-20 14:30:00"),
+ TimePointFromString("2022-02-20 15:30:00")};
testRow1.date_from = dates[0];
testRow1.date_till = dates[1];
@@ 365,8 367,8 @@ TEST_CASE("Events Table tests")
{
auto check_custom_repeat = [&](uint32_t customRepeatOption,
uint32_t numberOfEvents,
- TimePoint originalStartDate,
- TimePoint originalEndDate) {
+ calendar::TimePoint originalStartDate,
+ calendar::TimePoint originalEndDate) {
if (eventsTbl.count() > 0) {
REQUIRE(remove_events(eventsDb));
}
@@ 394,8 396,8 @@ TEST_CASE("Events Table tests")
}
}
- TimePoint expectedStartDate = TimePointFromString("2020-12-07 14:30:00"); // monday
- TimePoint expectedEndDate = TimePointFromString("2020-12-07 15:30:00"); // monday
+ calendar::TimePoint expectedStartDate = TimePointFromString("2020-12-07 14:30:00"); // monday
+ calendar::TimePoint expectedEndDate = TimePointFromString("2020-12-07 15:30:00"); // monday
uint32_t i = 0;
for (uint32_t l = 0; l < numberOfWeeks; l++) {
@@ 437,8 439,8 @@ TEST_CASE("Events Table tests")
uint32_t customRepeatOption =
static_cast<uint32_t>(weekDayOption::monday) + static_cast<uint32_t>(weekDayOption::wednesday);
uint32_t numberOfEvents = 9;
- TimePoint originalStartDate = TimePointFromString("2020-12-10 14:30:00"); // thursday
- TimePoint originalEndDate = TimePointFromString("2020-12-10 15:30:00"); // thursday
+ calendar::TimePoint originalStartDate = TimePointFromString("2020-12-10 14:30:00"); // thursday
+ calendar::TimePoint originalEndDate = TimePointFromString("2020-12-10 15:30:00"); // thursday
check_custom_repeat(customRepeatOption, numberOfEvents, originalStartDate, originalEndDate);
}
@@ 449,8 451,8 @@ TEST_CASE("Events Table tests")
static_cast<uint32_t>(weekDayOption::monday) + static_cast<uint32_t>(weekDayOption::wednesday) +
static_cast<uint32_t>(weekDayOption::tuesday) + static_cast<uint32_t>(weekDayOption::sunday);
uint32_t numberOfEvents = 17;
- TimePoint originalStartDate = TimePointFromString("2020-12-10 14:30:00"); // thursday
- TimePoint originalEndDate = TimePointFromString("2020-12-10 15:30:00"); // thursday
+ calendar::TimePoint originalStartDate = TimePointFromString("2020-12-10 14:30:00"); // thursday
+ calendar::TimePoint originalEndDate = TimePointFromString("2020-12-10 15:30:00"); // thursday
check_custom_repeat(customRepeatOption, numberOfEvents, originalStartDate, originalEndDate);
}
@@ 459,8 461,8 @@ TEST_CASE("Events Table tests")
{
uint32_t customRepeatOption = static_cast<uint32_t>(weekDayOption::saturday);
uint32_t numberOfEvents = 5;
- TimePoint originalStartDate = TimePointFromString("2020-12-10 14:30:00"); // thursday
- TimePoint originalEndDate = TimePointFromString("2020-12-10 15:30:00"); // thursday
+ calendar::TimePoint originalStartDate = TimePointFromString("2020-12-10 14:30:00"); // thursday
+ calendar::TimePoint originalEndDate = TimePointFromString("2020-12-10 15:30:00"); // thursday
check_custom_repeat(customRepeatOption, numberOfEvents, originalStartDate, originalEndDate);
}
@@ 468,8 470,8 @@ TEST_CASE("Events Table tests")
SECTION("Check count from filter")
{
- TimePoint from = TimePointFromString("2019-10-20 14:30:00");
- TimePoint till = TimePointFromString("2019-10-24 14:20:00");
+ calendar::TimePoint from = TimePointFromString("2019-10-20 14:30:00");
+ calendar::TimePoint till = TimePointFromString("2019-10-24 14:20:00");
CHECK(eventsTbl.countFromFilter(from, till) == 4);
}
@@ 514,8 516,8 @@ TEST_CASE("Events Table tests")
CHECK(eventsTbl.count() == 6);
std::string newTitle = "Updated Title", newProviderID = "PurePhoneUpdated";
- TimePoint newDateFrom = TimePointFromString("2020-10-20 15:00:00"),
- newDateTill = TimePointFromString("2020-10-20 16:00:00");
+ calendar::TimePoint newDateFrom = TimePointFromString("2020-10-20 15:00:00"),
+ newDateTill = TimePointFromString("2020-10-20 16:00:00");
uint32_t newReminder = static_cast<uint32_t>(Reminder::one_week_before);
uint32_t newRepeatOption = static_cast<uint32_t>(Repeat::biweekly);
@@ 570,8 572,8 @@ TEST_CASE("Events Table tests")
std::string newTitle = "Updated Title", newProviderType = "PurePhoneUpdate", newProviderID = "newID",
newProvideriCalUid = "new iCalUid";
- TimePoint newDateFrom = TimePointFromString("2020-10-20 15:00:00"),
- newDateTill = TimePointFromString("2020-10-20 16:00:00");
+ calendar::TimePoint newDateFrom = TimePointFromString("2020-10-20 15:00:00"),
+ newDateTill = TimePointFromString("2020-10-20 16:00:00");
uint32_t newReminder = static_cast<uint32_t>(Reminder::one_week_before);
uint32_t newRepeatOption = static_cast<uint32_t>(Repeat::biweekly);
@@ 628,8 630,8 @@ TEST_CASE("Events Table tests")
std::string newTitle = "Updated Title", newProviderType = "PurePhoneUpdate", newProviderID = "newID",
newProvideriCalUid = "new iCalUid";
- TimePoint newDateFrom = TimePointFromString("2020-10-20 15:00:00"),
- newDateTill = TimePointFromString("2020-10-20 16:00:00");
+ calendar::TimePoint newDateFrom = TimePointFromString("2020-10-20 15:00:00"),
+ newDateTill = TimePointFromString("2020-10-20 16:00:00");
uint32_t newReminder = static_cast<uint32_t>(Reminder::one_week_before);
uint32_t newRepeatOption = static_cast<uint32_t>(Repeat::biweekly);
@@ 727,11 729,11 @@ TEST_CASE("Events Table tests")
}
CHECK(eventsTbl.count() == 0);
- TimePoint startDate1 = TimePointFromString("2018-10-20 14:24:00");
- TimePoint startDate2 = TimePointFromString("2020-10-20 14:24:00");
+ calendar::TimePoint startDate1 = TimePointFromString("2018-10-20 14:24:00");
+ calendar::TimePoint startDate2 = TimePointFromString("2020-10-20 14:24:00");
- TimePoint tillDate = TimePointFromString("2030-10-20 15:24:00");
- TimePoint firedDate = TimePointFromString("2018-10-20 14:24:00");
+ calendar::TimePoint tillDate = TimePointFromString("2030-10-20 15:24:00");
+ calendar::TimePoint firedDate = TimePointFromString("2018-10-20 14:24:00");
EventsTableRow testEvent1 = {{1},
.UID = "test1",
M module-db/tests/QueryInterface.cpp => module-db/tests/QueryInterface.cpp +2 -2
@@ 75,9 75,9 @@ TEST_CASE("Query interface")
auto msgJson = json11::Json::parse(testMessage, err);
REQUIRE(err.empty());
- Context context(msgJson);
+ parserFSM::Context context(msgJson);
auto listener = std::make_unique<db::EndpointListener>(
- [=](db::QueryResult *result, Context &context) {
+ [=](db::QueryResult *result, parserFSM::Context &context) {
if (auto SMSResult = dynamic_cast<db::query::SMSGetCountResult *>(result)) {
auto id = SMSResult->getResults();
auto body = json11::Json::object{{"count", static_cast<int>(id)}};
M module-services/service-cellular/CellularRequestHandler.cpp => module-services/service-cellular/CellularRequestHandler.cpp +2 -0
@@ 22,6 22,8 @@
#include <module-cellular/at/response.hpp>
+using namespace cellular;
+
void CellularRequestHandler::handle(ImeiRequest &request, at::Result &result)
{
if (!request.checkModemResponse(result)) {
M module-services/service-cellular/CellularUrcHandler.cpp => module-services/service-cellular/CellularUrcHandler.cpp +2 -0
@@ 11,6 11,8 @@
#include <service-evtmgr/Constants.hpp>
#include <service-appmgr/Controller.hpp>
+using namespace at::urc;
+
// this static function will be replaced by Settings API
static bool isSettingsAutomaticTimeSyncEnabled()
{
M module-services/service-cellular/CellularUrcHandler.hpp => module-services/service-cellular/CellularUrcHandler.hpp +11 -13
@@ 18,27 18,25 @@
#include <module-cellular/at/UrcResponse.hpp>
#include <module-cellular/at/UrcQiurc.hpp>
-using namespace at::urc;
-
/**
* ServiceCellular helper for handling Urc messages
*/
-class CellularUrcHandler : public UrcHandler
+class CellularUrcHandler : public at::urc::UrcHandler
{
public:
CellularUrcHandler(ServiceCellular &cellularService) : cellularService(cellularService)
{}
- void Handle(Clip &urc) final;
- void Handle(Creg &urc) final;
- void Handle(Cmti &urc) final;
- void Handle(Cusd &urc) final;
- void Handle(Ctze &urc) final;
- void Handle(Qind &urc) final;
- void Handle(Cpin &urc) final;
- void Handle(Qiurc &urc) final;
- void Handle(PoweredDown &urc) final;
- void Handle(UrcResponse &urc) final;
+ void Handle(at::urc::Clip &urc) final;
+ void Handle(at::urc::Creg &urc) final;
+ void Handle(at::urc::Cmti &urc) final;
+ void Handle(at::urc::Cusd &urc) final;
+ void Handle(at::urc::Ctze &urc) final;
+ void Handle(at::urc::Qind &urc) final;
+ void Handle(at::urc::Cpin &urc) final;
+ void Handle(at::urc::Qiurc &urc) final;
+ void Handle(at::urc::PoweredDown &urc) final;
+ void Handle(at::urc::UrcResponse &urc) final;
/**
* Gets the response that should be returned after handling Urc
M module-services/service-cellular/service-cellular/CellularRequestHandler.hpp => module-services/service-cellular/service-cellular/CellularRequestHandler.hpp +8 -10
@@ 6,21 6,19 @@
#include "RequestHandler.hpp"
#include "service-cellular/ServiceCellular.hpp"
-using namespace cellular;
-
-class CellularRequestHandler : public RequestHandler
+class CellularRequestHandler : public cellular::RequestHandler
{
public:
CellularRequestHandler(ServiceCellular &serviceCellular) : cellular(serviceCellular)
{}
- void handle(ImeiRequest &request, at::Result &result) final;
- void handle(UssdRequest &request, at::Result &result) final;
- void handle(CallRequest &request, at::Result &result) final;
- void handle(PasswordRegistrationRequest &request, at::Result &result) final;
- void handle(SupplementaryServicesRequest &request, at::Result &result) final;
- void handle(PinChangeRequest &request, at::Result &result) final;
- void handle(ClirRequest &request, at::Result &result) final;
+ void handle(cellular::ImeiRequest &request, at::Result &result) final;
+ void handle(cellular::UssdRequest &request, at::Result &result) final;
+ void handle(cellular::CallRequest &request, at::Result &result) final;
+ void handle(cellular::PasswordRegistrationRequest &request, at::Result &result) final;
+ void handle(cellular::SupplementaryServicesRequest &request, at::Result &result) final;
+ void handle(cellular::PinChangeRequest &request, at::Result &result) final;
+ void handle(cellular::ClirRequest &request, at::Result &result) final;
private:
ServiceCellular &cellular;
M module-services/service-desktop/DesktopMessages.cpp => module-services/service-desktop/DesktopMessages.cpp +1 -0
@@ 6,6 6,7 @@
namespace sdesktop::developerMode
{
+ using namespace parserFSM;
void Event::send()
{
MessageHandler::putToSendQueue(context.createSimpleResponse());
M module-services/service-desktop/endpoints/EndpointFactory.hpp => module-services/service-desktop/endpoints/EndpointFactory.hpp +13 -14
@@ 19,36 19,35 @@
#include "restore/RestoreEndpoint.hpp"
#include "update/UpdateEndpoint.hpp"
-using namespace parserFSM;
-
class EndpointFactory
{
public:
- static auto create(Context &context, sys::Service *ownerServicePtr) -> std::unique_ptr<Endpoint>
+ static auto create(parserFSM::Context &context, sys::Service *ownerServicePtr)
+ -> std::unique_ptr<parserFSM::Endpoint>
{
LOG_DEBUG("Creating endpoint: %d", static_cast<int>(context.getEndpoint()));
switch (context.getEndpoint()) {
- case EndpointType::update:
+ case parserFSM::EndpointType::update:
return std::make_unique<UpdateEndpoint>(ownerServicePtr);
- case EndpointType::filesystemUpload:
+ case parserFSM::EndpointType::filesystemUpload:
return std::make_unique<FilesystemEndpoint>(ownerServicePtr);
- case EndpointType::backup:
+ case parserFSM::EndpointType::backup:
return std::make_unique<BackupEndpoint>(ownerServicePtr);
- case EndpointType::deviceInfo:
+ case parserFSM::EndpointType::deviceInfo:
return std::make_unique<DeviceInfoEndpoint>(ownerServicePtr);
- case EndpointType::restore:
+ case parserFSM::EndpointType::restore:
return std::make_unique<RestoreEndpoint>(ownerServicePtr);
- case EndpointType::contacts:
+ case parserFSM::EndpointType::contacts:
return std::make_unique<ContactsEndpoint>(ownerServicePtr);
- case EndpointType::messages:
+ case parserFSM::EndpointType::messages:
return std::make_unique<MessagesEndpoint>(ownerServicePtr);
- case EndpointType::factory:
+ case parserFSM::EndpointType::factory:
return std::make_unique<FactoryResetEndpoint>(ownerServicePtr);
- case EndpointType::calllog:
+ case parserFSM::EndpointType::calllog:
return std::make_unique<CalllogEndpoint>(ownerServicePtr);
- case EndpointType::developerMode:
+ case parserFSM::EndpointType::developerMode:
return std::make_unique<DeveloperModeEndpoint>(ownerServicePtr);
- case EndpointType::calendarEvents:
+ case parserFSM::EndpointType::calendarEvents:
return std::make_unique<CalendarEventsEndpoint>(ownerServicePtr);
default:
return nullptr;
M module-services/service-desktop/endpoints/backup/BackupEndpoint.cpp => module-services/service-desktop/endpoints/backup/BackupEndpoint.cpp +2 -0
@@ 18,6 18,8 @@
static bool backupReady = false;
+using namespace parserFSM;
+
auto BackupEndpoint::handle(Context &context) -> void
{
switch (context.getMethod()) {
M module-services/service-desktop/endpoints/backup/BackupEndpoint.hpp => module-services/service-desktop/endpoints/backup/BackupEndpoint.hpp +4 -6
@@ 20,16 20,14 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class BackupEndpoint : public Endpoint
+class BackupEndpoint : public parserFSM::Endpoint
{
public:
BackupEndpoint(sys::Service *ownerServicePtr) : Endpoint(ownerServicePtr)
{
debugName = "BackupEndpoint";
}
- auto handle(Context &context) -> void override;
- auto request(Context &context) -> sys::ReturnCodes;
- auto upload(Context &context) -> sys::ReturnCodes;
+ auto handle(parserFSM::Context &context) -> void override;
+ auto request(parserFSM::Context &context) -> sys::ReturnCodes;
+ auto upload(parserFSM::Context &context) -> sys::ReturnCodes;
};
M module-services/service-desktop/endpoints/calendarEvents/CalendarEventsEndpoint.hpp => module-services/service-desktop/endpoints/calendarEvents/CalendarEventsEndpoint.hpp +4 -6
@@ 7,18 7,16 @@
#include "Service/Service.hpp"
#include "CalendarEventsHelper.hpp"
-using namespace parserFSM;
-
-class CalendarEventsEndpoint : public Endpoint
+class CalendarEventsEndpoint : public parserFSM::Endpoint
{
private:
std::string debugName = "CalendarEventsEndpoint";
- std::unique_ptr<CalendarEventsHelper> helper;
+ std::unique_ptr<parserFSM::CalendarEventsHelper> helper;
public:
CalendarEventsEndpoint(sys::Service *_ownerServicePtr) : Endpoint(_ownerServicePtr)
{
- helper = std::make_unique<CalendarEventsHelper>(ownerServicePtr);
+ helper = std::make_unique<parserFSM::CalendarEventsHelper>(ownerServicePtr);
}
- void handle(Context &context) override;
+ void handle(parserFSM::Context &context) override;
};
M module-services/service-desktop/endpoints/calllog/CalllogEndpoint.hpp => module-services/service-desktop/endpoints/calllog/CalllogEndpoint.hpp +4 -6
@@ 20,18 20,16 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class CalllogEndpoint : public Endpoint
+class CalllogEndpoint : public parserFSM::Endpoint
{
private:
- std::unique_ptr<CalllogHelper> helper;
+ std::unique_ptr<parserFSM::CalllogHelper> helper;
public:
CalllogEndpoint(sys::Service *_ownerServicePtr) : Endpoint(_ownerServicePtr)
{
debugName = "CalllogEndpoint";
- helper = std::make_unique<CalllogHelper>(ownerServicePtr);
+ helper = std::make_unique<parserFSM::CalllogHelper>(ownerServicePtr);
}
- auto handle(Context &context) -> void override;
+ auto handle(parserFSM::Context &context) -> void override;
};
M module-services/service-desktop/endpoints/contacts/ContactsEndpoint.hpp => module-services/service-desktop/endpoints/contacts/ContactsEndpoint.hpp +4 -6
@@ 22,18 22,16 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class ContactsEndpoint : public Endpoint
+class ContactsEndpoint : public parserFSM::Endpoint
{
private:
- std::unique_ptr<ContactHelper> helper;
+ std::unique_ptr<parserFSM::ContactHelper> helper;
public:
ContactsEndpoint(sys::Service *_ownerServicePtr) : Endpoint(_ownerServicePtr)
{
debugName = "ContactsEndpoint";
- helper = std::make_unique<ContactHelper>(ownerServicePtr);
+ helper = std::make_unique<parserFSM::ContactHelper>(ownerServicePtr);
}
- auto handle(Context &context) -> void override;
+ auto handle(parserFSM::Context &context) -> void override;
};
M module-services/service-desktop/endpoints/developerMode/DeveloperModeEndpoint.hpp => module-services/service-desktop/endpoints/developerMode/DeveloperModeEndpoint.hpp +4 -6
@@ 21,18 21,16 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class DeveloperModeEndpoint : public Endpoint
+class DeveloperModeEndpoint : public parserFSM::Endpoint
{
private:
- std::unique_ptr<DeveloperModeHelper> helper;
+ std::unique_ptr<parserFSM::DeveloperModeHelper> helper;
public:
DeveloperModeEndpoint(sys::Service *_ownerServicePtr) : Endpoint(_ownerServicePtr)
{
debugName = "DeveloperModeEndpoint";
- helper = std::make_unique<DeveloperModeHelper>(ownerServicePtr);
+ helper = std::make_unique<parserFSM::DeveloperModeHelper>(ownerServicePtr);
}
- auto handle(Context &context) -> void override;
+ auto handle(parserFSM::Context &context) -> void override;
};
M module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp => module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp +2 -0
@@ 13,6 13,8 @@
#include <cstdint>
#include <string>
+using namespace parserFSM;
+
auto DeviceInfoEndpoint::handle(Context &context) -> void
{
switch (context.getMethod()) {
M module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpoint.hpp => module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpoint.hpp +3 -5
@@ 19,9 19,7 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class DeviceInfoEndpoint : public Endpoint
+class DeviceInfoEndpoint : public parserFSM::Endpoint
{
public:
@@ 29,6 27,6 @@ class DeviceInfoEndpoint : public Endpoint
{
debugName = "DeviceInfoEndpoint";
}
- auto handle(Context &context) -> void override;
- auto getDeviceInfo(Context &context) -> bool;
+ auto handle(parserFSM::Context &context) -> void override;
+ auto getDeviceInfo(parserFSM::Context &context) -> bool;
};
M module-services/service-desktop/endpoints/factoryReset/FactoryResetEndpoint.cpp => module-services/service-desktop/endpoints/factoryReset/FactoryResetEndpoint.cpp +3 -3
@@ 13,7 13,7 @@
#include <memory>
-auto FactoryResetEndpoint::handle(Context &context) -> void
+auto FactoryResetEndpoint::handle(parserFSM::Context &context) -> void
{
if (context.getMethod() == parserFSM::http::Method::post) {
@@ 27,14 27,14 @@ auto FactoryResetEndpoint::handle(Context &context) -> void
context.setResponseBody(json11::Json::object({{parserFSM::json::factoryRequest, false}}));
}
- MessageHandler::putToSendQueue(context.createSimpleResponse());
+ parserFSM::MessageHandler::putToSendQueue(context.createSimpleResponse());
return;
}
else {
context.setResponseBody(json11::Json::object({{parserFSM::json::factoryRequest, false}}));
- MessageHandler::putToSendQueue(context.createSimpleResponse());
+ parserFSM::MessageHandler::putToSendQueue(context.createSimpleResponse());
return;
}
M module-services/service-desktop/endpoints/factoryReset/FactoryResetEndpoint.hpp => module-services/service-desktop/endpoints/factoryReset/FactoryResetEndpoint.hpp +3 -5
@@ 19,9 19,7 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class FactoryResetEndpoint : public Endpoint
+class FactoryResetEndpoint : public parserFSM::Endpoint
{
public:
@@ 29,6 27,6 @@ class FactoryResetEndpoint : public Endpoint
{
debugName = "FactoryResetEndpoint";
}
- auto handle(Context &context) -> void override;
- auto makeFactoryReset(Context &context) -> bool;
+ auto handle(parserFSM::Context &context) -> void override;
+ auto makeFactoryReset(parserFSM::Context &context) -> bool;
};
M module-services/service-desktop/endpoints/filesystem/FilesystemEndpoint.cpp => module-services/service-desktop/endpoints/filesystem/FilesystemEndpoint.cpp +3 -1
@@ 6,6 6,8 @@
#include "service-desktop/ServiceDesktop.hpp"
#include <purefs/filesystem_paths.hpp>
+using namespace parserFSM;
+
auto FilesystemEndpoint::handle(Context &context) -> void
{
LOG_DEBUG("handle");
@@ 68,4 70,4 @@ auto FilesystemEndpoint::run(Context &context) -> sys::ReturnCodes
MessageHandler::putToSendQueue(context.createSimpleResponse());
return returnCode;
-}>
\ No newline at end of file
+}
M module-services/service-desktop/endpoints/filesystem/FilesystemEndpoint.hpp => module-services/service-desktop/endpoints/filesystem/FilesystemEndpoint.hpp +4 -6
@@ 6,14 6,12 @@
#include <module-services/service-desktop/endpoints/Endpoint.hpp>
#include "Service/Service.hpp"
-using namespace parserFSM;
-
-class FilesystemEndpoint : public Endpoint
+class FilesystemEndpoint : public parserFSM::Endpoint
{
public:
FilesystemEndpoint(sys::Service *ownerServicePtr) : Endpoint(ownerServicePtr)
{}
- auto handle(Context &context) -> void override;
- auto run(Context &context) -> sys::ReturnCodes;
- auto getUpdates(Context &context) -> sys::ReturnCodes;
+ auto handle(parserFSM::Context &context) -> void override;
+ auto run(parserFSM::Context &context) -> sys::ReturnCodes;
+ auto getUpdates(parserFSM::Context &context) -> sys::ReturnCodes;
};
M module-services/service-desktop/endpoints/messages/MessagesEndpoint.hpp => module-services/service-desktop/endpoints/messages/MessagesEndpoint.hpp +4 -6
@@ 21,18 21,16 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class MessagesEndpoint : public Endpoint
+class MessagesEndpoint : public parserFSM::Endpoint
{
private:
- std::shared_ptr<MessageHelper> helper;
+ std::shared_ptr<parserFSM::MessageHelper> helper;
public:
MessagesEndpoint(sys::Service *_ownerServicePtr) : Endpoint(_ownerServicePtr)
{
debugName = "MessagesEndpoint";
- helper = std::make_shared<MessageHelper>(ownerServicePtr);
+ helper = std::make_shared<parserFSM::MessageHelper>(ownerServicePtr);
}
- auto handle(Context &context) -> void override;
+ auto handle(parserFSM::Context &context) -> void override;
};
M module-services/service-desktop/endpoints/restore/RestoreEndpoint.cpp => module-services/service-desktop/endpoints/restore/RestoreEndpoint.cpp +2 -0
@@ 14,6 14,8 @@
#include <memory>
+using namespace parserFSM;
+
auto RestoreEndpoint::handle(Context &context) -> void
{
if (context.getMethod() == parserFSM::http::Method::post) {
M module-services/service-desktop/endpoints/restore/RestoreEndpoint.hpp => module-services/service-desktop/endpoints/restore/RestoreEndpoint.hpp +2 -4
@@ 16,14 16,12 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class RestoreEndpoint : public Endpoint
+class RestoreEndpoint : public parserFSM::Endpoint
{
public:
RestoreEndpoint(sys::Service *ownerServicePtr) : Endpoint(ownerServicePtr)
{
debugName = "RestoreEndpoint";
}
- auto handle(Context &context) -> void override;
+ auto handle(parserFSM::Context &context) -> void override;
};
M module-services/service-desktop/endpoints/update/UpdateEndpoint.cpp => module-services/service-desktop/endpoints/update/UpdateEndpoint.cpp +2 -0
@@ 17,6 17,8 @@
#include <filesystem>
#include <memory>
+using namespace parserFSM;
+
auto UpdateEndpoint::handle(Context &context) -> void
{
switch (context.getMethod()) {
M module-services/service-desktop/endpoints/update/UpdateEndpoint.hpp => module-services/service-desktop/endpoints/update/UpdateEndpoint.hpp +4 -6
@@ 20,9 20,7 @@ namespace sys
class Service;
} // namespace sys
-using namespace parserFSM;
-
-class UpdateEndpoint : public Endpoint
+class UpdateEndpoint : public parserFSM::Endpoint
{
public:
@@ 30,7 28,7 @@ class UpdateEndpoint : public Endpoint
{
debugName = "UpdateEndpoint";
}
- auto handle(Context &context) -> void override;
- auto run(Context &context) -> sys::ReturnCodes;
- auto getUpdates(Context &context) -> sys::ReturnCodes;
+ auto handle(parserFSM::Context &context) -> void override;
+ auto run(parserFSM::Context &context) -> sys::ReturnCodes;
+ auto getUpdates(parserFSM::Context &context) -> sys::ReturnCodes;
};
M module-services/service-desktop/service-desktop/DesktopMessages.hpp => module-services/service-desktop/service-desktop/DesktopMessages.hpp +1 -1
@@ 71,7 71,7 @@ namespace sdesktop
class Event
{
protected:
- Context context;
+ parserFSM::Context context;
public:
void send();
M module-services/service-fota/FotaUrcHandler.cpp => module-services/service-fota/FotaUrcHandler.cpp +2 -0
@@ 3,6 3,8 @@
#include "FotaUrcHandler.hpp"
+using namespace at::urc;
+
void FotaUrcHandler::Handle(Qind &urc)
{
if (urc.isFotaValid()) {
M module-services/service-fota/FotaUrcHandler.hpp => module-services/service-fota/FotaUrcHandler.hpp +11 -13
@@ 8,27 8,25 @@
#include <module-cellular/at/UrcHandler.hpp>
#include <module-cellular/at/UrcQind.hpp>
-using namespace at::urc;
-
/**
* ServiceFota helper for handling Urc messages
*/
-class FotaUrcHandler : public UrcHandler
+class FotaUrcHandler : public at::urc::UrcHandler
{
public:
FotaUrcHandler(FotaService::Service &fotaService) : fotaService(fotaService)
{}
- void Handle(Qind &urc) final;
- virtual void Handle(Clip &urc){};
- virtual void Handle(Creg &urc){};
- virtual void Handle(Cmti &urc){};
- virtual void Handle(Cusd &urc){};
- virtual void Handle(Ctze &urc){};
- virtual void Handle(Cpin &urc){};
- virtual void Handle(Qiurc &urc){};
- virtual void Handle(PoweredDown &urc){};
- virtual void Handle(UrcResponse &urc){};
+ void Handle(at::urc::Qind &urc) final;
+ virtual void Handle(at::urc::Clip &urc){};
+ virtual void Handle(at::urc::Creg &urc){};
+ virtual void Handle(at::urc::Cmti &urc){};
+ virtual void Handle(at::urc::Cusd &urc){};
+ virtual void Handle(at::urc::Ctze &urc){};
+ virtual void Handle(at::urc::Cpin &urc){};
+ virtual void Handle(at::urc::Qiurc &urc){};
+ virtual void Handle(at::urc::PoweredDown &urc){};
+ virtual void Handle(at::urc::UrcResponse &urc){};
private:
FotaService::Service &fotaService;
M module-services/service-time/service-time/CalendarTimeEvents.hpp => module-services/service-time/service-time/CalendarTimeEvents.hpp +1 -1
@@ 27,7 27,7 @@ namespace stm
{
private:
EventsRecord eventRecord;
- TimePoint startTP = TIME_POINT_INVALID;
+ calendar::TimePoint startTP = TIME_POINT_INVALID;
protected:
const std::string timerName() override
M module-services/service-time/timeEvents/CalendarTimeEvents.cpp => module-services/service-time/timeEvents/CalendarTimeEvents.cpp +4 -3
@@ 29,6 29,7 @@ namespace sys
namespace stm
{
+ using namespace std::chrono_literals;
constexpr static auto eventTimerMinSkipInterval = 100ms;
CalendarTimeEvents::CalendarTimeEvents(sys::Service *service) : TimeEvents(service)
@@ 36,8 37,8 @@ namespace stm
bool CalendarTimeEvents::sendNextEventQuery()
{
- TimePoint filterFrom = TimePointNow();
- TimePoint filterTill = filterFrom;
+ calendar::TimePoint filterFrom = TimePointNow();
+ calendar::TimePoint filterTill = filterFrom;
if (startTP != TIME_POINT_INVALID) {
filterFrom = std::min(startTP, filterFrom);
filterTill = filterFrom;
@@ 64,7 65,7 @@ namespace stm
}
eventRecord = records.at(0);
- startTP = eventRecord.date_from - minutes{eventRecord.reminder};
+ startTP = eventRecord.date_from - std::chrono::minutes{eventRecord.reminder};
auto duration = eventRecord.date_from - std::chrono::minutes{eventRecord.reminder} - TimePointNow();
if (duration.count() <= 0) {
duration = std::chrono::milliseconds(eventTimerMinSkipInterval);
M module-sys/SystemManager/SystemManager.cpp => module-sys/SystemManager/SystemManager.cpp +2 -2
@@ 116,7 116,7 @@ namespace sys
// pingPongTimerID = CreateTimer(Ticks::MsToTicks(pingInterval), true);
// ReloadTimer(pingPongTimerID);
- cpuStatisticsTimer = std::make_unique<sys::Timer>("cpuStatistics", this, timerInitInterval.count());
+ cpuStatisticsTimer = std::make_unique<sys::Timer>("cpuStatistics", this, constants::timerInitInterval.count());
cpuStatisticsTimer->connect([&](sys::Timer &) { CpuStatisticsTimerHandler(); });
cpuStatisticsTimer->start();
}
@@ 354,7 354,7 @@ namespace sys
{
if (!cpuStatisticsTimerInit) {
cpuStatisticsTimerInit = true;
- cpuStatisticsTimer->setInterval(timerPeriodInterval.count());
+ cpuStatisticsTimer->setInterval(constants::timerPeriodInterval.count());
}
cpuStatistics->Update();
M module-sys/SystemManager/SystemManager.hpp => module-sys/SystemManager/SystemManager.hpp +6 -3
@@ 26,9 26,12 @@
namespace sys
{
- using namespace std::chrono_literals;
- inline constexpr std::chrono::milliseconds timerInitInterval{30s};
- inline constexpr std::chrono::milliseconds timerPeriodInterval{100ms};
+ namespace constants
+ {
+ using namespace std::chrono_literals;
+ inline constexpr std::chrono::milliseconds timerInitInterval{30s};
+ inline constexpr std::chrono::milliseconds timerPeriodInterval{100ms};
+ } // namespace constants
enum class Code
{
M module-utils/ical/ParserICS.cpp => module-utils/ical/ParserICS.cpp +8 -5
@@ 446,7 446,7 @@ auto Event::timeStringFrom(const std::string &icalTime) const -> std::string
getSecondsFromIcalTime(icalTime);
}
-auto Event::TimePointFromIcalDate(const std::string &icalDateTime) const -> TimePoint
+auto Event::TimePointFromIcalDate(const std::string &icalDateTime) const -> calendar::TimePoint
{
std::string icalDate(getDateFromIcalFormat(icalDateTime));
std::string icalTime(getTimeFromIcalFormat(icalDateTime));
@@ 459,7 459,7 @@ auto Event::TimePointFromIcalDate(const std::string &icalDateTime) const -> Time
return TimePointFromString(dateTime.c_str());
}
-auto Event::TimePointToIcalDate(const TimePoint &tp) const -> std::string
+auto Event::TimePointToIcalDate(const calendar::TimePoint &tp) const -> std::string
{
constexpr uint32_t bufferLimit = 16;
auto time = TimePointToTimeT(tp);
@@ 541,7 541,10 @@ auto Event::validateUID(const std::string &UID) -> bool
return validateDT(DTimestamp);
}
-Event::Event(const std::string &summary, const TimePoint from, TimePoint till, const std::string &uid)
+Event::Event(const std::string &summary,
+ const calendar::TimePoint from,
+ calendar::TimePoint till,
+ const std::string &uid)
{
if (summary.empty()) {
isValid = false;
@@ 595,12 598,12 @@ auto Event::getSummary() const -> std::string
return summary;
}
-auto Event::getDTStartTimePoint() const -> TimePoint
+auto Event::getDTStartTimePoint() const -> calendar::TimePoint
{
return dtstart;
}
-auto Event::getDTEndTimePoint() const -> TimePoint
+auto Event::getDTEndTimePoint() const -> calendar::TimePoint
{
return dtend;
}
M module-utils/ical/ParserICS.hpp => module-utils/ical/ParserICS.hpp +7 -7
@@ 91,8 91,8 @@ class Event
{
std::string uid;
std::string summary;
- TimePoint dtstart;
- TimePoint dtend;
+ calendar::TimePoint dtstart;
+ calendar::TimePoint dtend;
auto isDate(const std::string &dt) -> bool;
auto isTime(const std::string &dt) -> bool;
@@ 112,13 112,13 @@ class Event
[[nodiscard]] auto dateStringFrom(const std::string &icalDate) const -> std::string;
[[nodiscard]] auto timeStringFrom(const std::string &icalTime) const -> std::string;
- [[nodiscard]] auto TimePointFromIcalDate(const std::string &icalDateTime) const -> TimePoint;
- [[nodiscard]] auto TimePointToIcalDate(const TimePoint &tp) const -> std::string;
+ [[nodiscard]] auto TimePointFromIcalDate(const std::string &icalDateTime) const -> calendar::TimePoint;
+ [[nodiscard]] auto TimePointToIcalDate(const calendar::TimePoint &tp) const -> std::string;
public:
bool isValid = true;
Event() = default;
- Event(const std::string &summary, TimePoint from, TimePoint till, const std::string &uid);
+ Event(const std::string &summary, calendar::TimePoint from, calendar::TimePoint till, const std::string &uid);
void setUID(const std::string &property);
void setSummary(const std::string &property);
@@ 127,8 127,8 @@ class Event
[[nodiscard]] auto getUID() const -> std::string;
[[nodiscard]] auto getSummary() const -> std::string;
- [[nodiscard]] auto getDTStartTimePoint() const -> TimePoint;
- [[nodiscard]] auto getDTEndTimePoint() const -> TimePoint;
+ [[nodiscard]] auto getDTStartTimePoint() const -> calendar::TimePoint;
+ [[nodiscard]] auto getDTEndTimePoint() const -> calendar::TimePoint;
[[nodiscard]] auto getDTStartString() const -> std::string;
[[nodiscard]] auto getDTEndString() const -> std::string;
M module-utils/time/TimeRangeParser.cpp => module-utils/time/TimeRangeParser.cpp +2 -2
@@ 19,8 19,8 @@ namespace utils::time
return utils::localize.get(utils::time::Locale::getPM());
}
- std::string TimeRangeParser::getCalendarTimeString(TimePoint startDate,
- TimePoint endDate,
+ std::string TimeRangeParser::getCalendarTimeString(calendar::TimePoint startDate,
+ calendar::TimePoint endDate,
Version version,
bool isMode24H)
{
M module-utils/time/TimeRangeParser.hpp => module-utils/time/TimeRangeParser.hpp +2 -2
@@ 20,8 20,8 @@ namespace utils::time
std::string AMPMtoString(bool isAm);
public:
- std::string getCalendarTimeString(TimePoint startDate,
- TimePoint endDate,
+ std::string getCalendarTimeString(calendar::TimePoint startDate,
+ calendar::TimePoint endDate,
Version version = Version::normal,
bool isMode24H = false);
};