• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(const std::shared_ptr<KITS::TagInfo>& tagInfo, AAFwk::Want& want);
33     static void DispatchTagAbility(
34         const std::shared_ptr<KITS::TagInfo>& tagInfo, OHOS::sptr<IRemoteObject> tagServiceIface);
35     static void DispatchAbilityMultiApp(const std::shared_ptr<KITS::TagInfo>& tagInfo, AAFwk::Want& want);
36     static void DispatchAppGallery(OHOS::sptr<IRemoteObject> tagServiceIface, std::string appGalleryBundleName);
37     static void DispatchAbilitySingleApp(AAFwk::Want& want);
38     static void StartVibratorOnce(bool isNtfPublished = false);
39 
40 private:
41     // there is only single tag application matched to be dispatched.
42     const static int TAG_APP_MATCHED_SIZE_SINGLE = 1;
43 
44     const static int DEFAULT_MOTOR_VIBRATOR_ONCE = 200; // ms
45 };
46 }  // namespace TAG
47 }  // namespace NFC
48 }  // namespace OHOS
49 #endif  // TAG_ABILITY_DISPATCH_H
50