1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_HARDWARE_CAS_V1_1_MEDIA_CAS_SERVICE_H_
18 #define ANDROID_HARDWARE_CAS_V1_1_MEDIA_CAS_SERVICE_H_
19 
20 #include <android/hardware/cas/1.1/IMediaCasService.h>
21 #include <android/hardware/cas/1.2/IMediaCasService.h>
22 
23 #include "FactoryLoader.h"
24 
25 namespace android {
26 struct CasFactory;
27 struct DescramblerFactory;
28 namespace hardware {
29 namespace cas {
30 namespace V1_1 {
31 namespace implementation {
32 
33 using ::android::hardware::cas::V1_0::HidlCasPluginDescriptor;
34 using ::android::hardware::cas::V1_0::IDescramblerBase;
35 
36 class MediaCasService : public V1_2::IMediaCasService {
37   public:
38     MediaCasService();
39 
40     virtual Return<void> enumeratePlugins(enumeratePlugins_cb _hidl_cb) override;
41 
42     virtual Return<bool> isSystemIdSupported(int32_t CA_system_id) override;
43 
44     virtual Return<sp<V1_0::ICas>> createPlugin(int32_t CA_system_id,
45                                                 const sp<V1_0::ICasListener>& listener) override;
46 
47     virtual Return<sp<ICas>> createPluginExt(int32_t CA_system_id,
48                                              const sp<ICasListener>& listener) override;
49 
50     virtual Return<bool> isDescramblerSupported(int32_t CA_system_id) override;
51 
52     virtual Return<sp<IDescramblerBase>> createDescrambler(int32_t CA_system_id) override;
53 
54   private:
55     FactoryLoader<CasFactory> mCasLoader;
56     FactoryLoader<DescramblerFactory> mDescramblerLoader;
57 
58     virtual ~MediaCasService();
59 };
60 
61 }  // namespace implementation
62 }  // namespace V1_1
63 }  // namespace cas
64 }  // namespace hardware
65 }  // namespace android
66 
67 #endif  // ANDROID_HARDWARE_CAS_V1_1_MEDIA_CAS_SERVICE_H_
68