diff --git a/src/containers/auto-scanning-step.jsx b/src/containers/auto-scanning-step.jsx index e5cdf457d169e93faff87498e92ed72ce33a084e..4987290b11a7ffdb5f75b9c9d6049b8795387b4e 100644 --- a/src/containers/auto-scanning-step.jsx +++ b/src/containers/auto-scanning-step.jsx @@ -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 }); diff --git a/src/containers/connection-modal.jsx b/src/containers/connection-modal.jsx index 9471ccc960044b8ed9aa35dc6f728d7f46f4b0e8..b81c0d36f1f0ee9ce1f79964a044dd306152da67 100644 --- a/src/containers/connection-modal.jsx +++ b/src/containers/connection-modal.jsx @@ -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(); } diff --git a/src/containers/scanning-step.jsx b/src/containers/scanning-step.jsx index f83a7d3f2c769ec81acaf38f080c24d4994ae867..d01b5e60cfeffe814b87c829650d444d0e719b5e 100644 --- a/src/containers/scanning-step.jsx +++ b/src/containers/scanning-step.jsx @@ -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: [] diff --git a/src/lib/blocks.js b/src/lib/blocks.js index 5896760ea6fb8fd62e88a4e34dca85c4d36c600e..f6b78b68ee4a325c5d03701e8d484466ba856f0c 100644 --- a/src/lib/blocks.js +++ b/src/lib/blocks.js @@ -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;