hammerspoon2-docs
    Preparing search index...

    Function scan

    • Scans for BLE peripherals nearby. Only one scan can run at a time.

      Each peripheral found is also delivered to 'discovered' listeners (see on()) as soon as it's seen.

      Parameters

      • Optionaloptions: { allowDuplicates?: boolean; seconds?: number; services?: string[] } | null

        How to scan

        • { allowDuplicates?: boolean; seconds?: number; services?: string[] }
          • OptionalallowDuplicates?: boolean

            Deliver every advertisement to 'discovered' listeners, not just the first from each peripheral, e.g. to follow signal strength. Defaults to false

          • Optionalseconds?: number

            How long to scan for, counted from when Bluetooth is ready (e.g. after the permission prompt is answered). Defaults to 10

          • Optionalservices?: string[]

            Only report peripherals advertising one of these service UUIDs

        • null

      Returns Promise<HSBluetoothPeripheral[]>

      A Promise resolving to the peripherals found when the scan ends, or when stopScan() is called. Rejects if a scan is already running, the options are invalid, or Bluetooth is unavailable