Skip to main content
Version: v3

mstStartScan

Start from API_LEVEL 3.0 . Please refer to API_LEVEL.

Scan and discover Bluetooth peripherals, which can be filtered according to filter conditions.

Type

function mstStartScan(callback: Callback, filter?: Filter): Result

Parameters

Callback

TypeDescription
(result: ScanResult, filter?: Filter) => voidCallback function for receiving scan results

ScanResult

PropertyTypeDescriptionAPI_LEVEL
dev_namestringDevice name3.0
dev_addrArrayBufferDevice MAC address, 6 bytes long, Uint8Array view recommended3.0
rssinumberRSSI Signal Strength3.0
service_uuid_arrayArray<string>Service UUID array in broadcast data3.0
service_data_arrayArray<ServiceData>Array of Service Data Objects in Broadcast Data3.0

ServiceData

PropertyTypeDescriptionAPI_LEVEL
uuidstringService UUID3.0
service_dataArrayBufferService data3.0

Filter

PropertyTypeRequiredDefaultValueDescriptionAPI_LEVEL
device_namestringN-Device name3.0
fuzzy_modestringN-Whether to use fuzzy mode for device name matching3.0
service_uuidstringN-Service UUID3.0
service_data_uuidstringN-Service data UUID3.0
manufacturer_idnumberN-Manufacturer ID3.0

Result

TypeDescription
booleanThe result of the function call, true means success, false means failure

Example

import { mstStartScan } from '@zos/ble'

// ...