From 49afea15e603400ff2aa65f68c8db310dd445182 Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Thu, 14 Jun 2018 11:30:05 +0200 Subject: [PATCH] chrome.bluetoothLowEnergy WIP --- types/chrome-apps/index.d.ts | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/types/chrome-apps/index.d.ts b/types/chrome-apps/index.d.ts index 82ab48dbc5..2a4fa9c4ed 100644 --- a/types/chrome-apps/index.d.ts +++ b/types/chrome-apps/index.d.ts @@ -946,10 +946,33 @@ declare namespace chrome { * Note: With Chrome 56, users can select nearby Bluetooth Low Energy devices to provide to web sites that use the Web Bluetooth API. */ namespace bluetoothLowEnergy { - /** - * NOT IMPLEMENTED YET - * @see https://developer.chrome.com/apps/bluetoothLowEnergy - * */ + interface Service { + /** The UUID of the service, e.g. 0000180d-0000-1000-8000-00805f9b34fb. */ + uuid: string; + /** Indicates whether the type of this service is primary or secondary. */ + isPrimary: boolean; + /** + * Returns the identifier assigned to this service. + * Use the instance ID to distinguish between services from a peripheral with the same UUID and to make function calls that take in a service identifier. + * Present, if this instance represents a remote service. + **/ + instanceId?: string; + /** + * The device address of the remote peripheral that the GATT service belongs to. + * Present, if this instance represents a remote service. + */ + deviceAddress?: string; + } + interface Characteristic { + // WIP + } + export function connect(deviceAddress: string, callback: () => void): void; + export function connect(deviceAddress: string, properties: { persistent: boolean }, callback: () => void): void; + export function disconnect(deviceAddress: string, callback: () => void): void; + + /* + WORK IN PROGRESS + */ } /** * Use the chrome.bluetoothSocket API to send and receive data to Bluetooth devices using RFCOMM and L2CAP connections.