Rename constants

This commit is contained in:
Ingvar Stepanyan
2021-07-20 13:30:55 +00:00
parent b62b98c725
commit 51864cc154

12
ui.js
View File

@@ -251,8 +251,8 @@ class CaptureButton extends Component {
/** @typedef {{ type: 'CameraPicker' } | { type: 'Status', message: string } | { type: 'Config', config: Config }} AppState */ /** @typedef {{ type: 'CameraPicker' } | { type: 'Status', message: string } | { type: 'Config', config: Config }} AppState */
const DEVICE_CLASS = 6; // PTP const INTERFACE_CLASS = 6; // PTP
const DEVICE_SUBCLASS = 1; // MTP const INTERFACE_SUBCLASS = 1; // MTP
/** @extends Component<null, AppState> */ /** @extends Component<null, AppState> */
class App extends Component { class App extends Component {
@@ -270,8 +270,8 @@ class App extends Component {
for (let intf of conf.interfaces) { for (let intf of conf.interfaces) {
for (let alt of intf.alternates) { for (let alt of intf.alternates) {
if ( if (
alt.interfaceClass === DEVICE_CLASS && alt.interfaceClass === INTERFACE_CLASS &&
alt.interfaceSubclass === DEVICE_SUBCLASS alt.interfaceSubclass === INTERFACE_SUBCLASS
) { ) {
return this.connectToCamera(); return this.connectToCamera();
} }
@@ -294,8 +294,8 @@ class App extends Component {
await navigator.usb.requestDevice({ await navigator.usb.requestDevice({
filters: [ filters: [
{ {
classCode: DEVICE_CLASS, classCode: INTERFACE_CLASS,
subclassCode: DEVICE_SUBCLASS subclassCode: INTERFACE_SUBCLASS
} }
] ]
}); });