1.0.6 • Published 12 months ago

pebblebee-bluetooth-web-sdk v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

pebblebee-bluetooth-web-sdk

This project provides a set of functions and tools to simplify the use of the web bluetooth api to connect and manage Pebblebee device

Important notes

Functions

bluetoothAvailable()

Returns a boolean that represents if bluetooth is available for the browser
response
    {
        //in case of error it will be false
        btAvailable: boolean
        error: boolean,
        message: string
    }

connectToDeviceByMac(macAddress, deviceDisconnectedCallback)

This function will the search devices dialog of the OS, onces the user selects one, it will return the select device object (BluetoothDevice).
Params
    //used to filter the results that show in the connection dialog. 
    //hexadecimal, valid formats XXXXXXXXXXXX XX:XX:XX:XX:XX:XX XX-XX-XX-XX-XX-XX
    macAddress: string
    //This function will be invoque in case the device disconnects
    deviceDisconnectedCallback: function () => void
response
    {
        device: BluetoothDevice | undefined,
        error: boolean,
        message: string
    }

getBatteryPercentage(device)

This function connect to the device battery service and parse the battery level into a percentage.
Params
    //The device that the action is perfomed on
    device: BluetoothDevice 
response
    {
        //if there is and error this will be 0
        batteryPercentage: number,
        error: boolean,
        message: string
    }

buzz(device)

This function will connect to the device and send a "buzz" command to it
Params
    //The device that the action is perfomed on
    device: BluetoothDevice;
response
    {
        error: boolean,
        message: string
    }

stopBuzz(device)

This function will connect to the device and send a "stop buzzing" command to it

Params

    //The device that the action is perfomed on
    device: BluetoothDevice
response
    {
        error: boolean,
        message: string
    }
1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago