1 /* 2 * Copyright (c) 2023 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 USB_MASS_STORAGE_NOTIFICATION_H 17 #define USB_MASS_STORAGE_NOTIFICATION_H 18 19 #include <string> 20 #include "usb_device.h" 21 22 namespace OHOS { 23 namespace USB { 24 const std::string MASS_STORAGE_NOTIFICATION_TITLE_KEY = "notification_title"; 25 const std::string MASS_STORAGE_NOTIFICATION_TEXT_KEY = "notification_text"; 26 const std::string MASS_STORAGE_NOTIFICATION_BUTTON_KEY = "notification_button"; 27 const std::string MASS_STORAGE_NOTIFICATION_LABEL_KEY = "notification_label"; 28 constexpr int32_t SUBSCRIBE_USER_INIT = -1; 29 30 class UsbMassStorageNotification { 31 public: 32 static std::shared_ptr<UsbMassStorageNotification> GetInstance(); 33 ~UsbMassStorageNotification(); 34 void SendNotification(const UsbDevice &dev); 35 void CancelNotification(const std::map<std::string, UsbDevice *> &devices, 36 const UsbDevice &dev, const std::string &name); 37 38 private: 39 UsbMassStorageNotification(); 40 void PublishUsbNotification(); 41 bool IsMassStorage(const UsbDevice &dev); 42 void GetHapString(); 43 void GetFilemanagerBundleName(); 44 45 static std::shared_ptr<UsbMassStorageNotification> instance_; 46 std::map<std::string, std::string> notificationMap = { 47 {MASS_STORAGE_NOTIFICATION_TITLE_KEY, ""}, 48 {MASS_STORAGE_NOTIFICATION_TEXT_KEY, ""}, 49 {MASS_STORAGE_NOTIFICATION_BUTTON_KEY, ""}, 50 {MASS_STORAGE_NOTIFICATION_LABEL_KEY, ""} 51 }; 52 int32_t osAccountId = SUBSCRIBE_USER_INIT; 53 std::string filemanagerBundleName = "com.ohos.filemanager"; 54 std::string filemanagerAbilityName = "MainAbility"; 55 }; 56 } // namespace USB 57 } // namespace OHOS 58 59 #endif 60