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_HDI_DRM_V1_0_OEMCERTIFICATEPROXY_H
17 #define OHOS_HDI_DRM_V1_0_OEMCERTIFICATEPROXY_H
18 
19 #include "v1_0/ioem_certificate.h"
20 #include <iproxy_broker.h>
21 
22 namespace OHOS {
23 namespace HDI {
24 namespace Drm {
25 namespace V1_0 {
26 
27 class OemCertificateProxy : public IProxyBroker<OHOS::HDI::Drm::V1_0::IOemCertificate> {
28 public:
OemCertificateProxy(const sptr<IRemoteObject> & remote)29     explicit OemCertificateProxy(const sptr<IRemoteObject>& remote) : IProxyBroker<OHOS::HDI::Drm::V1_0::IOemCertificate>(remote) {}
30 
31     virtual ~OemCertificateProxy() = default;
32 
IsProxy()33     inline bool IsProxy() override
34     {
35         return true;
36     }
37 
38     int32_t GenerateOemKeySystemRequest(std::string& defaultUrl, std::vector<uint8_t>& request) override;
39 
40     int32_t ProcessOemKeySystemResponse(const std::vector<uint8_t>& response) override;
41 
42     int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) override;
43 
44     static int32_t GenerateOemKeySystemRequest_(std::string& defaultUrl, std::vector<uint8_t>& request,
45          const sptr<IRemoteObject> remote);
46 
47     static int32_t ProcessOemKeySystemResponse_(const std::vector<uint8_t>& response, const sptr<IRemoteObject> remote);
48 
49     static int32_t GetVersion_(uint32_t& majorVer, uint32_t& minorVer, const sptr<IRemoteObject> remote);
50 
51 private:
52     static inline BrokerDelegator<OHOS::HDI::Drm::V1_0::OemCertificateProxy> delegator_;
53 };
54 
55 } // V1_0
56 } // Drm
57 } // HDI
58 } // OHOS
59 
60 #endif // OHOS_HDI_DRM_V1_0_OEMCERTIFICATEPROXY_H