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 #define MLOG_TAG "MediaQueryCloudEnhancementTaskStateVo"
17
18 #include "query_cloud_enhancement_task_state_vo.h"
19
20 #include <sstream>
21
22 #include "media_itypes_utils.h"
23 #include "media_log.h"
24
25 namespace OHOS::Media {
26 using namespace std;
Unmarshalling(MessageParcel & parcel)27 bool QueryCloudEnhancementTaskStateReqBody::Unmarshalling(MessageParcel &parcel)
28 {
29 bool status = parcel.ReadString(this->photoUri);
30 CHECK_AND_RETURN_RET(status, status);
31 return true;
32 }
33
Marshalling(MessageParcel & parcel) const34 bool QueryCloudEnhancementTaskStateReqBody::Marshalling(MessageParcel &parcel) const
35 {
36 bool status = parcel.WriteString(this->photoUri);
37 CHECK_AND_RETURN_RET(status, status);
38 return true;
39 }
40
ToString() const41 string QueryCloudEnhancementTaskStateReqBody::ToString() const
42 {
43 std::stringstream ss;
44 ss << "{"
45 << "\"photoUri\": \"" << photoUri
46 << "}";
47 return ss.str();
48 }
49
Unmarshalling(MessageParcel & parcel)50 bool QueryCloudEnhancementTaskStateRespBody::Unmarshalling(MessageParcel &parcel)
51 {
52 bool status = parcel.ReadInt32(this->fileId);
53 CHECK_AND_RETURN_RET(status, status);
54 status = parcel.ReadString(this->photoId);
55 CHECK_AND_RETURN_RET(status, status);
56 status = parcel.ReadInt32(this->ceAvailable);
57 CHECK_AND_RETURN_RET(status, status);
58 status = parcel.ReadInt32(this->ceErrorCode);
59 CHECK_AND_RETURN_RET(status, status);
60 return true;
61 }
62
Marshalling(MessageParcel & parcel) const63 bool QueryCloudEnhancementTaskStateRespBody::Marshalling(MessageParcel &parcel) const
64 {
65 bool status = parcel.WriteInt32(this->fileId);
66 CHECK_AND_RETURN_RET(status, status);
67 status = parcel.WriteString(this->photoId);
68 CHECK_AND_RETURN_RET(status, status);
69 status = parcel.WriteInt32(this->ceAvailable);
70 CHECK_AND_RETURN_RET(status, status);
71 status = parcel.WriteInt32(this->ceErrorCode);
72 CHECK_AND_RETURN_RET(status, status);
73 return true;
74 }
75
ToString() const76 string QueryCloudEnhancementTaskStateRespBody::ToString() const
77 {
78 std::stringstream ss;
79 ss << "{"
80 << "\"fileId\": \"" << to_string(this->fileId) << "\""
81 << ",\"photoId\": \"" << this->photoId << "\""
82 << ",\"ceAvailable\": \"" << to_string(this->ceAvailable) << "\""
83 << ",\"ceErrorCode\": \"" << to_string(this->ceErrorCode) << "\""
84 << "}";
85 return ss.str();
86 }
87 } // namespace OHOS::Media