harmony 鸿蒙Common Events of the USB Subsystem

  • 2023-06-24
  • 浏览 (293)

Common Events of the USB Subsystem

This document lists the common system events provided by the USB subsystem to applications. Applications can use APIs to subscribe to common system events.

COMMON_EVENT_USB_STATE

Indicates that the USB device state has changed.

  • Constant value: “usual.event.hardware.usb.action.USB_STATE”
  • Required subscriber permissions: none

When a USB device is connected to or disconnected from the device, the event notification service is triggered to publish this event.

COMMON_EVENT_USB_PORT_CHANGED

Indicates that the USB port state of the device has changed.

  • Constant value: “usual.event.hardware.usb.action.USB_PORT_CHANGED”
  • Required subscriber permissions: none

When the USB port status changes, the event notification service is triggered to publish this event.

APIs related to this event: dataRole parameter in setPortRoles.

COMMON_EVENT_USB_DEVICE_ATTACHED

Indicates that a USB device has been attached to the device functioning as a USB host.

  • Constant value: “usual.event.hardware.usb.action.USB_DEVICE_ATTACHED”
  • Required subscriber permissions: none

When a USB device is attached, the event notification service is triggered to publish this event.

APIs related to this event: USBDevice.

COMMON_EVENT_USB_DEVICE_DETACHED

Indicates that a USB device has been detached from the device functioning as a USB host.

  • Constant value: “usual.event.hardware.usb.action.USB_DEVICE_DETACHED”
  • Required subscriber permissions: none

When a USB device is deattached, the event notification service is triggered to publish this event.

APIs related to this event: USBDevice.

COMMON_EVENT_USB_ACCESSORY_ATTACHED

(Reserved, not supported yet) Indicates that a USB accessory was attached.

  • Constant value: “usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED”
  • Required subscriber permissions: none

COMMON_EVENT_USB_ACCESSORY_DETACHED

(Reserved, not supported yet) Indicates that a USB accessory was detached.

  • Constant value: “usual.event.data.DISK_MOUNTED”
  • Required subscriber permissions: none

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Common Events

harmony 鸿蒙Common Events of the Ability Subsystem

harmony 鸿蒙Common Events of the Account Subsystem

harmony 鸿蒙Common Events of the Notification Service

harmony 鸿蒙Common Events of the Bundle Management Subsystem

harmony 鸿蒙Common Events of the File Management Subsystem

harmony 鸿蒙Common Events of the Language Subsystem

harmony 鸿蒙Common Events of the SMS Application

harmony 鸿蒙Common Events of the Network Management Subsystem

harmony 鸿蒙Common Events of the NFC Subsystem

0  赞