Skip to content
Snippets Groups Projects
Commit 0c4bdc92 authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Add listener for scan timeout to make scanning state reachable.

This is not yet implemented in the VM, but will be needed when it is.
parent 60992f0b
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ class ScanningStep extends React.Component { ...@@ -9,6 +9,7 @@ class ScanningStep extends React.Component {
super(props); super(props);
bindAll(this, [ bindAll(this, [
'handlePeripheralListUpdate', 'handlePeripheralListUpdate',
'handlePeripheralScanTimeout',
'handleRefresh' 'handleRefresh'
]); ]);
this.state = { this.state = {
...@@ -20,11 +21,18 @@ class ScanningStep extends React.Component { ...@@ -20,11 +21,18 @@ class ScanningStep extends React.Component {
this.props.vm.startDeviceScan(this.props.extensionId); this.props.vm.startDeviceScan(this.props.extensionId);
this.props.vm.on( this.props.vm.on(
'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate); 'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate);
this.props.vm.on(
'PERIPHERAL_SCAN_TIMEOUT', this.handlePeripheralScanTimeout);
} }
componentWillUnmount () { componentWillUnmount () {
// @todo: stop the device scan here // @todo: stop the device scan here
this.props.vm.removeListener( this.props.vm.removeListener(
'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate); 'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate);
this.props.vm.removeListener(
'PERIPHERAL_SCAN_TIMEOUT', this.handlePeripheralScanTimeout);
}
handlePeripheralScanTimeout () {
this.setState({scanning: false});
} }
handlePeripheralListUpdate (newList) { handlePeripheralListUpdate (newList) {
// TODO: sort peripherals by signal strength? so they don't jump around // TODO: sort peripherals by signal strength? so they don't jump around
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment