lib/serial/deviceguider.js
function SerialDeviceGuider(deviceLoader) {
  var self = this;

  // call super class
  DeviceGuider.call(this, deviceLoader);

  this.currentState.getDeviceByPort = function(port) {
    return _.find(self.currentState.plugged, function(d) {
      return d.get('portName') && port && d.get('portName').toLowerCase() === port.toLowerCase();
    });
  };

  this.currentState.getConnectedDeviceByPort = function(port) {
    return _.find(self.currentState.connected, function(d) {
      return d.get('portName') && port && d.get('portName').toLowerCase() === port.toLowerCase();
    });
  };
}
function SerialDeviceGuider(deviceLoader) {
  var self = this;

  // call super class
  DeviceGuider.call(this, deviceLoader);

  this.currentState.getDeviceByPort = function(port) {
    return _.find(self.currentState.plugged, function(d) {
      return d.get('portName') && port && d.get('portName').toLowerCase() === port.toLowerCase();
    });
  };

  this.currentState.getConnectedDeviceByPort = function(port) {
    return _.find(self.currentState.connected, function(d) {
      return d.get('portName') && port && d.get('portName').toLowerCase() === port.toLowerCase();
    });
  };
}
function SerialDeviceGuider ( deviceLoader ) { var self = this ; // call super class DeviceGuider . call ( this , deviceLoader ) ; this . currentState . getDeviceByPort = function ( port ) { return _ . find ( self . currentState . plugged , function ( d ) { return d . get ( 'portName' ) && port && d . get ( 'portName' ) . toLowerCase ( ) === port . toLowerCase ( ) ; } ) ; } ; this . currentState . getConnectedDeviceByPort = function ( port ) { return _ . find ( self . currentState . connected , function ( d ) { return d . get ( 'portName' ) && port && d . get ( 'portName' ) . toLowerCase ( ) === port . toLowerCase ( ) ; } ) ; } ; }
A serialdeviceguider emits 'plug' for new attached serial devices,
'unplug' for removed serial devices, emits 'connect' for connected serial devices
and emits 'disconnect' for disconnected serial devices.
@param {SerialDeviceLoader} deviceLoader The deviceloader object.
A serialdeviceguider emits plug for new attached serial devices unplug for removed serial devices emits connect for connected serial devices and emits disconnect for disconnected serial devices .