# @ovok/native/bluetooth/web

Canonical page: https://docs.ovok.com/native-sdk/reference/bluetooth-web

The same Bluetooth API in browsers, over Web Bluetooth; nothing here loads `react-native-ble-plx` or
`react-native-permissions`. Import from `@ovok/native/bluetooth/web`.

## Functions [#functions]

### createWebBluetooth() [#createwebbluetooth]

```ts
function createWebBluetooth(__namedParameters): Bluetooth;
```

Bluetooth in a browser, over Web Bluetooth, saving readings to Ovok; loads no React Native module.

#### Parameters [#parameters]

| Parameter | Type |
| ------ | ------ |
| `__namedParameters` | [`CreateWebBluetoothOptions`](#createwebbluetoothoptions) |

#### Returns [#returns]

[`Bluetooth`](bluetooth.mdx#bluetooth)

***

### webBluetoothCentral() [#webbluetoothcentral]

```ts
function webBluetoothCentral(bluetooth): BleCentral;
```

Bluetooth LE in a browser: a scan reports the devices the site may already use, then the device the user picks in
the browser's chooser, which shows only the filter's models and opens only when the filter has entries.

#### Parameters [#parameters-1]

| Parameter | Type |
| ------ | ------ |
| `bluetooth` | [`WebBluetooth`](#webbluetooth) \| `undefined` |

#### Returns [#returns-1]

[`BleCentral`](bluetooth.mdx#blecentral)

## Type Aliases [#type-aliases]

### CreateWebBluetoothOptions [#createwebbluetoothoptions]

```ts
type CreateWebBluetoothOptions = object & Partial<BluetoothOptions>;
```

What `createWebBluetooth` needs; every port can be swapped, for tests or a custom store or sink.

#### Type Declaration [#type-declaration]

| Name | Type | Description |
| ------ | ------ | ------ |
| `ovok` | [`OvokSinkClient`](bluetooth.mdx#ovoksinkclient) | The Ovok client readings are saved through. |
| `savesFor?` | [`SavesFor`](bluetooth.mdx#savesfor) | The patient readings are saved for when the person measuring isn't the patient, such as a clinician; see `SavesFor`. |
| `storage` | `OvokStorage` | Where paired devices are kept between visits. |

***

### WebBluetooth [#webbluetooth]

```ts
type WebBluetooth = object;
```

The part of `navigator.bluetooth` this adapter uses.

#### Methods [#methods]

##### addEventListener() [#addeventlistener]

```ts
addEventListener(type, listener): void;
```

Calls `listener` when the radio is switched on or off.

###### Parameters [#parameters-2]

| Parameter | Type |
| ------ | ------ |
| `type` | `"availabilitychanged"` |
| `listener` | (`event`) => `void` |

###### Returns [#returns-2]

`void`

##### getAvailability() [#getavailability]

```ts
getAvailability(): Promise<boolean>;
```

Whether the browser has a Bluetooth radio it can use.

###### Returns [#returns-3]

`Promise`\<`boolean`\>

##### getDevices()? [#getdevices]

```ts
getDevices?(): Promise<WebDevice[]>;
```

The devices the user already granted; missing in browsers that do not remember grants.

###### Returns [#returns-4]

`Promise`\<`WebDevice`[]\>

##### removeEventListener() [#removeeventlistener]

```ts
removeEventListener(type, listener): void;
```

Stops those calls.

###### Parameters [#parameters-3]

| Parameter | Type |
| ------ | ------ |
| `type` | `"availabilitychanged"` |
| `listener` | (`event`) => `void` |

###### Returns [#returns-5]

`void`

##### requestDevice() [#requestdevice]

```ts
requestDevice(options): Promise<WebDevice>;
```

Opens the browser's chooser and resolves with the device the user picks.

###### Parameters [#parameters-4]

| Parameter | Type |
| ------ | ------ |
| `options` | `object` |

###### Returns [#returns-6]

`Promise`\<`WebDevice`\>

## References [#references]

### AdapterSnapshot [#adaptersnapshot]

Re-exports [AdapterSnapshot](bluetooth.mdx#adaptersnapshot)

***

### AdapterState [#adapterstate]

Re-exports [AdapterState](bluetooth.mdx#adapterstate)

***

### AdvertisementTest [#advertisementtest]

Re-exports [AdvertisementTest](bluetooth.mdx#advertisementtest)

***

### AppLifecycle [#applifecycle]

Re-exports [AppLifecycle](bluetooth.mdx#applifecycle)

***

### AppVisibility [#appvisibility]

Re-exports [AppVisibility](bluetooth.mdx#appvisibility)

***

### Battery [#battery]

Re-exports [Battery](bluetooth.mdx#battery-1)

***

### BleCentral [#blecentral]

Re-exports [BleCentral](bluetooth.mdx#blecentral)

***

### Bluetooth [#bluetooth]

Re-exports [Bluetooth](bluetooth.mdx#bluetooth)

***

### BluetoothOptions [#bluetoothoptions]

Re-exports [BluetoothOptions](bluetooth.mdx#bluetoothoptions)

***

### BluetoothPermission [#bluetoothpermission]

Re-exports [BluetoothPermission](bluetooth.mdx#bluetoothpermission)

***

### BluetoothPermissions [#bluetoothpermissions]

Re-exports [BluetoothPermissions](bluetooth.mdx#bluetoothpermissions)

***

### BluetoothProvider [#bluetoothprovider]

Re-exports [BluetoothProvider](bluetooth.mdx#bluetoothprovider)

***

### BluetoothProviderProps [#bluetoothproviderprops]

Re-exports [BluetoothProviderProps](bluetooth.mdx#bluetoothproviderprops)

***

### BUILT\_IN\_MODELS [#built_in_models]

Re-exports [BUILT_IN_MODELS](bluetooth.mdx#built_in_models)

***

### BUILT\_IN\_PROTOCOLS [#built_in_protocols]

Re-exports [BUILT_IN_PROTOCOLS](bluetooth.mdx#built_in_protocols)

***

### Catalog [#catalog]

Re-exports [Catalog](bluetooth.mdx#catalog)

***

### ConnectionState [#connectionstate]

Re-exports [ConnectionState](bluetooth.mdx#connectionstate)

***

### Device [#device]

Re-exports [Device](bluetooth.mdx#device-1)

***

### DeviceAction [#deviceaction]

Re-exports [DeviceAction](bluetooth.mdx#deviceaction)

***

### DeviceChange [#devicechange]

Re-exports [DeviceChange](bluetooth.mdx#devicechange-1)

***

### DeviceError [#deviceerror]

Re-exports [DeviceError](bluetooth.mdx#deviceerror)

***

### DeviceErrorCode [#deviceerrorcode]

Re-exports [DeviceErrorCode](bluetooth.mdx#deviceerrorcode)

***

### DeviceEvent [#deviceevent]

Re-exports [DeviceEvent](bluetooth.mdx#deviceevent)

***

### DeviceFlag [#deviceflag]

Re-exports [DeviceFlag](bluetooth.mdx#deviceflag)

***

### DeviceIdentity [#deviceidentity]

Re-exports [DeviceIdentity](bluetooth.mdx#deviceidentity)

***

### DeviceModel [#devicemodel]

Re-exports [DeviceModel](bluetooth.mdx#devicemodel)

***

### DeviceProtocol [#deviceprotocol]

Re-exports [DeviceProtocol](bluetooth.mdx#deviceprotocol)

***

### DeviceSecret [#devicesecret]

Re-exports [DeviceSecret](bluetooth.mdx#devicesecret)

***

### DeviceSelector [#deviceselector]

Re-exports [DeviceSelector](bluetooth.mdx#deviceselector)

***

### DeviceSettings [#devicesettings]

Re-exports [DeviceSettings](bluetooth.mdx#devicesettings)

***

### DeviceSnapshot [#devicesnapshot]

Re-exports [DeviceSnapshot](bluetooth.mdx#devicesnapshot-1)

***

### DeviceState [#devicestate]

Re-exports [DeviceState](bluetooth.mdx#devicestate-1)

***

### DiscoverOptions [#discoveroptions]

Re-exports [DiscoverOptions](bluetooth.mdx#discoveroptions)

***

### Discovery [#discovery]

Re-exports [Discovery](bluetooth.mdx#discovery)

***

### DiscoverySnapshot [#discoverysnapshot]

Re-exports [DiscoverySnapshot](bluetooth.mdx#discoverysnapshot-1)

***

### EarSide [#earside]

Re-exports [EarSide](bluetooth.mdx#earside)

***

### EarState [#earstate]

Re-exports [EarState](bluetooth.mdx#earstate)

***

### FactoryReset [#factoryreset]

Re-exports [FactoryReset](bluetooth.mdx#factoryreset)

***

### Found [#found]

Re-exports [Found](bluetooth.mdx#found-1)

***

### GattLink [#gattlink]

Re-exports [GattLink](bluetooth.mdx#gattlink)

***

### HearingAidChange [#hearingaidchange]

Re-exports [HearingAidChange](bluetooth.mdx#hearingaidchange)

***

### HearingAidMode [#hearingaidmode]

Re-exports [HearingAidMode](bluetooth.mdx#hearingaidmode)

***

### HearingAidState [#hearingaidstate]

Re-exports [HearingAidState](bluetooth.mdx#hearingaidstate)

***

### HistoryRecord [#historyrecord]

Re-exports [HistoryRecord](bluetooth.mdx#historyrecord)

***

### HOLD [#hold]

Re-exports [HOLD](bluetooth.mdx#hold)

***

### Identification [#identification]

Re-exports [Identification](bluetooth.mdx#identification)

***

### InEarDetectionChange [#ineardetectionchange]

Re-exports [InEarDetectionChange](bluetooth.mdx#ineardetectionchange)

***

### KeepAlive [#keepalive]

Re-exports [KeepAlive](bluetooth.mdx#keepalive)

***

### LinkOption [#linkoption]

Re-exports [LinkOption](bluetooth.mdx#linkoption)

***

### LiveFrame [#liveframe]

Re-exports [LiveFrame](bluetooth.mdx#liveframe)

***

### LiveResult [#liveresult]

Re-exports [LiveResult](bluetooth.mdx#liveresult)

***

### LiveSpan [#livespan]

Re-exports [LiveSpan](bluetooth.mdx#livespan)

***

### LiveValues [#livevalues]

Re-exports [LiveValues](bluetooth.mdx#livevalues)

***

### Logger [#logger]

Re-exports [Logger](bluetooth.mdx#logger)

***

### MatchRule [#matchrule]

Re-exports [MatchRule](bluetooth.mdx#matchrule)

***

### MeasurementType [#measurementtype]

Re-exports [MeasurementType](bluetooth.mdx#measurementtype)

***

### MetricCode [#metriccode]

Re-exports [MetricCode](bluetooth.mdx#metriccode)

***

### MicrophoneChange [#microphonechange]

Re-exports [MicrophoneChange](bluetooth.mdx#microphonechange)

***

### MicrophoneDirection [#microphonedirection]

Re-exports [MicrophoneDirection](bluetooth.mdx#microphonedirection)

***

### ModeChange [#modechange]

Re-exports [ModeChange](bluetooth.mdx#modechange)

***

### NoiseReductionChange [#noisereductionchange]

Re-exports [NoiseReductionChange](bluetooth.mdx#noisereductionchange)

***

### NoiseScene [#noisescene]

Re-exports [NoiseScene](bluetooth.mdx#noisescene-1)

***

### OutboxView [#outboxview]

Re-exports [OutboxView](bluetooth.mdx#outboxview)

***

### OutboxWatch [#outboxwatch]

Re-exports [OutboxWatch](bluetooth.mdx#outboxwatch)

***

### ovokOutboxWatch [#ovokoutboxwatch]

Re-exports [ovokOutboxWatch](bluetooth.mdx#ovokoutboxwatch)

***

### ovokReadingSink [#ovokreadingsink]

Re-exports [ovokReadingSink](bluetooth.mdx#ovokreadingsink)

***

### OvokSinkClient [#ovoksinkclient]

Re-exports [OvokSinkClient](bluetooth.mdx#ovoksinkclient)

***

### PairedDevice [#paireddevice]

Re-exports [PairedDevice](bluetooth.mdx#paireddevice)

***

### PairedDeviceStore [#paireddevicestore]

Re-exports [PairedDeviceStore](bluetooth.mdx#paireddevicestore)

***

### Pin [#pin]

Re-exports [Pin](bluetooth.mdx#pin-1)

***

### PromptLanguage [#promptlanguage]

Re-exports [PromptLanguage](bluetooth.mdx#promptlanguage-1)

***

### PromptLanguageChange [#promptlanguagechange]

Re-exports [PromptLanguageChange](bluetooth.mdx#promptlanguagechange)

***

### ProtocolContext [#protocolcontext]

Re-exports [ProtocolContext](bluetooth.mdx#protocolcontext)

***

### Quantity [#quantity]

Re-exports [Quantity](bluetooth.mdx#quantity)

***

### Reading [#reading]

Re-exports [Reading](bluetooth.mdx#reading-2)

***

### ReadingSink [#readingsink]

Re-exports [ReadingSink](bluetooth.mdx#readingsink)

***

### ReadingSource [#readingsource]

Re-exports [ReadingSource](bluetooth.mdx#readingsource-1)

***

### ReceivedReading [#receivedreading]

Re-exports [ReceivedReading](bluetooth.mdx#receivedreading)

***

### RecordInfo [#recordinfo]

Re-exports [RecordInfo](bluetooth.mdx#recordinfo)

***

### SaveOutcome [#saveoutcome]

Re-exports [SaveOutcome](bluetooth.mdx#saveoutcome)

***

### SaveReceipt [#savereceipt]

Re-exports [SaveReceipt](bluetooth.mdx#savereceipt)

***

### SavesFor [#savesfor]

Re-exports [SavesFor](bluetooth.mdx#savesfor)

***

### SaveState [#savestate]

Re-exports [SaveState](bluetooth.mdx#savestate)

***

### ScanFilter [#scanfilter]

Re-exports [ScanFilter](bluetooth.mdx#scanfilter)

***

### ScanHandlers [#scanhandlers]

Re-exports [ScanHandlers](bluetooth.mdx#scanhandlers)

***

### Series [#series]

Re-exports [Series](bluetooth.mdx#series-1)

***

### storagePairedDevices [#storagepaireddevices]

Re-exports [storagePairedDevices](bluetooth.mdx#storagepaireddevices)

***

### SyncSummary [#syncsummary]

Re-exports [SyncSummary](bluetooth.mdx#syncsummary)

***

### Transport [#transport]

Re-exports [Transport](bluetooth.mdx#transport)

***

### useBluetooth [#usebluetooth]

Re-exports [useBluetooth](bluetooth.mdx#usebluetooth)

***

### useBluetoothAdapter [#usebluetoothadapter]

Re-exports [useBluetoothAdapter](bluetooth.mdx#usebluetoothadapter)

***

### useCatalog [#usecatalog]

Re-exports [useCatalog](bluetooth.mdx#usecatalog)

***

### useDevice [#usedevice]

Re-exports [useDevice](bluetooth.mdx#usedevice)

***

### useDiscovery [#usediscovery]

Re-exports [useDiscovery](bluetooth.mdx#usediscovery)

***

### useLiveValues [#uselivevalues]

Re-exports [useLiveValues](bluetooth.mdx#uselivevalues)

***

### usePairedDevices [#usepaireddevices]

Re-exports [usePairedDevices](bluetooth.mdx#usepaireddevices)

***

### useReadings [#usereadings]

Re-exports [useReadings](bluetooth.mdx#usereadings)

***

### useWaveform [#usewaveform]

Re-exports [useWaveform](bluetooth.mdx#usewaveform)

***

### Vendor [#vendor]

Re-exports [Vendor](bluetooth.mdx#vendor-2)

***

### VolumeChange [#volumechange]

Re-exports [VolumeChange](bluetooth.mdx#volumechange)

***

### VolumeStep [#volumestep]

Re-exports [VolumeStep](bluetooth.mdx#volumestep)

***

### Waveform [#waveform]

Re-exports [Waveform](bluetooth.mdx#waveform-2)

***

### WaveformBuffer [#waveformbuffer]

Re-exports [WaveformBuffer](bluetooth.mdx#waveformbuffer)
