Home | History | Annotate | Download | only in default
      1 /*
      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 
     23 namespace android {
     24 struct CasPlugin;
     25 
     26 namespace hardware {
     27 namespace cas {
     28 namespace V1_0 {
     29 struct ICasListener;
     30 namespace implementation {
     31 
     32 class SharedLibrary;
     33 
     34 class CasImpl : public ICas {
     35 public:
     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 
     88 private:
     89     struct PluginHolder;
     90     sp<SharedLibrary> mLibrary;
     91     std::shared_ptr<CasPlugin> 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_
    104