1 /*
2 * Copyright (c) 2025 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 #include "boomerang_client.h"
17
18 #include "devicestatus_define.h"
19 #include "intention_client.h"
20
21 #undef LOG_TAG
22 #define LOG_TAG "BoomerangClient"
23
24 namespace OHOS {
25 namespace Msdp {
26 namespace DeviceStatus {
27
SubscribeCallback(BoomerangType type,const std::string & bundleName,const sptr<IRemoteBoomerangCallback> & callback)28 int32_t BoomerangClient::SubscribeCallback(BoomerangType type, const std::string& bundleName,
29 const sptr<IRemoteBoomerangCallback>& callback)
30 {
31 int32_t ret = INTENTION_CLIENT->SubscribeCallback(type, bundleName, callback);
32 if (ret != RET_OK) {
33 FI_HILOGE("SubscribeBoomerang fail, error:%{public}d", ret);
34 }
35 return ret;
36 }
37
UnsubscribeCallback(BoomerangType type,const std::string & bundleName,const sptr<IRemoteBoomerangCallback> & callback)38 int32_t BoomerangClient::UnsubscribeCallback(BoomerangType type, const std::string& bundleName,
39 const sptr<IRemoteBoomerangCallback>& callback)
40 {
41 int32_t ret = INTENTION_CLIENT->UnsubscribeCallback(type, bundleName, callback);
42 if (ret != RET_OK) {
43 FI_HILOGE("UnsubscribeBoomerang fail, error:%{public}d", ret);
44 }
45 return ret;
46 }
47
NotifyMetadataBindingEvent(const std::string & bundleName,const sptr<IRemoteBoomerangCallback> & callback)48 int32_t BoomerangClient::NotifyMetadataBindingEvent(const std::string& bundleName,
49 const sptr<IRemoteBoomerangCallback>& callback)
50 {
51 int32_t ret = INTENTION_CLIENT->NotifyMetadataBindingEvent(bundleName, callback);
52 if (ret != RET_OK) {
53 FI_HILOGE("NotifyMetadataBindingEvent fail, error:%{public}d", ret);
54 }
55 return ret;
56 }
57
SubmitMetadata(const std::string & metaData)58 int32_t BoomerangClient::SubmitMetadata(const std::string& metaData)
59 {
60 int32_t ret = INTENTION_CLIENT->SubmitMetadata(metaData);
61 if (ret != RET_OK) {
62 FI_HILOGE("SubmitMetadata fail, error:%{public}d", ret);
63 }
64 return ret;
65 }
66
BoomerangEncodeImage(const std::shared_ptr<Media::PixelMap> & pixelMap,const std::string & metaData,const sptr<IRemoteBoomerangCallback> & callback)67 int32_t BoomerangClient::BoomerangEncodeImage(const std::shared_ptr<Media::PixelMap>& pixelMap,
68 const std::string& metaData, const sptr<IRemoteBoomerangCallback>& callback)
69 {
70 int32_t ret = INTENTION_CLIENT->BoomerangEncodeImage(pixelMap, metaData, callback);
71 if (ret != RET_OK) {
72 FI_HILOGE("BoomerangEncodeImage fail, error:%{public}d", ret);
73 }
74 return ret;
75 }
76
BoomerangDecodeImage(const std::shared_ptr<Media::PixelMap> & pixelMap,const sptr<IRemoteBoomerangCallback> & callback)77 int32_t BoomerangClient::BoomerangDecodeImage(const std::shared_ptr<Media::PixelMap>& pixelMap,
78 const sptr<IRemoteBoomerangCallback>& callback)
79 {
80 int32_t ret = INTENTION_CLIENT->BoomerangDecodeImage(pixelMap, callback);
81 if (ret != RET_OK) {
82 FI_HILOGE("BoomerangDecodeImage fail, error:%{public}d", ret);
83 }
84 return ret;
85 }
86 } // namespace DeviceStatus
87 } // namespace Msdp
88 } // namespace OHOS