Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2022 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : */
19 :
20 : #ifndef FIREBOLT_RIALTO_SERVER_IPC_CONTROL_MODULE_SERVICE_H_
21 : #define FIREBOLT_RIALTO_SERVER_IPC_CONTROL_MODULE_SERVICE_H_
22 :
23 : #include "IControlModuleService.h"
24 : #include "IControlService.h"
25 : #include "IPlaybackService.h"
26 : #include <IIpcServer.h>
27 : #include <map>
28 : #include <memory>
29 : #include <set>
30 :
31 : namespace firebolt::rialto::server::ipc
32 : {
33 : class ControlModuleServiceFactory : public IControlModuleServiceFactory
34 : {
35 : public:
36 1 : ControlModuleServiceFactory() = default;
37 1 : virtual ~ControlModuleServiceFactory() = default;
38 :
39 : std::shared_ptr<IControlModuleService> create(service::IPlaybackService &playbackService,
40 : service::IControlService &controlService) const override;
41 : };
42 :
43 : class ControlModuleService : public IControlModuleService
44 : {
45 : public:
46 : explicit ControlModuleService(service::IPlaybackService &playbackService, service::IControlService &controlService);
47 : ~ControlModuleService() override;
48 :
49 : void clientConnected(const std::shared_ptr<::firebolt::rialto::ipc::IClient> &ipcClient) override;
50 : void clientDisconnected(const std::shared_ptr<::firebolt::rialto::ipc::IClient> &ipcClient) override;
51 :
52 : void getSharedMemory(::google::protobuf::RpcController *controller,
53 : const ::firebolt::rialto::GetSharedMemoryRequest *request,
54 : ::firebolt::rialto::GetSharedMemoryResponse *response,
55 : ::google::protobuf::Closure *done) override;
56 : void registerClient(::google::protobuf::RpcController *controller,
57 : const ::firebolt::rialto::RegisterClientRequest *request,
58 : ::firebolt::rialto::RegisterClientResponse *response, ::google::protobuf::Closure *done) override;
59 : void ack(::google::protobuf::RpcController *controller, const ::firebolt::rialto::AckRequest *request,
60 : ::firebolt::rialto::AckResponse *response, ::google::protobuf::Closure *done) override;
61 :
62 : private:
63 : service::IPlaybackService &m_playbackService;
64 : service::IControlService &m_controlService;
65 : std::map<std::shared_ptr<::firebolt::rialto::ipc::IClient>, std::set<int>> m_controlIds;
66 : };
67 : } // namespace firebolt::rialto::server::ipc
68 :
69 : #endif // FIREBOLT_RIALTO_SERVER_IPC_CONTROL_MODULE_SERVICE_H_
|