RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
RumPiConfig.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include "../json.hpp"
4
5namespace RumPi
6{
17 {
18 private:
21
24
26 unsigned int myReceiverPort;
27
30
33
36
39
42
55 void SetDefaults();
56
57 public:
70
93 bool LoadFromJson(const nlohmann::json& configJson);
94
95 //Getters
109 unsigned int GetUpdateDelayMilliseconds() const;
110
127 bool GetReceiverEnabled() const;
128
142 unsigned int GetReceiverPort() const;
143
157 float GetLightCutoffDark() const;
158
172 float GetLightCutoffVeryDim() const;
173
187 float GetLightCutoffDim() const;
188
202 float GetLightCutoffNormal() const;
203
217 float GetLightCutoffBright() const;
218
219 //Setters
233 void SetUpdateDelayMilliseconds(unsigned int updateDelayMilliseconds);
234
248 void SetReceiverEnabled(bool receiverEnabled);
249
263 void SetReceiverPort(unsigned int receiverPort);
264
278 void SetLightCutoffDark(float lightCutoffDark);
279
293 void SetLightCutoffVeryDim(float lightCutoffVeryDim);
294
308 void SetLightCutoffDim(float lightCutoffDim);
309
323 void SetLightCutoffNormal(float lightCutoffNormal);
324
338 void SetLightCutoffBright(float lightCutoffBright);
339 };
340} // namespace RumPi
Holds the library's runtime configuration, loaded from a JSON file.
Definition: RumPiConfig.h:17
float GetLightCutoffBright() const
Gets the lux boundary for the "bright" light-level bucket.
Definition: RumPiConfig.cpp:285
float myLightCutoffNormal
Lux boundary for the "normal" bucket.
Definition: RumPiConfig.h:38
float myLightCutoffBright
Lux boundary for the "bright" bucket.
Definition: RumPiConfig.h:41
bool myReceiverEnabled
Whether the remote-client receiver is started during Initialize().
Definition: RumPiConfig.h:23
void SetLightCutoffDark(float lightCutoffDark)
Sets the lux boundary for the "dark" light-level bucket.
Definition: RumPiConfig.cpp:357
void SetReceiverPort(unsigned int receiverPort)
Sets the TCP port the receiver listens on.
Definition: RumPiConfig.cpp:339
void SetLightCutoffBright(float lightCutoffBright)
Sets the lux boundary for the "bright" light-level bucket.
Definition: RumPiConfig.cpp:429
unsigned int GetReceiverPort() const
Gets the TCP port the receiver listens on.
Definition: RumPiConfig.cpp:195
void SetLightCutoffDim(float lightCutoffDim)
Sets the lux boundary for the "dim" light-level bucket.
Definition: RumPiConfig.cpp:393
void SetDefaults()
Sets every configuration value to its built-in default.
Definition: RumPiConfig.cpp:36
bool LoadFromJson(const nlohmann::json &configJson)
Loads settings from an already-parsed config JSON over the current values, so any key missing from th...
Definition: RumPiConfig.cpp:71
void SetLightCutoffNormal(float lightCutoffNormal)
Sets the lux boundary for the "normal" light-level bucket.
Definition: RumPiConfig.cpp:411
float myLightCutoffDim
Lux boundary for the "dim" bucket.
Definition: RumPiConfig.h:35
float myLightCutoffVeryDim
Lux boundary for the "very dim" bucket.
Definition: RumPiConfig.h:32
float GetLightCutoffVeryDim() const
Gets the lux boundary for the "very dim" light-level bucket.
Definition: RumPiConfig.cpp:231
RumPiConfig()
Builds a configuration with every value set to its built-in default.
Definition: RumPiConfig.cpp:19
unsigned int myReceiverPort
TCP port the receiver listens on (1-65535).
Definition: RumPiConfig.h:26
float GetLightCutoffNormal() const
Gets the lux boundary for the "normal" light-level bucket.
Definition: RumPiConfig.cpp:267
float myLightCutoffDark
Lux boundary below which the light level is considered "dark" (the buckets ascend from here).
Definition: RumPiConfig.h:29
unsigned int myUpdateDelayMilliseconds
How long the update loop waits between sensor polls, in milliseconds.
Definition: RumPiConfig.h:20
bool GetReceiverEnabled() const
Gets whether the remote-client receiver should be started.
Definition: RumPiConfig.cpp:177
float GetLightCutoffDim() const
Gets the lux boundary for the "dim" light-level bucket.
Definition: RumPiConfig.cpp:249
void SetLightCutoffVeryDim(float lightCutoffVeryDim)
Sets the lux boundary for the "very dim" light-level bucket.
Definition: RumPiConfig.cpp:375
unsigned int GetUpdateDelayMilliseconds() const
Gets the update-loop delay between sensor polls, in milliseconds.
Definition: RumPiConfig.cpp:156
void SetUpdateDelayMilliseconds(unsigned int updateDelayMilliseconds)
Sets the update-loop delay between sensor polls, in milliseconds.
Definition: RumPiConfig.cpp:303
void SetReceiverEnabled(bool receiverEnabled)
Sets whether the remote-client receiver should be started.
Definition: RumPiConfig.cpp:321
float GetLightCutoffDark() const
Gets the lux boundary for the "dark" light-level bucket.
Definition: RumPiConfig.cpp:213
RumPi is the library's top-level facade.
Definition: AlertManager.h:6