Leosac  0.8.0
Open Source Access Control
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 
51 
52  int64_t default_blink_speed() const;
53 
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
Leosac::Hardware::GPIOPtr
std::shared_ptr< GPIO > GPIOPtr
Definition: HardwareFwd.hpp:58
Leosac::Hardware::LED::gpio
const GPIOPtr & gpio() const
Definition: LED.cpp:38
Leosac::Hardware::LED::default_blink_speed
int64_t default_blink_speed() const
Definition: LED.cpp:58
Leosac::Hardware::LED::validation_callback
void validation_callback(odb::callback_event e, odb::database &) const override
Definition: LED.cpp:33
Leosac::Hardware::Device
Base class for hardware devices.
Definition: Device.hpp:44
Device.hpp
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Hardware::LED::default_blink_duration_
int64_t default_blink_duration_
Definition: LED.hpp:57
Leosac::Hardware::LED::gpio_
GPIOPtr gpio_
The underlying GPIO.
Definition: LED.hpp:63
Leosac::Hardware::LED::default_blink_duration
int64_t default_blink_duration() const
Definition: LED.cpp:48
GPIO.hpp
Leosac::Hardware::LED::default_blink_speed_
int64_t default_blink_speed_
Definition: LED.hpp:58
HardwareFwd.hpp
Leosac::Hardware::LED
Abstraction of LED device attributes.
Definition: LED.hpp:36
Leosac::Hardware::LED::LED
LED()
Definition: LED.cpp:28
Leosac::Hardware::LED::~LED
virtual ~LED()=default