brilliant-msg
    Preparing search index...

    Class RxTap

    RxTap class handles tap events from the device. It counts the number of taps within a specified threshold time. It uses a queue to manage tap events and provides methods to attach and detach from a BrilliantMsg instance. It also debounces taps that occur too close together (40ms). The tap count is reset if no taps are detected within the threshold time.

    Index
    • Constructs an instance of the RxTap class.

      Parameters

      • options: RxTapOptions = {}

        Configuration options for the tap handler. Includes msgCode (default: 0x09) and threshold in seconds (default: 0.3).

      Returns RxTap

    queue: AsyncQueue<number> | null

    Asynchronous queue for tap count events. Each event is a number representing the count of taps. Null if not attached.

    • Attaches this RxTap instance to a BrilliantMsg object to receive tap event data. It initializes the tap event queue and registers a handler for incoming data.

      Parameters

      • frame: BrilliantMsg

        The BrilliantMsg instance to attach to.

      Returns Promise<AsyncQueue<number>>

      A Promise that resolves to the AsyncQueue where tap counts (number) will be placed.

    • Detaches this RxTap instance from a BrilliantMsg object. It unregisters the data handler, clears any active timers, and clears the event queue.

      Parameters

      • frame: BrilliantMsg

        The BrilliantMsg instance to detach from.

      Returns void

    • Handles incoming tap event data packets. This method is typically called by a BrilliantMsg instance when a tap event is received. It debounces rapid taps and counts taps within a defined threshold. The accumulated tap count is placed onto the queue when the threshold timer expires.

      Parameters

      • data: Uint8Array

        A Uint8Array containing the tap event data: the msgCode byte, optionally followed by a kind byte (1=single, 2=double, 3=triple) on Halo firmware 0.8.8+.

      Returns void