SBTNotifictionDeviceContect.swift 723 B

123456789101112131415161718192021222324252627
  1. //
  2. // SBTNotifictionDeviceContect.swift
  3. // SolarBT
  4. //
  5. // Created by weclouds on 2019/6/26.
  6. // Copyright © 2019 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class SBTNotifictionDeviceContect: NSObject {
  10. }
  11. extension UIViewController{
  12. func checkTheBlueToothWasActivity() {
  13. NotificationCenter.default.addObserver(self, selector: #selector(m_showAlert), name: NSNotification.Name(kBabyBluetoothNotificationDeviceWasDisconect), object: nil)
  14. }
  15. @objc func m_showAlert(notif: Notification) {
  16. let dict = notif.userInfo as! [String:String]
  17. let periName = dict["peripheral"]
  18. g_showHUD( periName! + "The_Bluetooth_has_been_disconnected".da_localizedStr())
  19. }
  20. }