Leosac  0.8.0
Open Source Access Control
PFGPIO.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 #define ODB_NO_BASE_VERSION
23 #pragma db model version(1, 1)
24 
25 #include "LeosacFwd.hpp"
26 #include "hardware/GPIO.hpp"
27 #include <nlohmann/json.hpp>
28 
29 namespace Leosac
30 {
31 namespace Module
32 {
33 
34 namespace Piface
35 {
43 #pragma db object callback(validation_callback) table("HARDWARE_GPIO_Piface")
44 class PFGPIO : public Hardware::GPIO
45 {
46  public:
47  PFGPIO();
48 
49  uint8_t hardware_address() const
50  {
51  return hardware_address_;
52  }
53 
54  void hardware_address(uint8_t addr)
55  {
56  hardware_address_ = addr;
57  }
58 
59  private:
66 
67  friend odb::access;
68 };
69 
71 {
72  static json serialize(const PFGPIO &in, const SecurityContext &sc);
73  static void unserialize(PFGPIO &out, const json &in, const SecurityContext &sc);
74 };
75 }
76 }
77 }
Leosac::Module::Piface::PFGPIO::hardware_address
uint8_t hardware_address() const
Definition: PFGPIO.hpp:49
json
nlohmann::json json
Definition: WSServer.cpp:76
LeosacFwd.hpp
Leosac::Module::Piface::PFGPIO
Piface Module GPIO descriptor.
Definition: PFGPIO.hpp:44
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::Piface::PFGPIOSerializer::serialize
static json serialize(const PFGPIO &in, const SecurityContext &sc)
Definition: PFGPIO.cpp:37
Leosac::Module::Piface::PFGPIO::hardware_address_
uint8_t hardware_address_
Hardware address of the piface digital device.
Definition: PFGPIO.hpp:65
GPIO.hpp
Leosac::Module::Piface::json
nlohmann::json json
Definition: PFGPIO.hpp:36
Leosac::Module::Piface::PFGPIOSerializer
Definition: PFGPIO.hpp:70
Leosac::Module::Piface::PFGPIO::PFGPIO
PFGPIO()
Definition: PFGPIO.cpp:32
Leosac::Module::Piface::PFGPIO::hardware_address
void hardware_address(uint8_t addr)
Definition: PFGPIO.hpp:54
Leosac::Module::Piface::PFGPIOSerializer::unserialize
static void unserialize(PFGPIO &out, const json &in, const SecurityContext &sc)
Definition: PFGPIO.cpp:49
Leosac::SecurityContext
A SecurityContext is used to query permission while doing an operation.
Definition: SecurityContext.hpp:40
Leosac::Hardware::GPIO
Abstraction of a GPIO device attributes.
Definition: GPIO.hpp:41