15c735df2Sopenharmony_ci/*
25c735df2Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
35c735df2Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
45c735df2Sopenharmony_ci * you may not use this file except in compliance with the License.
55c735df2Sopenharmony_ci * You may obtain a copy of the License at
65c735df2Sopenharmony_ci *
75c735df2Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
85c735df2Sopenharmony_ci *
95c735df2Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
105c735df2Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
115c735df2Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
125c735df2Sopenharmony_ci * See the License for the specific language governing permissions and
135c735df2Sopenharmony_ci * limitations under the License.
145c735df2Sopenharmony_ci */
155c735df2Sopenharmony_ci
165c735df2Sopenharmony_ci#ifndef REQUEST_H
175c735df2Sopenharmony_ci#define REQUEST_H
185c735df2Sopenharmony_ci
195c735df2Sopenharmony_ci#include <list>
205c735df2Sopenharmony_ci#include <string>
215c735df2Sopenharmony_ci
225c735df2Sopenharmony_ci#include "i_locator_callback.h"
235c735df2Sopenharmony_ci#include "request_config.h"
245c735df2Sopenharmony_ci#include "app_identity.h"
255c735df2Sopenharmony_ci
265c735df2Sopenharmony_cinamespace OHOS {
275c735df2Sopenharmony_cinamespace Location {
285c735df2Sopenharmony_ciclass Request {
295c735df2Sopenharmony_cipublic:
305c735df2Sopenharmony_ci    Request();
315c735df2Sopenharmony_ci    Request(std::unique_ptr<RequestConfig>& requestConfig,
325c735df2Sopenharmony_ci        sptr<ILocatorCallback>& callback, AppIdentity &identity);
335c735df2Sopenharmony_ci    ~Request();
345c735df2Sopenharmony_ci    pid_t GetUid();
355c735df2Sopenharmony_ci    pid_t GetPid();
365c735df2Sopenharmony_ci    std::string GetPackageName();
375c735df2Sopenharmony_ci    sptr<RequestConfig> GetRequestConfig();
385c735df2Sopenharmony_ci    sptr<ILocatorCallback> GetLocatorCallBack();
395c735df2Sopenharmony_ci    std::string GetUuid();
405c735df2Sopenharmony_ci    void SetUid(pid_t uid);
415c735df2Sopenharmony_ci    void SetPid(pid_t pid);
425c735df2Sopenharmony_ci    void SetPackageName(std::string packageName);
435c735df2Sopenharmony_ci    void SetRequestConfig(RequestConfig& requestConfig);
445c735df2Sopenharmony_ci    void SetLocatorCallBack(const sptr<ILocatorCallback>& callback);
455c735df2Sopenharmony_ci    void SetUuid(std::string uuid);
465c735df2Sopenharmony_ci    std::string ToString() const;
475c735df2Sopenharmony_ci    void GetProxyName(std::shared_ptr<std::list<std::string>> proxys);
485c735df2Sopenharmony_ci    bool GetIsRequesting();
495c735df2Sopenharmony_ci    void SetRequesting(bool state);
505c735df2Sopenharmony_ci    sptr<Location> GetLastLocation();
515c735df2Sopenharmony_ci    void SetLastLocation(const std::unique_ptr<Location>& location);
525c735df2Sopenharmony_ci    sptr<Location> GetBestLocation();
535c735df2Sopenharmony_ci    void SetBestLocation(const std::unique_ptr<Location>& location);
545c735df2Sopenharmony_ci    uint32_t GetTokenId();
555c735df2Sopenharmony_ci    uint32_t GetFirstTokenId();
565c735df2Sopenharmony_ci    uint64_t GetTokenIdEx();
575c735df2Sopenharmony_ci    int GetPermUsedType();
585c735df2Sopenharmony_ci    void SetPermUsedType(int type);
595c735df2Sopenharmony_ci    void SetTokenId(uint32_t tokenId);
605c735df2Sopenharmony_ci    void SetFirstTokenId(uint32_t firstTokenId);
615c735df2Sopenharmony_ci    void SetTokenIdEx(uint64_t tokenIdEx);
625c735df2Sopenharmony_ci    bool GetLocationPermState();
635c735df2Sopenharmony_ci    bool GetBackgroundPermState();
645c735df2Sopenharmony_ci    bool GetApproximatelyPermState();
655c735df2Sopenharmony_ci    void SetLocationPermState(bool state);
665c735df2Sopenharmony_ci    void SetBackgroundPermState(bool state);
675c735df2Sopenharmony_ci    void SetApproximatelyPermState(bool state);
685c735df2Sopenharmony_ci    void SetNlpRequestType(int nlpRequestType);
695c735df2Sopenharmony_ci    int GetNlpRequestType();
705c735df2Sopenharmony_ci    void SetNlpRequestType();
715c735df2Sopenharmony_ci    void SetLocationErrorCallBack(const sptr<ILocatorCallback>& callback);
725c735df2Sopenharmony_ci    sptr<ILocatorCallback> GetLocationErrorCallBack();
735c735df2Sopenharmony_ci    void SetLocatorCallbackRecipient(const sptr<IRemoteObject::DeathRecipient>& recipient);
745c735df2Sopenharmony_ci    sptr<IRemoteObject::DeathRecipient> GetLocatorCallbackRecipient();
755c735df2Sopenharmony_ciprivate:
765c735df2Sopenharmony_ci    void GetProxyNameByPriority(std::shared_ptr<std::list<std::string>> proxys);
775c735df2Sopenharmony_ci
785c735df2Sopenharmony_ci    pid_t uid_;
795c735df2Sopenharmony_ci    pid_t pid_;
805c735df2Sopenharmony_ci    uint32_t tokenId_;
815c735df2Sopenharmony_ci    uint64_t tokenIdEx_;
825c735df2Sopenharmony_ci    uint32_t firstTokenId_;
835c735df2Sopenharmony_ci    int nlpRequestType_;
845c735df2Sopenharmony_ci    sptr<Location> lastLocation_;
855c735df2Sopenharmony_ci    sptr<Location> bestLocation_;
865c735df2Sopenharmony_ci    std::string packageName_;
875c735df2Sopenharmony_ci    std::string uuid_;
885c735df2Sopenharmony_ci    sptr<RequestConfig> requestConfig_;
895c735df2Sopenharmony_ci    sptr<ILocatorCallback> callBack_;
905c735df2Sopenharmony_ci    sptr<ILocatorCallback> locationErrorcallBack_;
915c735df2Sopenharmony_ci    bool isRequesting_;
925c735df2Sopenharmony_ci    bool isUsingLocationPerm_;
935c735df2Sopenharmony_ci    bool isUsingBackgroundPerm_;
945c735df2Sopenharmony_ci    bool isUsingApproximatelyPerm_;
955c735df2Sopenharmony_ci    int permUsedType_;
965c735df2Sopenharmony_ci    sptr<IRemoteObject::DeathRecipient> locatorCallbackRecipient_;
975c735df2Sopenharmony_ci};
985c735df2Sopenharmony_ci} // namespace Location
995c735df2Sopenharmony_ci} // namespace OHOS
1005c735df2Sopenharmony_ci#endif // REQUEST_H
101