Show:
Extends webduino.Module

The Barcode class.

Constructor

webduino.module.Barcode
(
  • board
  • rxPin
  • txPin
)

Parameters:

  • board webduino.Board

    The board the barcode scanner is attached to.

  • rxPin webduino.Pin | Number

    Receivin pin (number) the barcode scanner is connected to.

  • txPin webduino.Pin | Number

    Transmitting pin (number) the barcode scanner is connected to.

Methods

addListener
(
  • type
  • listener
)

Add a listener for a certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

emit
(
  • type
  • object,...
)

Emit an event of certain type.

Parameters:

  • type String

    Event type.

  • [object,...] Object optional

    Event object(s).

listeners
(
  • type
)

Return the listener list bound to certain type of event.

Parameters:

  • type String

    Evnet type.

off ()

Stop scanning.

on
(
  • callback
)
deprecated

Inherited from webduino.EventEmitter but overwritten in src/module/Barcode.js:87

Deprecated: `on()` is deprecated, use `scan()` instead.

Start scanning.

Parameters:

  • [callback] Function optional

    Scanning callback.

once
(
  • type
  • listener
)

Add a one-time listener for a certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

removeAllListeners
(
  • type
)

Remove all listeners of certain type.

Parameters:

  • type String

    Event type.

removeListener
(
  • type
  • listener
)

Remove a listener for certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

scan
(
  • callback
)

Start scanning.

Parameters:

  • [callback] Function optional

    Scanning callback.

setMaxListeners
(
  • n
)

Set maximum number of listeners that is allow to bind on an emitter.

Parameters:

  • n Number

    Number of listeners.

Attributes

state

String 'on' or 'off'

The state indicating whether the module is scanning.

type

String readonly

Type of the module.

Events

BarcodeEvent.MESSAGE

Fires when the barcode scanner scans a code.