1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_DRM_MEDIA_KEY_SYSTEM_SERVICE_PROXY_H
17 #define OHOS_DRM_MEDIA_KEY_SYSTEM_SERVICE_PROXY_H
18 
19 #include <hilog/log.h>
20 #include "iremote_proxy.h"
21 #include "i_mediakeysystem_service.h"
22 
23 namespace OHOS {
24 namespace DrmStandard {
25 class MediaKeySystemServiceProxy : public IRemoteProxy<IMediaKeySystemService> {
26 public:
27     explicit MediaKeySystemServiceProxy(const sptr<IRemoteObject> &impl);
28     virtual ~MediaKeySystemServiceProxy() = default;
29     int32_t Release() override;
30 
31     int32_t GetConfigurationString(std::string &configName, std::string &value) override;
32     int32_t SetConfigurationString(std::string &configName, std::string &value) override;
33     int32_t GetConfigurationByteArray(std::string &configName, std::vector<uint8_t> &value) override;
34     int32_t SetConfigurationByteArray(std::string &configName, std::vector<uint8_t> &value) override;
35     int32_t GetMaxContentProtectionLevel(IMediaKeySessionService::ContentProtectionLevel *securityLevel) override;
36 
37     int32_t CreateMediaKeySession(IMediaKeySessionService::ContentProtectionLevel securityLevel,
38         sptr<IMediaKeySessionService> &keySessionProxy) override;
39     int32_t GetStatistics(std::vector<IMediaKeySystemService::MetircKeyValue> &metrics) override;
40     int32_t GetCertificateStatus(IMediaKeySystemService::CertificateStatus *certStatue) override;
41 
42     int32_t GenerateKeySystemRequest(std::vector<uint8_t> &request, std::string &defaultUrl) override;
43     int32_t ProcessKeySystemResponse(const std::vector<uint8_t> &response) override;
44 
45     int32_t GetOfflineMediaKeyIds(std::vector<std::vector<uint8_t>> &licenseIds) override;
46     int32_t GetOfflineMediaKeyStatus(std::vector<uint8_t> &licenseId,
47         IMediaKeySessionService::OfflineMediaKeyStatus &status) override;
48     int32_t ClearOfflineMediaKeys(std::vector<uint8_t> &licenseId) override;
49     int32_t SetListenerObject(const sptr<IRemoteObject> &object) override;
50     int32_t SetCallback(sptr<IMediaKeySystemServiceCallback> &callback) override;
51 
52 private:
53     static inline BrokerDelegator<MediaKeySystemServiceProxy> delegator_;
54 };
55 } // DrmStandard
56 } // OHOS
57 
58 #endif // OHOS_DRM_MEDIA_KEY_SYSTEM_SERVICE_PROXY_H
59