Class Advertising

Represents the advertising data parser for SwitchBot devices.

Constructors

Methods

Constructors

Methods

  • Parses the advertisement data coming from SwitchBot device.

    This function processes advertising packets received from SwitchBot devices and extracts relevant information based on the device type.

    Parameters

    • peripheral: Peripheral

      The peripheral device object from noble.

    • emitLog: ((level: string, message: string) => void)

      The function to emit log messages.

        • (level, message): void
        • Parameters

          • level: string
          • message: string

          Returns void

    Returns Promise<null | ad>

    • An object containing parsed data specific to the SwitchBot device type, or null if the device is not recognized.
  • Parses the service data based on the device model.

    Parameters

    • model: string

      The device model.

    • serviceData: Buffer

      The service data buffer.

    • manufacturerData: Buffer

      The manufacturer data buffer.

    • emitLog: ((level: string, message: string) => void)

      The function to emit log messages.

        • (level, message): void
        • Parameters

          • level: string
          • message: string

          Returns void

    Returns Promise<any>

    • The parsed service data.