| [d83a844] | 1 | /*
|
|---|
| 2 | Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 3 |
|
|---|
| 4 | This library is free software; you can redistribute it and/or
|
|---|
| 5 | modify it under the terms of the GNU Lesser General Public
|
|---|
| 6 | License as published by the Free Software Foundation; either
|
|---|
| 7 | version 2.1 of the License, or (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This library is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 12 | Lesser General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU Lesser General Public
|
|---|
| 15 | License along with this library; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|---|
| 17 | MA 02110-1301 USA.
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | #include "siweatherstation.h"
|
|---|
| 21 |
|
|---|
| 22 | using namespace SiWeather::Library;
|
|---|
| 23 |
|
|---|
| 24 | SiWeatherStation::SiWeatherStation()
|
|---|
| 25 | {
|
|---|
| 26 | init();
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | SiWeatherStation::SiWeatherStation(const QString &uuid, const QString &name)
|
|---|
| 30 | {
|
|---|
| 31 | init();
|
|---|
| 32 | setUuid(uuid);
|
|---|
| 33 | setName(name);
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | void SiWeatherStation::setUuid(const QString &uuid)
|
|---|
| 37 | {
|
|---|
| 38 | _uuid = QUuid(uuid);
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | QUuid SiWeatherStation::uuid() const
|
|---|
| 42 | {
|
|---|
| 43 | return _uuid;
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | void SiWeatherStation::setName(const QString &name)
|
|---|
| 47 | {
|
|---|
| 48 | _name = name;
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | QString SiWeatherStation::name() const
|
|---|
| 52 | {
|
|---|
| 53 | return _name;
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | void SiWeatherStation::setCity(const QString &city)
|
|---|
| 57 | {
|
|---|
| 58 | _city = city;
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | QString SiWeatherStation::city() const
|
|---|
| 62 | {
|
|---|
| 63 | return _city;
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | void SiWeatherStation::setLongitude(double longitude)
|
|---|
| 67 | {
|
|---|
| 68 | _longitude = longitude;
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | double SiWeatherStation::longitude() const
|
|---|
| 72 | {
|
|---|
| 73 | return _longitude;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | void SiWeatherStation::setLatitude(double latitude)
|
|---|
| 77 | {
|
|---|
| 78 | _latitude = latitude;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | double SiWeatherStation::latitude() const
|
|---|
| 82 | {
|
|---|
| 83 | return _latitude;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | void SiWeatherStation::setType(const QString &type)
|
|---|
| 87 | {
|
|---|
| 88 | _type = type;
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | QString SiWeatherStation::type() const
|
|---|
| 92 | {
|
|---|
| 93 | return _type;
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | void SiWeatherStation::setTypeUrl(const QString &typeUrl)
|
|---|
| 97 | {
|
|---|
| 98 | _typeUrl = QUrl(typeUrl);
|
|---|
| 99 | }
|
|---|
| 100 |
|
|---|
| 101 | QUrl SiWeatherStation::typeUrl() const
|
|---|
| 102 | {
|
|---|
| 103 | return _typeUrl;
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | void SiWeatherStation::setEMail(const QString &address)
|
|---|
| 107 | {
|
|---|
| 108 | _eMail = address;
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | QString SiWeatherStation::eMail() const
|
|---|
| 112 | {
|
|---|
| 113 | return _eMail;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| [93ea008] | 116 |
|
|---|
| 117 | bool SiWeatherStation::isValidForRegister() const
|
|---|
| 118 | {
|
|---|
| 119 | if(_name.isEmpty())
|
|---|
| 120 | return false;
|
|---|
| 121 | if(_city.isEmpty())
|
|---|
| 122 | return false;
|
|---|
| 123 | if(_eMail.isEmpty())
|
|---|
| 124 | return false;
|
|---|
| 125 | if(_type.isEmpty())
|
|---|
| 126 | return false;
|
|---|
| 127 | return true;
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| [d83a844] | 130 | void SiWeatherStation::init()
|
|---|
| 131 | {
|
|---|
| 132 | _longitude = 0;
|
|---|
| 133 | _latitude = 0;
|
|---|
| 134 | }
|
|---|