• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_REQUEST_H
17 #define LOCATION_BEACON_FENCE_REQUEST_H
18 
19 #include <mutex>
20 #include <parcel.h>
21 #include <string>
22 #include "string_ex.h"
23 #include "iremote_object.h"
24 #include "geofence_definition.h"
25 #include "beacon_fence.h"
26 
27 namespace OHOS {
28 namespace Location {
29 
30 class BeaconFenceRequest : public Parcelable {
31 public:
32     BeaconFenceRequest();
33     BeaconFenceRequest(BeaconFenceRequest &beaconFenceRequest);
34     ~BeaconFenceRequest();
35 
GetBeaconFenceTransitionCallback()36     inline sptr<IRemoteObject> GetBeaconFenceTransitionCallback() const
37     {
38         return callback_;
39     }
40 
SetBeaconFenceTransitionCallback(const sptr<IRemoteObject> & callback)41     inline void SetBeaconFenceTransitionCallback(const sptr<IRemoteObject>& callback)
42     {
43         callback_ = callback;
44     }
45 
GetFenceExtensionAbilityName()46     inline std::string GetFenceExtensionAbilityName() const
47     {
48         return fenceExtensionAbilityName_;
49     }
50 
SetFenceExtensionAbilityName(std::string fenceExtensionAbilityName)51     inline void SetFenceExtensionAbilityName(std::string fenceExtensionAbilityName)
52     {
53         fenceExtensionAbilityName_ = fenceExtensionAbilityName;
54     }
55 
GetServiceUuid()56     inline std::string GetServiceUuid() const
57     {
58         return serviceUuid_;
59     }
60 
SetServiceUuid(std::string serviceUuid)61     inline void SetServiceUuid(std::string serviceUuid)
62     {
63         serviceUuid_ = serviceUuid;
64     }
65 
GetServiceUuidMask()66     inline std::string GetServiceUuidMask() const
67     {
68         return serviceUuidMask_;
69     }
70 
SetServiceUuidMask(std::string serviceUuidMask)71     inline void SetServiceUuidMask(std::string serviceUuidMask)
72     {
73         serviceUuidMask_ = serviceUuidMask;
74     }
75 
GetBundleName()76     inline std::string GetBundleName() const
77     {
78         return bundleName_;
79     }
80 
SetBundleName(std::string bundleName)81     inline void SetBundleName(std::string bundleName)
82     {
83         bundleName_ = bundleName;
84     }
85 
GetFenceId()86     inline std::string GetFenceId() const
87     {
88         return fenceId_;
89     }
90 
SetFenceId(std::string fenceId)91     inline void SetFenceId(std::string fenceId)
92     {
93         fenceId_ = fenceId;
94     }
95 
96     void ReadFromParcel(Parcel& parcel);
97     bool Marshalling(Parcel& parcel) const override;
98     static std::shared_ptr<BeaconFenceRequest> UnmarshallingShared(Parcel& parcel);
99     static BeaconFenceRequest* Unmarshalling(Parcel& parcel);
100     std::shared_ptr<BeaconFence> GetBeaconFence();
101     void SetBeaconFence(std::shared_ptr<BeaconFence>& beacon);
102 
103 private:
104     mutable std::mutex beaconFenceRequestMutex_;
105     std::shared_ptr<BeaconFence> beacon_;
106     sptr<IRemoteObject> callback_ = nullptr;
107     std::string fenceId_;
108     std::string fenceExtensionAbilityName_;
109     std::string serviceUuid_;
110     std::string serviceUuidMask_;
111     std::string bundleName_;
112 };
113 } // namespace Location
114 } // namespace OHOS
115 #endif // LOCATION_BEACON_FENCE_REQUEST_H