Confirmed users
16
edits
(Removing 'storage' type but adding 'keyboard', 'mouse', and 'camera' types.) |
(Bring 'storage' type back) |
||
| Line 36: | Line 36: | ||
=== USB Port Interface === | === USB Port Interface === | ||
==== Basic ==== | ==== Basic ==== | ||
enum USBPortType { " | enum USBPortType { "storage", "keyboard", "mouse" }; | ||
interface USBPort : EventTarget { | interface USBPort : EventTarget { | ||
readonly attribute DOMString id; | readonly attribute DOMString id; | ||
readonly attribute DOMString name; | |||
readonly attribute USBPortType type; | readonly attribute USBPortType type; | ||
readonly attribute boolean connected; | readonly attribute boolean connected; | ||
}; | }; | ||
'''id''' of type DOMString, readonly <br/> | '''id''' of type DOMString, readonly <br/> | ||
The unique identifier for the represented USB port. It MUST be unique to the application, and persistent between application sessions. | The unique identifier for the represented USB port. It MUST be unique to the application, and persistent between application sessions. | ||
'''name''' of type DOMString, readonly <br/> | |||
The name of this USB port. | |||
'''type''' of type USBPortType, readonly <br/> | '''type''' of type USBPortType, readonly <br/> | ||
| Line 55: | Line 57: | ||
True if this USB port is connected, and vice versa. | True if this USB port is connected, and vice versa. | ||
''' | ==== Storage ==== | ||
''' | ''In reality, a specific USB port may have its specific attributes and methods. And our goal is to collect the "common" ones as many as possible. However, with limited information, we will not focus on implementing hardware dependent members in this draft.'' | ||
Whenever the hardware detects | |||
interface StorageUSBPort : USBPort { | |||
readonly attribute unsigned long long totalSpace; | |||
readonly attribute unsigned long long availableSpace; | |||
readonly attribute DOMString fileSystem; | |||
attribute EventHandler onAvailableSpaceChange; | |||
// Other possible hardware-dependent attributes. | |||
}; | |||
'''totalSpace''' of type unsigned long long, readonly <br/> | |||
The total space of the USB storage device. | |||
'''availableSpace''' of type unsigned long long, readonly <br/> | |||
The available space of the USB storage device. | |||
'''fileSystem''' of type DOMString, readonly <br/> | |||
The type of the file system, e.g. FAT32, NTFS, etc. | |||
'''onAvailableSpaceChange''' of type EventHandler <br/> | |||
Whenever the hardware detects a change on the available space, an simple event with the updated available space against the USB port should be fired. | |||
==== Keyboard ==== | ==== Keyboard ==== | ||
interface KeyboardUSBPort : USBPort { | interface KeyboardUSBPort : USBPort { | ||
| Line 69: | Line 89: | ||
interface MouseUSBPort : USBPort { | interface MouseUSBPort : USBPort { | ||
// Possible hardware-dependent attributes. | // Possible hardware-dependent attributes. | ||
}; | }; | ||