• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 JS_MECH_MANAGER_STUB_H
17 #define JS_MECH_MANAGER_STUB_H
18 
19 #include <functional>
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 #include <mutex>
25 
26 #include <iremote_stub.h>
27 #include "napi/native_api.h"
28 #include "napi/native_node_api.h"
29 #include "ipc_skeleton.h"
30 
31 #include "mechbody_controller_ipc_interface_code.h"
32 #include "js_mech_menager_interface.h"
33 #include "js_mech_manager_service.h"
34 
35 namespace OHOS {
36 namespace MechBodyController {
37 
38 class JsMechManagerStub : public IRemoteStub<IJsMechManager> {
39 
40 public:
41 
42     JsMechManagerStub();
43 
44     virtual ~JsMechManagerStub();
45 
46     void SetDeathRecipient(sptr<IRemoteObject::DeathRecipient> deathRecipient);
47 
48     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data,
49         MessageParcel &reply, MessageOption &option) override;
50 
51     int32_t AttachStateChangeCallback(MessageParcel &data, MessageParcel &reply) override;
52 
53     int32_t TrackingEventCallback(MessageParcel &data, MessageParcel &reply) override;
54 
55     int32_t RotationAxesStatusChangeCallback(MessageParcel &data, MessageParcel &reply) override;
56 
57     int32_t RotatePromiseFulfillment(MessageParcel &data, MessageParcel &reply) override;
58 
59 private:
60     void InitMechManagerFunc();
61 
62 private:
63     using MechManagerFunc = int32_t(JsMechManagerStub::*)(MessageParcel &data, MessageParcel &reply);
64     std::map<IMechBodyControllerCode, MechManagerFunc> mechManagerFuncMap_;
65 
66     sptr<IRemoteObject::DeathRecipient> deathRecipient_ = nullptr;
67 };
68 } // namespace MechBodyController
69 } // namespace OHOS
70 
71 #endif //JS_MECH_MANAGER_STUB_H