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_CLIENT_MEDIA_KEYS_CAPABILITIES_IPC_H_
21 : #define FIREBOLT_RIALTO_CLIENT_MEDIA_KEYS_CAPABILITIES_IPC_H_
22 :
23 : #include "IEventThread.h"
24 : #include "IMediaKeysCapabilitiesIpcFactory.h"
25 : #include "IpcModule.h"
26 : #include <memory>
27 : #include <mutex>
28 : #include <string>
29 : #include <vector>
30 :
31 : #include "mediakeyscapabilitiesmodule.pb.h"
32 :
33 : namespace firebolt::rialto::client
34 : {
35 : /**
36 : * @brief IMediaKeysCapabilitiesIpc factory class definition.
37 : */
38 : class MediaKeysCapabilitiesIpcFactory : public IMediaKeysCapabilitiesIpcFactory
39 : {
40 : public:
41 1 : MediaKeysCapabilitiesIpcFactory() = default;
42 1 : ~MediaKeysCapabilitiesIpcFactory() override = default;
43 :
44 : /**
45 : * @brief Weak pointer to the singleton object.
46 : */
47 : static std::weak_ptr<IMediaKeysCapabilities> m_mediaKeysCapabilitiesIpc;
48 :
49 : /**
50 : * @brief Mutex protection for creation of the MediaKeysCapabilitiesIpc object.
51 : */
52 : static std::mutex m_creationMutex;
53 :
54 : std::shared_ptr<IMediaKeysCapabilities> getMediaKeysCapabilitiesIpc() const override;
55 : };
56 :
57 : /**
58 : * @brief The definition of the MediaKeysCapabilitiesIpc.
59 : */
60 : class MediaKeysCapabilitiesIpc : public IMediaKeysCapabilities, public IpcModule
61 : {
62 : public:
63 : /**
64 : * @brief The constructor.
65 : *
66 : * @param[in] ipcClient : The ipc client
67 : */
68 : explicit MediaKeysCapabilitiesIpc(IIpcClient &ipcClientFactory);
69 :
70 : /**
71 : * @brief Virtual destructor.
72 : */
73 : virtual ~MediaKeysCapabilitiesIpc();
74 :
75 : std::vector<std::string> getSupportedKeySystems() override;
76 :
77 : bool supportsKeySystem(const std::string &keySystem) override;
78 :
79 : bool getSupportedKeySystemVersion(const std::string &keySystem, std::string &version) override;
80 :
81 : bool isServerCertificateSupported(const std::string &keySystem) override;
82 :
83 : private:
84 : /**
85 : * @brief The ipc protobuf media keys capabilities stub.
86 : */
87 : std::unique_ptr<::firebolt::rialto::MediaKeysCapabilitiesModule_Stub> m_mediaKeysCapabilitiesStub;
88 :
89 : bool createRpcStubs(const std::shared_ptr<ipc::IChannel> &ipcChannel) override;
90 :
91 23 : bool subscribeToEvents(const std::shared_ptr<ipc::IChannel> &ipcChannel) override { return true; }
92 : };
93 :
94 : }; // namespace firebolt::rialto::client
95 :
96 : #endif // FIREBOLT_RIALTO_CLIENT_MEDIA_KEYS_CAPABILITIES_IPC_H_
|