kurtis.heimerl | 8aea56e | 2011-11-26 03:18:30 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Written by Thomas Tsou <ttsou@vt.edu> |
| 3 | * Based on code by Harvind S Samra <hssamra@kestrelsp.com> |
| 4 | * |
| 5 | * Copyright 2011 Free Software Foundation, Inc. |
| 6 | * |
| 7 | * This program is free software: you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU Affero General Public License as published by |
| 9 | * the Free Software Foundation, either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU Affero General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Affero General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | * See the COPYING file in the main directory for details. |
| 20 | */ |
| 21 | |
| 22 | #include "radioClock.h" |
| 23 | |
| 24 | void RadioClock::set(const GSM::Time& wTime) |
| 25 | { |
| 26 | mLock.lock(); |
| 27 | mClock = wTime; |
| 28 | updateSignal.signal(); |
| 29 | mLock.unlock(); |
| 30 | } |
| 31 | |
| 32 | void RadioClock::incTN() |
| 33 | { |
| 34 | mLock.lock(); |
| 35 | mClock.incTN(); |
| 36 | updateSignal.signal(); |
| 37 | mLock.unlock(); |
| 38 | } |
| 39 | |
| 40 | GSM::Time RadioClock::get() |
| 41 | { |
| 42 | mLock.lock(); |
| 43 | GSM::Time retVal = mClock; |
| 44 | mLock.unlock(); |
| 45 | |
| 46 | return retVal; |
| 47 | } |
| 48 | |
| 49 | void RadioClock::wait() |
| 50 | { |
| 51 | mLock.lock(); |
| 52 | updateSignal.wait(mLock,1); |
| 53 | mLock.unlock(); |
| 54 | } |