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 MC_CONTROLLER_MANAGER_H 17 #define MC_CONTROLLER_MANAGER_H 18 19 #include <map> 20 #include <mutex> 21 #include <vector> 22 #include <memory> 23 #include "mechbody_controller_ipc_interface_code.h" 24 #include "mechbody_controller_log.h" 25 #include "mechbody_controller_types.h" 26 #include "mc_camera_tracking_controller.h" 27 #include "mc_motion_manager.h" 28 #include "mc_connect_manager.h" 29 30 namespace OHOS { 31 namespace MechBodyController { 32 33 class MechConnectListenerImpl : public IMechConnectListener { 34 public: 35 void OnMechConnect(const MechInfo& mechInfo) override; 36 void OnMechDisconnect(const MechInfo& mechInfo) override; 37 }; 38 39 class McControllerManager { 40 public: 41 static McControllerManager& GetInstance(); 42 private: 43 McControllerManager(const McControllerManager&) = delete; 44 McControllerManager& operator= (const McControllerManager&) = delete; 45 McControllerManager(McControllerManager&&) = delete; 46 McControllerManager& operator= (McControllerManager&&) = delete; 47 48 public: 49 McControllerManager(); 50 ~McControllerManager(); 51 52 int32_t SetTrackingEnabled(const uint32_t &tokenId, bool &isEnabled); 53 int32_t GetTrackingEnabled(const uint32_t &tokenId, bool &isEnabled); 54 int32_t RegisterTrackingEventCallback(const uint32_t &tokenId, sptr<IRemoteObject> callback); 55 int32_t UnRegisterTrackingEventCallback(const uint32_t &tokenId); 56 int32_t OnTrackingEvent(const int32_t &mechId, const TrackingEvent &event); 57 int32_t SetTrackingLayout(const uint32_t &tokenId, CameraTrackingLayout &cameraTrackingLayout); 58 int32_t GetTrackingLayout(const uint32_t &tokenId, CameraTrackingLayout &cameraTrackingLayoutb); 59 60 private: 61 std::shared_ptr<IMechConnectListener> listener_ = nullptr; 62 std::mutex userSettingsMutex_; 63 }; 64 65 } // namespace MechBodyController 66 } // namespace OHOS 67 #endif