• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025-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 OHOS_CAMERA_H_MECH_SESSION_H
17 #define OHOS_CAMERA_H_MECH_SESSION_H
18 
19 #include <refbase.h>
20 #include <shared_mutex>
21 
22 #include "mech_session_callback_stub.h"
23 #include "mech_session_stub.h"
24 
25 namespace OHOS {
26 namespace CameraStandard {
27 
28 class HMechSession : public MechSessionStub {
29 public:
30     HMechSession(int32_t userId);
31     ~HMechSession();
32     int32_t EnableMechDelivery(bool isEnableMech) override;
33     int32_t SetCallback(const sptr<IMechSessionCallback>& callback) override;
34     int32_t Release() override;
35     int32_t CallbackEnter([[maybe_unused]] uint32_t code) override;
36     int32_t CallbackExit([[maybe_unused]] uint32_t code, [[maybe_unused]] int32_t result) override;
37     int32_t OnFocusTrackingInfo(int32_t streamId, bool isNeedMirror, bool isNeedFlip,
38         const std::shared_ptr<OHOS::Camera::CameraMetadata> &result);
39     int32_t OnCaptureSessionConfiged(const CaptureSessionInfo& captureSessionInfo);
40     int32_t OnZoomInfoChange(int32_t sessionid, const ZoomInfo& zoomInfo);
41     int32_t OnSessionStatusChange(int32_t sessionid, bool status);
42     sptr<IMechSessionCallback> GetCallback();
43     bool IsEnableMech();
44 
45 private:
46     void HanldeOnCaptureSessionConfiged(const sptr<IMechSessionCallback>& callback);
47     int32_t userId_;
48     bool isEnableMech_ = false;
49     sptr<IMechSessionCallback> callback_;
50     std::mutex enableLock_;
51     std::shared_mutex callbackLock_;
52 };
53 } // namespace CameraStandard
54 } // namespace OHOS
55 #endif // OHOS_CAMERA_H_MECH_SESSION_H
56