Skip to content
Snippets Groups Projects
Commit 9b201714 authored by Evelyn Eastmond's avatar Evelyn Eastmond
Browse files

Continuing refactoring: renaming things back to be more verbose, adding JSDocs.

parent f4cd3513
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,7 @@ class AutoScanningStep extends React.Component {
}
handleStartScan () {
this.bindPeripheralUpdates();
this.props.vm.scan(this.props.extensionId);
this.props.vm.scanForPeripheral(this.props.extensionId);
this.setState({
phase: PHASES.pressbutton
});
......
......@@ -17,7 +17,7 @@ class ConnectionModal extends React.Component {
'handleHelp'
]);
this.state = {
phase: props.vm.isConnected(props.extensionId) ?
phase: props.vm.getPeripheralIsConnected(props.extensionId) ?
PHASES.connected : PHASES.scanning
};
}
......@@ -35,7 +35,7 @@ class ConnectionModal extends React.Component {
});
}
handleConnecting (peripheralId) {
this.props.vm.connectToPeripheral(this.props.extensionId, peripheralId);
this.props.vm.connectPeripheral(this.props.extensionId, peripheralId);
this.setState({
phase: PHASES.connecting
});
......@@ -47,13 +47,13 @@ class ConnectionModal extends React.Component {
}
handleDisconnect () {
this.props.onStatusButtonUpdate(this.props.extensionId, 'not ready');
this.props.vm.disconnectExtensionSession(this.props.extensionId);
this.props.vm.disconnectPeripheral(this.props.extensionId);
this.props.onCancel();
}
handleCancel () {
// If we're not connected to a device, close the websocket so we stop scanning.
if (!this.props.vm.isConnected(this.props.extensionId)) {
this.props.vm.disconnectExtensionSession(this.props.extensionId);
if (!this.props.vm.getPeripheralIsConnected(this.props.extensionId)) {
this.props.vm.disconnectPeripheral(this.props.extensionId);
}
this.props.onCancel();
}
......
......@@ -18,7 +18,7 @@ class ScanningStep extends React.Component {
};
}
componentDidMount () {
this.props.vm.scan(this.props.extensionId);
this.props.vm.scanForPeripheral(this.props.extensionId);
this.props.vm.on(
'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate);
this.props.vm.on(
......@@ -45,7 +45,7 @@ class ScanningStep extends React.Component {
this.setState({deviceList: peripheralArray});
}
handleRefresh () {
this.props.vm.scan(this.props.extensionId);
this.props.vm.scanForPeripheral(this.props.extensionId);
this.setState({
scanning: true,
deviceList: []
......
......@@ -209,7 +209,7 @@ export default function (vm) {
};
ScratchBlocks.FlyoutExtensionCategoryHeader.getExtensionState = function (extensionId) {
if (vm.isConnected(extensionId)) {
if (vm.getPeripheralIsConnected(extensionId)) {
return ScratchBlocks.StatusButtonState.READY;
}
return ScratchBlocks.StatusButtonState.NOT_READY;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment