1 /* 2 * Copyright (c) 2022 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 "ohos_adapter/bridge/ark_mmi_device_info_adapter_wrapper.h" 17 18 #include "base/bridge/ark_web_bridge_macros.h" 19 20 namespace OHOS::ArkWeb { 21 ArkMMIDeviceInfoAdapterWrapper(ArkWebRefPtr<ArkMMIDeviceInfoAdapter> ref)22ArkMMIDeviceInfoAdapterWrapper::ArkMMIDeviceInfoAdapterWrapper(ArkWebRefPtr<ArkMMIDeviceInfoAdapter> ref) : ctocpp_(ref) 23 {} 24 GetId()25int32_t ArkMMIDeviceInfoAdapterWrapper::GetId() 26 { 27 return ctocpp_->GetId(); 28 } 29 GetType()30int32_t ArkMMIDeviceInfoAdapterWrapper::GetType() 31 { 32 return ctocpp_->GetType(); 33 } 34 GetBus()35int32_t ArkMMIDeviceInfoAdapterWrapper::GetBus() 36 { 37 return ctocpp_->GetBus(); 38 } 39 GetVersion()40int32_t ArkMMIDeviceInfoAdapterWrapper::GetVersion() 41 { 42 return ctocpp_->GetVersion(); 43 } 44 GetProduct()45int32_t ArkMMIDeviceInfoAdapterWrapper::GetProduct() 46 { 47 return ctocpp_->GetProduct(); 48 } 49 GetVendor()50int32_t ArkMMIDeviceInfoAdapterWrapper::GetVendor() 51 { 52 return ctocpp_->GetVendor(); 53 } 54 GetName()55std::string ArkMMIDeviceInfoAdapterWrapper::GetName() 56 { 57 ArkWebString str = ctocpp_->GetName(); 58 std::string result = ArkWebStringStructToClass(str); 59 ArkWebStringStructRelease(str); 60 return result; 61 } 62 GetPhys()63std::string ArkMMIDeviceInfoAdapterWrapper::GetPhys() 64 { 65 ArkWebString str = ctocpp_->GetPhys(); 66 std::string result = ArkWebStringStructToClass(str); 67 ArkWebStringStructRelease(str); 68 return result; 69 } 70 GetUniq()71std::string ArkMMIDeviceInfoAdapterWrapper::GetUniq() 72 { 73 ArkWebString str = ctocpp_->GetUniq(); 74 std::string result = ArkWebStringStructToClass(str); 75 ArkWebStringStructRelease(str); 76 return result; 77 } 78 SetId(int32_t id)79void ArkMMIDeviceInfoAdapterWrapper::SetId(int32_t id) 80 { 81 ctocpp_->SetId(id); 82 } 83 SetType(int32_t type)84void ArkMMIDeviceInfoAdapterWrapper::SetType(int32_t type) 85 { 86 ctocpp_->SetType(type); 87 } 88 SetBus(int32_t bus)89void ArkMMIDeviceInfoAdapterWrapper::SetBus(int32_t bus) 90 { 91 ctocpp_->SetBus(bus); 92 } 93 SetVersion(int32_t version)94void ArkMMIDeviceInfoAdapterWrapper::SetVersion(int32_t version) 95 { 96 ctocpp_->SetVersion(version); 97 } 98 SetProduct(int32_t product)99void ArkMMIDeviceInfoAdapterWrapper::SetProduct(int32_t product) 100 { 101 ctocpp_->SetProduct(product); 102 } 103 SetVendor(int32_t vendor)104void ArkMMIDeviceInfoAdapterWrapper::SetVendor(int32_t vendor) 105 { 106 ctocpp_->SetVendor(vendor); 107 } 108 SetName(std::string name)109void ArkMMIDeviceInfoAdapterWrapper::SetName(std::string name) 110 { 111 ArkWebString str = ArkWebStringClassToStruct(name); 112 ctocpp_->SetName(str); 113 ArkWebStringStructRelease(str); 114 } 115 SetPhys(std::string phys)116void ArkMMIDeviceInfoAdapterWrapper::SetPhys(std::string phys) 117 { 118 ArkWebString str = ArkWebStringClassToStruct(phys); 119 ctocpp_->SetPhys(str); 120 ArkWebStringStructRelease(str); 121 } 122 SetUniq(std::string uniq)123void ArkMMIDeviceInfoAdapterWrapper::SetUniq(std::string uniq) 124 { 125 ArkWebString str = ArkWebStringClassToStruct(uniq); 126 ctocpp_->SetUniq(str); 127 ArkWebStringStructRelease(str); 128 } 129 130 } // namespace OHOS::ArkWeb 131