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 #include "adapter/ohos/entrance/timepicker/timepicker_haptic_impl.h"
17 #include "adapter/ohos/entrance/timepicker/timepicker_haptic_stub.h"
18 
19 #include <cmath>
20 #include <condition_variable>
21 #include <mutex>
22 #include <thread>
23 
24 namespace OHOS::Ace::NG {
25 
TimepickerAudioHapticImpl()26 TimepickerAudioHapticImpl::TimepickerAudioHapticImpl()
27 {
28     handler_ = std::make_unique<TimePickerHapticController>();
29 }
30 
Play(size_t speed)31 void TimepickerAudioHapticImpl::Play(size_t speed)
32 {
33     if (handler_) {
34         handler_->Play(speed);
35     }
36 }
37 
PlayOnce()38 void TimepickerAudioHapticImpl::PlayOnce()
39 {
40     if (handler_) {
41         handler_->PlayOnce();
42     }
43 }
44 
Stop()45 void TimepickerAudioHapticImpl::Stop()
46 {
47     if (handler_) {
48         handler_->Stop();
49     }
50 }
51 
HandleDelta(double dy)52 void TimepickerAudioHapticImpl::HandleDelta(double dy)
53 {
54     if (handler_) {
55         handler_->HandleDelta(dy);
56     }
57 }
58 
59 } // namespace OHOS::Ace::NG
60