• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef GNSS_ABILITY_SKELETON_H
17 #define GNSS_ABILITY_SKELETON_H
18 
19 #include "message_option.h"
20 #include "message_parcel.h"
21 #include "iremote_object.h"
22 #include "iremote_stub.h"
23 
24 #include "constant_definition.h"
25 #include "subability_common.h"
26 
27 namespace OHOS {
28 namespace Location {
29 class IGnssAbility : public ISubAbility {
30 public:
31     DECLARE_INTERFACE_DESCRIPTOR(u"location.IGnssAbility");
32     virtual LocationErrCode RefrashRequirements() = 0;
33     virtual LocationErrCode RegisterGnssStatusCallback(const sptr<IRemoteObject>& callback, pid_t uid) = 0;
34     virtual LocationErrCode UnregisterGnssStatusCallback(const sptr<IRemoteObject>& callback) = 0;
35     virtual LocationErrCode RegisterNmeaMessageCallback(const sptr<IRemoteObject>& callback, pid_t uid) = 0;
36     virtual LocationErrCode UnregisterNmeaMessageCallback(const sptr<IRemoteObject>& callback) = 0;
37     virtual LocationErrCode RegisterCachedCallback(const std::unique_ptr<CachedGnssLocationsRequest>& request,
38         const sptr<IRemoteObject>& callback) = 0;
39     virtual LocationErrCode UnregisterCachedCallback(const sptr<IRemoteObject>& callback) = 0;
40 
41     virtual LocationErrCode GetCachedGnssLocationsSize(int &size) = 0;
42     virtual LocationErrCode FlushCachedGnssLocations() = 0;
43     virtual LocationErrCode SendCommand(std::unique_ptr<LocationCommand>& commands) = 0;
44     virtual LocationErrCode AddFence(std::unique_ptr<GeofenceRequest>& request) = 0;
45     virtual LocationErrCode RemoveFence(std::unique_ptr<GeofenceRequest>& request) = 0;
46 };
47 
48 class GnssAbilityStub : public IRemoteStub<IGnssAbility> {
49 public:
50     int32_t OnRemoteRequest(uint32_t code,
51         MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
52     virtual void SendMessage(uint32_t code, MessageParcel &data, MessageParcel &reply) = 0;
53 };
54 } // namespace Location
55 } // namespace OHOS
56 #endif // GNSS_ABILITY_SKELETON_H
57