blob: 841d64e038328e7fbae9343cac77d203ba5e8ceb [file] [log] [blame]
Chong Zhanga4f67512017-04-24 17:18:25 -07001/*
2 * Copyright (C) 2017 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_0_CAS_IMPL_H_
18#define ANDROID_HARDWARE_CAS_V1_0_CAS_IMPL_H_
19
20#include <media/stagefright/foundation/ABase.h>
21#include <android/hardware/cas/1.0/ICas.h>
22
23namespace android {
24struct CasPlugin;
25
26namespace hardware {
27namespace cas {
28namespace V1_0 {
29struct ICasListener;
30namespace implementation {
31
32class SharedLibrary;
33
34class CasImpl : public ICas {
35public:
36 CasImpl(const sp<ICasListener> &listener);
37 virtual ~CasImpl();
38
39 static void OnEvent(
40 void *appData,
41 int32_t event,
42 int32_t arg,
43 uint8_t *data,
44 size_t size);
45
46 void init(const sp<SharedLibrary>& library, CasPlugin *plugin);
47 void onEvent(
48 int32_t event,
49 int32_t arg,
50 uint8_t *data,
51 size_t size);
52
53 // ICas inherits
54
55 virtual Return<Status> setPrivateData(
56 const HidlCasData& pvtData) override;
57
58 virtual Return<void> openSession(
59 openSession_cb _hidl_cb) override;
60
61 virtual Return<Status> closeSession(
62 const HidlCasSessionId& sessionId) override;
63
64 virtual Return<Status> setSessionPrivateData(
65 const HidlCasSessionId& sessionId,
66 const HidlCasData& pvtData) override;
67
68 virtual Return<Status> processEcm(
69 const HidlCasSessionId& sessionId,
70 const HidlCasData& ecm) override;
71
72 virtual Return<Status> processEmm(
73 const HidlCasData& emm) override;
74
75 virtual Return<Status> sendEvent(
76 int32_t event, int32_t arg,
77 const HidlCasData& eventData) override;
78
79 virtual Return<Status> provision(
80 const hidl_string& provisionString) override;
81
82 virtual Return<Status> refreshEntitlements(
83 int32_t refreshType,
84 const HidlCasData& refreshData) override;
85
86 virtual Return<Status> release() override;
87
88private:
89 struct PluginHolder;
90 sp<SharedLibrary> mLibrary;
91 sp<PluginHolder> mPluginHolder;
92 sp<ICasListener> mListener;
93
94 DISALLOW_EVIL_CONSTRUCTORS(CasImpl);
95};
96
97} // namespace implementation
98} // namespace V1_0
99} // namespace cas
100} // namespace hardware
101} // namespace android
102
103#endif // ANDROID_HARDWARE_CAS_V1_0_CAS_IMPL_H_