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 #ifndef LOCATION_BEACON_FENCE_H 17 #define LOCATION_BEACON_FENCE_H 18 19 #include <mutex> 20 #include <parcel.h> 21 #include <string> 22 #include "string_ex.h" 23 #include "iremote_object.h" 24 25 namespace OHOS { 26 namespace Location { 27 enum BeaconFenceInfoType { 28 BEACON_MANUFACTURE_DATA = 1, 29 }; 30 31 typedef struct { 32 int32_t manufactureId; 33 std::vector<uint8_t> manufactureData; 34 std::vector<uint8_t> manufactureDataMask; 35 } BeaconManufactureData; 36 37 class BeaconFence : public Parcelable { 38 public: 39 BeaconFence(); 40 BeaconFence(BeaconFence &BeaconFence); 41 ~BeaconFence(); 42 GetIdentifier()43 inline std::string GetIdentifier() const 44 { 45 return identifier_; 46 } 47 SetIdentifier(std::string identifier)48 inline void SetIdentifier(std::string identifier) 49 { 50 identifier_ = identifier; 51 } 52 GetBeaconFenceInfoType()53 inline BeaconFenceInfoType GetBeaconFenceInfoType() const 54 { 55 return type_; 56 } 57 SetBeaconFenceInfoType(BeaconFenceInfoType type)58 inline void SetBeaconFenceInfoType(BeaconFenceInfoType type) 59 { 60 type_ = type; 61 } 62 GetBeaconManufactureData()63 inline BeaconManufactureData GetBeaconManufactureData() const 64 { 65 return manufactureData_; 66 } 67 SetBeaconManufactureData(BeaconManufactureData manufactureData)68 inline void SetBeaconManufactureData(BeaconManufactureData manufactureData) 69 { 70 manufactureData_ = manufactureData; 71 } 72 73 void ReadFromParcel(Parcel& parcel); 74 bool Marshalling(Parcel& parcel) const override; 75 static std::shared_ptr<BeaconFence> UnmarshallingShared(Parcel& parcel); 76 static BeaconFence* Unmarshalling(Parcel& parcel); 77 mutable std::mutex beaconFenceMutex_; 78 std::string identifier_; 79 BeaconFenceInfoType type_; 80 BeaconManufactureData manufactureData_; 81 }; 82 } // namespace Location 83 } // namespace OHOS 84 #endif // LOCATION_BEACON_FENCE_REQUEST_H