1 /*
2  * Copyright (C) 2024 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 LOCATOR_MSDP_MONITOR_MANAGER_H
17 #define LOCATOR_MSDP_MONITOR_MANAGER_H
18 #ifdef MOVEMENT_CLIENT_ENABLE
19 #include "locator_msdp_state_change_cb.h"
20 #include "movement_client.h"
21 #include "iservice_registry.h"
22 #include "location_log.h"
23 #include "system_ability_definition.h"
24 #include "system_ability_status_change_stub.h"
25 #include "locator_msdp_state_change_cb.h"
26 
27 namespace OHOS {
28 namespace Location {
29 class LocatorMsdpMonitorManager {
30 public:
31     static LocatorMsdpMonitorManager* GetInstance();
32     LocatorMsdpMonitorManager();
33     ~LocatorMsdpMonitorManager();
34     void RegisterMovementCallBack();
35     void UnRegisterMovementCallBack();
36     void UpdateStillMovementState(bool stillState);
37     bool GetStillMovementState();
38 
39     std::atomic_bool isDeviceStillState_;
40 
41 private:
42     void Init();
43     sptr<DeviceMovementCallback> deviceMovementCallback_;
44     std::mutex deviceMovementEventMutex;
45     sptr<ISystemAbilityStatusChange> saStatusListener_;
46 };
47 
48 class MsdpMotionServiceStatusChange : public SystemAbilityStatusChangeStub {
49 public:
50     void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
51     void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
52 };
53 }
54 }
55 #endif // MOVEMENT_CLIENT_ENABLE
56 #endif // LOCATOR_MSDP_MONITOR_MANAGER_H