Leosac  0.8.0
Open Source Access Control
WSHelperThread.cpp
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 #include "WSHelperThread.hpp"
21 #include "CRUDHandler.hpp"
22 #include "LeosacFwd.hpp"
26 
27 namespace Leosac
28 {
29 namespace Module
30 {
31 namespace LedBuzzer
32 {
33 
35  : BaseModuleSupportThread(core_utils, 0)
36 {
37 }
38 
40 {
41  ws_service.unregister_handler("buzzer.create");
42  ws_service.unregister_handler("buzzer.read");
43  ws_service.unregister_handler("buzzer.update");
44  ws_service.unregister_handler("buzzer.delete");
45 
46  ws_service.unregister_handler("led.create");
47  ws_service.unregister_handler("led.read");
48  ws_service.unregister_handler("led.update");
49  ws_service.unregister_handler("led.delete");
50 }
51 
53 {
54  ws_service.register_crud_handler(
55  "buzzer",
57  Hardware::BuzzerSerializer>::instanciate);
58  ws_service.register_crud_handler(
60  Hardware::LEDSerializer>::instanciate);
61 }
62 }
63 }
64 }
Leosac::Hardware::BuzzerSerializer
Definition: BuzzerSerializer.hpp:32
LEDSerializer.hpp
Leosac::Module::LedBuzzer::WSHelperThread::WSHelperThread
WSHelperThread(const CoreUtilsPtr &core_utils)
Definition: WSHelperThread.cpp:34
Leosac::Module::LedBuzzer::CRUDHandlerHelper::led_object_id_key
static constexpr const char led_object_id_key[]
How to retrieve the object's id when instanciate the crud handler for led.
Definition: CRUDHandler.hpp:40
Leosac::Hardware::LEDSerializer
Serializer code is copy-pasted from buzzer's serializer.
Definition: LEDSerializer.hpp:35
LeosacFwd.hpp
Leosac::Module::LedBuzzer::WSHelperThread::register_ws_handlers
void register_ws_handlers(WebSockAPI::Service &ws_service) override
Called when websocket handler registration is possible.
Definition: WSHelperThread.cpp:52
Leosac::Module::WebSockAPI::Service::register_crud_handler
void register_crud_handler(const std::string &resource_name, CRUDResourceHandler::Factory factory)
Definition: Service.cpp:41
Leosac::Module::LedBuzzer::CRUDHandler
CRUD handler for Buzzer and LED.
Definition: CRUDHandler.hpp:54
BuzzerSerializer.hpp
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::WebSockAPI::Service
A service object provided by the Websocket module.
Definition: Service.hpp:45
Leosac::Module::LedBuzzer::CRUDHandlerHelper::buzzer_object_id_key
static constexpr const char buzzer_object_id_key[]
How to retrieve the object's id when instanciate the crud handler for buzzer.
Definition: CRUDHandler.hpp:36
Service.hpp
Leosac::Module::LedBuzzer::WSHelperThread::unregister_ws_handlers
void unregister_ws_handlers(WebSockAPI::Service &ws_service) override
Definition: WSHelperThread.cpp:39
CRUDHandler.hpp
Leosac::Hardware::LED
Abstraction of LED device attributes.
Definition: LED.hpp:36
WSHelperThread.hpp
Leosac::Module::WebSockAPI::Service::unregister_handler
void unregister_handler(const std::string &name)
Remove an handler by name.
Definition: Service.cpp:36
Leosac::Hardware::Buzzer
Abstraction of Buzzer device attributes.
Definition: Buzzer.hpp:42
Leosac::CoreUtilsPtr
std::shared_ptr< CoreUtils > CoreUtilsPtr
Definition: LeosacFwd.hpp:35