1 /*
2 * Copyright (C) 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 "accessibility_element_operator_callback_impl.h"
17 #include "hilog_wrapper.h"
18
19 namespace OHOS {
20 namespace Accessibility {
SetFindFocusedElementInfoResult(const AccessibilityElementInfo & info,const int32_t requestId)21 void AccessibilityElementOperatorCallbackImpl::SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info,
22 const int32_t requestId)
23 {
24 HILOG_DEBUG("Response [requestId:%{public}d]", requestId);
25 accessibilityInfoResult_ = info;
26 promise_.set_value();
27 }
28
SetSearchElementInfoByTextResult(const std::vector<AccessibilityElementInfo> & infos,const int32_t requestId)29 void AccessibilityElementOperatorCallbackImpl::SetSearchElementInfoByTextResult(
30 const std::vector<AccessibilityElementInfo> &infos, const int32_t requestId)
31 {
32 HILOG_DEBUG("Response [elementInfoSize:%{public}zu] [requestId:%{public}d]", infos.size(), requestId);
33 elementInfosResult_ = infos;
34 promise_.set_value();
35 }
36
SetSearchElementInfoByAccessibilityIdResult(const std::vector<AccessibilityElementInfo> & infos,const int32_t requestId)37 void AccessibilityElementOperatorCallbackImpl::SetSearchElementInfoByAccessibilityIdResult(
38 const std::vector<AccessibilityElementInfo> &infos, const int32_t requestId)
39 {
40 HILOG_DEBUG("Response[elementInfoSize:%{public}zu] [requestId:%{public}d]", infos.size(), requestId);
41 elementInfosResult_ = infos;
42 promise_.set_value();
43 }
44
SetFocusMoveSearchResult(const AccessibilityElementInfo & info,const int32_t requestId)45 void AccessibilityElementOperatorCallbackImpl::SetFocusMoveSearchResult(const AccessibilityElementInfo &info,
46 const int32_t requestId)
47 {
48 HILOG_DEBUG("Response [requestId:%{public}d]", requestId);
49 accessibilityInfoResult_ = info;
50 promise_.set_value();
51 }
52
SetExecuteActionResult(const bool succeeded,const int32_t requestId)53 void AccessibilityElementOperatorCallbackImpl::SetExecuteActionResult(const bool succeeded, const int32_t requestId)
54 {
55 HILOG_DEBUG("Response [requestId:%{public}d] result[%{public}d]", requestId, succeeded);
56 executeActionResult_ = succeeded;
57 promise_.set_value();
58 }
59 } // namespace Accessibility
60 } // namespace OHOS