• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 REMOTE_CONTROL_TRANSFORM_PROCESSOR_H
17 #define REMOTE_CONTROL_TRANSFORM_PROCESSOR_H
18 
19 #include "aggregator.h"
20 #include "timer_manager.h"
21 #include "transform_processor.h"
22 
23 namespace OHOS {
24 namespace MMI {
25 class Remote_ControlTransformProcessor final : public TransformProcessor {
26 public:
27     explicit Remote_ControlTransformProcessor(int32_t deviceId);
28     DISALLOW_COPY_AND_MOVE(Remote_ControlTransformProcessor);
29     ~Remote_ControlTransformProcessor() = default;
30     std::shared_ptr<PointerEvent> OnEvent(struct libinput_event *event) override;
GetPointerEvent()31     std::shared_ptr<PointerEvent> GetPointerEvent() override { return nullptr; }
32 
33 private:
34     bool OnEventTouchMotion(struct libinput_event *event);
35     bool DumpInner();
36     bool HandlePostInner(struct libinput_event* event);
37     void InitToolTypes();
38 private:
39     int32_t buttonId_ { -1 };
40     int32_t processedCount_ { 0 };
41     const int32_t deviceId_ { -1 };
42     std::shared_ptr<PointerEvent> pointerEvent_ { nullptr };
43     bool isPressed_ { false };
44     std::vector<std::pair<int32_t, int32_t>> vecToolType_;
45     Aggregator aggregator_ {
46             [](int32_t intervalMs, int32_t repeatCount, std::function<void()> callback) -> int32_t {
47                 return TimerMgr->AddTimer(intervalMs, repeatCount, std::move(callback));
48             },
49             [](int32_t timerId) -> int32_t
50             {
51                 return TimerMgr->ResetTimer(timerId);
52             }
53     };
54 };
55 } // namespace MMI
56 } // namespace OHOS
57 #endif // TOUCH_TRANSFORM_PROCESSOR_H