Methods

static

notify(deviceHandle, characteristicHandle, data, win, fail)

Sends a notification to a remote device that a characteristic's value has been updated.

Parameters

Name Type Optional Description

deviceHandle

int

 

From a connectionStateChangeCallback.

characteristicHandle

int

 

GattCharacteristic.handle

data

ArrayBufferView

 

The characteristic's new value.

win

emptyCallback

 

fail

failCallback

 

static

sendResponse(deviceHandle, requestId, data, win, fail)

Sends a response to a read or write request.

Parameters

Name Type Optional Description

deviceHandle

int

 

From a requestCallback.

requestId

int

 

From the same requestCallback as deviceHandle.

data

ArrayBufferView

 

Required for responses to read requests. May be set to null for write requests.

win

emptyCallback

 

fail

failCallback

 

static

startAdvertise(settings, win, fail)

Starts BLE advertise. Fails if advertise is running. In that case, call stopAdvertise first.

Parameters

Name Type Optional Description

settings

AdvertiseSettings

 

win

emptyCallback

 

fail

failCallback

 

static

startGattServer(settings, win, fail)

Starts the GATT server. There can be only one server. If this function is called while the server is still running, the call will fail. Once this function succeeds, the server may be stopped by calling stopGattServer.

Parameters

Name Type Optional Description

settings

GattSettings

 

win

emptyCallback

 

fail

failCallback

 

static

stopAdvertise(win, fail)

Stops BLE advertise.

Parameters

Name Type Optional Description

win

emptyCallback

 

fail

failCallback

 

static

stopGattServer(win, fail)

Stops the GATT server. This stops any active advertisements and forcibly disconnects any clients. There can be only one server. If startGattServer() returned success, you may call this function once. Calling it more will result in failure.

Parameters

Name Type Optional Description

win

emptyCallback

 

fail

failCallback