1 //******************************************************************
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #include "ActionSet.h"
26 Time::Time() : mTime()
28 setTime(0, 0, 0, 0, 0, 0, 0);
35 void Time::setTime(OCTime t)
39 void Time::setTime(unsigned int yy, unsigned int mm, unsigned int dd,
40 unsigned int h, unsigned int m, unsigned int s,
44 mTime.tm_year = (int)yy - 1900;
45 mTime.tm_mon = (int)mm - 1;
52 mTime.tm_wday = (unsigned int) dayoftheweek;
55 void Time::setDayOfWeekForRecursive(int day)
62 setTime(0, 0, 0, 0, 0, 0, day);
64 unsigned int Time::getYear()
68 unsigned int Time::getMonth()
72 unsigned int Time::getDay()
76 unsigned int Time::getHour()
80 unsigned int Time::getMin()
84 unsigned int Time::getSec()
88 long int Time::getSecondsFromAbsoluteTime()
90 if(mTime.tm_year > 1900)
91 mTime.tm_year -= 1900;
95 return getSecondsFromAbsTime(&mTime);
97 long int Time::getSecAbsTime()
99 return getSeconds(&mTime);
101 long int Time::getSecondsForWeeklySchedule()
103 if(mTime.tm_year > 1900)
104 mTime.tm_year -= 1900;
107 return getRelativeIntervalOfWeek(&mTime);
110 void Time::setDelay(long int seconds)
118 std::string Time::toString() const
120 char temp[25] = { 0 };
121 // It is shown format which required of scheduled/recursive group action time.
122 // " [delay] [type of actionset] "
123 snprintf(temp, sizeof(temp) / sizeof(char),
124 "%ld %d", mDelay, (unsigned int) type);
125 return std::string(temp);
143 listOfCapability.clear();
154 ActionSet::ActionSet() :
158 ActionSet::~ActionSet()
160 listOfAction.clear();