2 * Samsung Ukraine R&D Center (SRK under a contract between)
3 * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
4 * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
8 * @brief Application settings
9 * @date Created Feb 14, 2018
10 * @author Mail to: <A HREF="mailto:d.lomtev@samsung.com">Dmytro Lomtev, d.lomtev@samsung.com</A>
18 namespace NetworkManager
22 * @brief The Settings class reprensents application settings
28 static Settings& instance()
34 * @brief getServerAddress returns the address of the DSM server
35 * @return URL as string
37 const std::string& getServerAddress() const
43 * @brief getDeviceId returns the device identifier
44 * @return the device indentifier as string
46 const std::string& getDeviceId() const
52 * @brief getKeepAliveTimeout returns KeepAlive timeout period
53 * @return KeepAlive timeout period
55 const std::chrono::milliseconds& getKeepAliveTimeout() const
57 return keepAliveTimeout;
61 * @brief setServerAddress sets the address of the DSM server
62 * @param address DSM server URL
64 void setServerAddress(const std::string& address)
66 serverAddress = address;
70 * @brief setDeviceId sets the device identifier
71 * @param id the device identifier
73 void setDeviceId(const std::string& id)
79 * @brief setKeepAliveTimeout sets KeepAlive timeout period
80 * @param keepalive KeepAlive timeout period
82 void setKeepAliveTimeout(const std::chrono::milliseconds& keepalive)
84 keepAliveTimeout = keepalive;
88 * @brief setLock sets lock state
89 * @param locked lock state to set
91 void setLock(bool locked)
97 * @brief loadDefaults loads default settings from the default configuration file
98 * @return true if successfully loaded and false otherwise
103 * @brief load loads settings from the configuration file
104 * @return true if successfully loaded and false otherwise
109 * @brief save saves settings to the file
110 * @return true if successfully saved and false otherwise
115 * @brief setSaveFileName sets the file path used to store settings
116 * @param fileName path to the file
118 void setSaveFileName(const std::string& fileName)
120 saveFileName = fileName;
124 * @brief getSaveFileName return the path of the file used to store settings
127 const std::string& getSaveFileName() const
133 * @brief isLoaded returns settings load state
134 * @return true if settings are loaded and false otherwise
136 bool isLoaded() const
142 * @brief isLocked return lock state
145 bool isLocked() const
153 * @brief Settings default constructor
157 bool _load(const std::string& fileName);
159 std::string serverAddress;
160 std::string deviceId;
161 std::chrono::milliseconds keepAliveTimeout;
162 std::string saveFileName;
165 static Settings _instance;
168 } // namespace NetworkManager