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 #ifndef TAG_ABILITY_DISPATCH_H
16 #define TAG_ABILITY_DISPATCH_H
17 #include <map>
18 #include <mutex>
19 #include "ability_info.h"
20 #include "element_name.h"
21 #include "taginfo.h"
22 #include "want.h"
23 
24 namespace OHOS {
25 namespace NFC {
26 namespace TAG {
27 class TagAbilityDispatcher final {
28 public:
29     explicit TagAbilityDispatcher();
30     ~TagAbilityDispatcher();
31 
32     static void SetWantExtraParam(std::shared_ptr<KITS::TagInfo>& tagInfo, AAFwk::Want &want);
33     static void DispatchTagAbility(std::shared_ptr<KITS::TagInfo> tagInfo, OHOS::sptr<IRemoteObject> tagServiceIface);
34     static void DispatchAbilityMultiApp(std::shared_ptr<KITS::TagInfo> tagInfo, AAFwk::Want& want);
35     static void DispatchAppGallery(OHOS::sptr<IRemoteObject> tagServiceIface, std::string appGalleryBundleName);
36     static void DispatchAbilitySingleApp(AAFwk::Want& want);
37     static void StartVibratorOnce();
38 
39 private:
40     // there is only single tag application matched to be dispatched.
41     const static int TAG_APP_MATCHED_SIZE_SINGLE = 1;
42 
43     const static int DEFAULT_MOTOR_VIBRATOR_ONCE = 200; // ms
44 };
45 }  // namespace TAG
46 }  // namespace NFC
47 }  // namespace OHOS
48 #endif  // TAG_ABILITY_DISPATCH_H
49