1 /* 2 * Copyright (c) 2021-2022 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 #include "axis_event.h" 17 18 #include "mmi_log.h" 19 20 #undef MMI_LOG_TAG 21 #define MMI_LOG_TAG "AxisEvent" 22 23 namespace OHOS { 24 namespace MMI { from(std::shared_ptr<InputEvent> inputEvent)25std::shared_ptr<AxisEvent> AxisEvent::from(std::shared_ptr<InputEvent> inputEvent) 26 { 27 return nullptr; 28 } 29 AxisEvent(int32_t eventType)30AxisEvent::AxisEvent(int32_t eventType) : InputEvent(eventType) {} 31 ~AxisEvent()32AxisEvent::~AxisEvent() {} 33 Create()34std::shared_ptr<AxisEvent> AxisEvent::Create() 35 { 36 auto event = std::shared_ptr<AxisEvent>(new (std::nothrow) AxisEvent(InputEvent::EVENT_TYPE_AXIS)); 37 CHKPP(event); 38 return event; 39 } 40 GetAxisAction()41int32_t AxisEvent::GetAxisAction() 42 { 43 return 0; 44 } 45 SetAxisAction(int32_t axisAction)46void AxisEvent::SetAxisAction(int32_t axisAction) 47 { 48 axisAction_ = axisAction; 49 } 50 GetAxisType() const51int32_t AxisEvent::GetAxisType() const 52 { 53 return 0; 54 } 55 SetAxisType(int32_t axisType)56void AxisEvent::SetAxisType(int32_t axisType) 57 { 58 axisType_ = axisType; 59 } 60 GetAxisValue() const61int32_t AxisEvent::GetAxisValue() const 62 { 63 return 0; 64 } 65 SetAxisValue(int32_t axisValue)66void AxisEvent::SetAxisValue(int32_t axisValue) 67 { 68 axisValue_ = axisValue; 69 } 70 ActionToShortStr(int32_t action)71std::string_view AxisEvent::ActionToShortStr(int32_t action) 72 { 73 switch (action) { 74 case AxisEvent::AXIS_ACTION_CANCEL: 75 return "A:C:"; 76 case AxisEvent::AXIS_ACTION_START: 77 return "A:S:"; 78 case AxisEvent::AXIS_ACTION_UPDATE: 79 return "A:U:"; 80 case AxisEvent::AXIS_ACTION_END: 81 return "A:E:"; 82 case AxisEvent::AXIS_ACTION_UNKNOWN: 83 return "A:UK:"; 84 default: 85 return "A:?:"; 86 } 87 } 88 } // namespace MMI 89 } // namespace OHOS 90