1 /* 2 * Copyright (c) 2025 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 #ifndef NETWORKSHARE_NOTIFICATION_H 17 #define NETWORKSHARE_NOTIFICATION_H 18 19 #include <atomic> 20 #include <string> 21 #include "ability_connect_callback_stub.h" 22 #include "ipc_skeleton.h" 23 #include "want.h" 24 #include "want_params_wrapper.h" 25 26 namespace OHOS { 27 namespace NetManagerStandard { 28 29 inline const std::u16string ABILITY_MGR_DESCRIPTOR = u"ohos.aafwk.AbilityManager"; 30 constexpr int DEFAULT_INVAL_VALUE = -1; 31 enum NotificationId { 32 WIFI_PORTAL_NOTIFICATION_ID = 101000, 33 HOTSPOT_IDLE_NOTIFICATION_ID 34 }; 35 36 enum NotificationOpetationType { 37 CANCEL = 0, 38 PUBLISH = 1 39 }; 40 41 class NetworkShareNotification { 42 public: 43 static NetworkShareNotification& GetInstance(void); 44 45 void PublishNetworkShareNotification(NotificationId notificationId); 46 void CancelNetworkShareNotification(NotificationId notificationId); 47 private: 48 int32_t StartAbility(OHOS::AAFwk::Want& want); 49 50 private: 51 std::atomic<bool> isNtfPublished {false}; 52 }; 53 54 } // namespace NetManagerStandard 55 } // namespace OHOS 56 #endif // NETWORKSHARE_SERVICE_H