Leosac  0.8.0
Open Source Access Control
Buzzer.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 
41 #pragma db object callback(validation_callback) table("HARDWARE_BUZZER")
42 class Buzzer : public Device
43 {
44  public:
45  explicit Buzzer();
46  virtual ~Buzzer() = default;
47 
48  void validation_callback(odb::callback_event e, odb::database &) const override;
49 
50  const GPIOPtr &gpio() const;
51 
52  void gpio(const GPIOPtr &gpio);
53 
54  int64_t default_blink_duration() const;
55 
57 
58  int64_t default_blink_speed() const;
59 
61 
62  private:
65 
70  friend odb::access;
71 };
72 }
73 }
74 
75 #ifdef ODB_COMPILER
76 #include "hardware/GPIO.hpp"
77 #endif
Leosac::Hardware::Buzzer::default_blink_speed_
int64_t default_blink_speed_
Definition: Buzzer.hpp:64
Leosac::Hardware::GPIOPtr
std::shared_ptr< GPIO > GPIOPtr
Definition: HardwareFwd.hpp:58
Leosac::Hardware::Buzzer::Buzzer
Buzzer()
Definition: Buzzer.cpp:28
Leosac::Hardware::Buzzer::validation_callback
void validation_callback(odb::callback_event e, odb::database &) const override
Definition: Buzzer.cpp:33
Leosac::Hardware::Device
Base class for hardware devices.
Definition: Device.hpp:44
Device.hpp
Leosac::Hardware::Buzzer::~Buzzer
virtual ~Buzzer()=default
Leosac::Hardware::Buzzer::gpio
const GPIOPtr & gpio() const
Definition: Buzzer.cpp:38
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Hardware::Buzzer::default_blink_speed
int64_t default_blink_speed() const
Definition: Buzzer.cpp:58
GPIO.hpp
HardwareFwd.hpp
Leosac::Hardware::Buzzer::default_blink_duration_
int64_t default_blink_duration_
Definition: Buzzer.hpp:63
Leosac::Hardware::Buzzer::default_blink_duration
int64_t default_blink_duration() const
Definition: Buzzer.cpp:48
Leosac::Hardware::Buzzer
Abstraction of Buzzer device attributes.
Definition: Buzzer.hpp:42
Leosac::Hardware::Buzzer::gpio_
GPIOPtr gpio_
The underlying GPIO.
Definition: Buzzer.hpp:69