/* * Copyright (C) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef GNSS_GEOFENCE_REQUEST_H #define GNSS_GEOFENCE_REQUEST_H #include #include #include "geofence_definition.h" #include #include "iremote_object.h" namespace OHOS { namespace Notification { class NotificationRequest; } namespace Location { typedef struct { double latitude; double longitude; double radius; double expiration; CoordinateSystemType coordinateSystemType; } GeoFence; class GeofenceRequest : public Parcelable { public: GeofenceRequest(); GeofenceRequest(GeofenceRequest& geofenceRequest); ~GeofenceRequest(); GeoFence GetGeofence(); void SetGeofence(GeoFence geofence); int GetScenario(); void SetScenario(int scenario); void SetWantAgentParcelData(const Parcel& data); bool GetWantAgentParcelData(Parcel& data); std::vector GetGeofenceTransitionEventList(); void SetGeofenceTransitionEvent(GeofenceTransitionEvent status); void SetGeofenceTransitionEventList(std::vector statusList); std::vector> GetNotificationRequestList(); void SetNotificationRequest(std::shared_ptr request); void SetNotificationRequestList(std::vector> requestList); void SetGeofenceTransitionCallback(const sptr& callback); sptr GetGeofenceTransitionCallback(); int GetFenceId(); void SetFenceId(int fenceId); const std::string& GetBundleName(); void SetBundleName(const std::string& bundleName); int32_t GetUid(); void SetUid(int32_t uid); bool GetAppAliveStatus(); void SetAppAliveStatus(bool appAliveStatus); int64_t GetRequestExpirationTime(); void SetRequestExpirationTime(int64_t requestExpirationTime); void ReadFromParcel(Parcel& parcel); bool Marshalling(Parcel& parcel) const override; static std::shared_ptr UnmarshallingShared(Parcel& parcel); static GeofenceRequest* Unmarshalling(Parcel& parcel); private: std::vector transitionStatusList_; std::vector> notificationRequestList_; sptr callback_ = nullptr; GeoFence geofence_{0.0, 0.0, 0.0, WGS84}; int scenario_; int fenceId_; int32_t uid_; std::vector wantAgentBuffer_; std::string bundleName_; bool appAliveStatus_; int64_t requestExpirationTime_ = 0; mutable std::mutex geofenceRequestMutex_; }; } // namespace Location } // namespace OHOS #endif // GNSS_GEOFENCE_REQUEST_H