Leosac  0.7.0
OpenSourceAccessControl
LED.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2017 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "hardware/Device.hpp"
23 #include "hardware/HardwareFwd.hpp"
24 #include <odb/callback.hxx>
25 #include <odb/core.hxx>
26 
27 namespace Leosac
28 {
29 namespace Hardware
30 {
31 
35 #pragma db object callback(validation_callback) table("HARDWARE_LED")
36 class LED : public Device
37 {
38  public:
39  explicit LED();
40  virtual ~LED() = default;
41 
42  void validation_callback(odb::callback_event e, odb::database &) const override;
43 
44  const GPIOPtr &gpio() const;
45 
46  void gpio(const GPIOPtr &gpio);
47 
48  int64_t default_blink_duration() const;
49 
50  void default_blink_duration(int64_t default_blink_duration);
51 
52  int64_t default_blink_speed() const;
53 
54  void default_blink_speed(int64_t default_blink_speed);
55 
56  private:
59 
64 
65 
66  private:
67  friend odb::access;
68 };
69 }
70 }
71 
72 #ifdef ODB_COMPILER
73 #include "hardware/GPIO.hpp"
74 #endif
void validation_callback(odb::callback_event e, odb::database &) const override
Definition: LED.cpp:33
std::shared_ptr< GPIO > GPIOPtr
Definition: HardwareFwd.hpp:55
This is the header file for a generated source file, GitSHA1.cpp.
virtual ~LED()=default
int64_t default_blink_speed_
Definition: LED.hpp:58
const GPIOPtr & gpio() const
Definition: LED.cpp:38
int64_t default_blink_speed() const
Definition: LED.cpp:58
Base class for hardware devices.
Definition: Device.hpp:44
int64_t default_blink_duration_
Definition: LED.hpp:57
int64_t default_blink_duration() const
Definition: LED.cpp:48
Abstraction of LED device attributes.
Definition: LED.hpp:36
GPIOPtr gpio_
The underlying GPIO.
Definition: LED.hpp:63