B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 9: Line 9:
  interface BluetoothGattServer
  interface BluetoothGattServer
  {
  {
   [Cached, Pure]
   [Cached, Pure] readonly attribute sequence<[[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#BluetoothGattService|BluetoothGattService]]> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#services|services]];
  readonly attribute sequence<[[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#BluetoothGattService|BluetoothGattService]]> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#services|services]];
   
             attribute EventHandler ondeviceconnectionstatechanged;
             attribute EventHandler ondeviceconnectionstatechanged;
             attribute EventHandler onattributereadreq;
             attribute EventHandler onattributereadreq;
Line 18: Line 17:
            
            
   [NewObject, Throws] Promise<void> close();
   [NewObject, Throws] Promise<void> close();
   [NewObject, Throws] Promise<void> connect(DOMString aDeviceAddr);
   [NewObject, Throws] Promise<void> connect(DOMString address);
   [NewObject, Throws] Promise<void> disconnect(DOMString aDeviceAddr);
   [NewObject, Throws] Promise<void> disconnect(DOMString address);
   [NewObject, Throws] Promise<void> addService(BluetoothGattService aService);
   [NewObject, Throws] Promise<void> addService(BluetoothGattService service);
   [NewObject, Throws] Promise<void> removeService(BluetoothGattService aService);
   [NewObject, Throws] Promise<void> removeService(BluetoothGattService service);
   [NewObject, Throws] Promise<void> clearServices();
   [NewObject, Throws] Promise<void> clearServices();
   [NewObject, Throws] Promise<void> notifyCharacteristicChanged(DOMString aDeviceAddr, DOMString aUuid, int aInstanceId, bool aConfirm);
   [NewObject, Throws] Promise<void> notifyCharacteristicChanged(DOMString address, DOMString uuid, int instanceId, bool confirm);
   [NewObject, Throws] Promise<void> sendResponse(DOMString aDeviceAddr, int aStatus, int aRequestId, ArrayBuffer aValue);
   [NewObject, Throws] Promise<void> sendResponse(DOMString address, int status, int requestId, ArrayBuffer value);
  };
  };



Revision as of 06:56, 20 November 2014

Overview

BluetoothGattServer provides bluetooth Generic Attribute Profile (GATT) server functionality to create Bluetooth Smart services and characteristics.

Interfaces

BluetoothGattServer

BluetoothGattServer

[CheckPermissions="bluetooth"]
interface BluetoothGattServer
{
  [Cached, Pure] readonly attribute sequence<BluetoothGattService> services;

           attribute EventHandler ondeviceconnectionstatechanged;
           attribute EventHandler onattributereadreq;
           attribute EventHandler onattributewritereq;
           attribute EventHandler onexecutewritereq;
          
  [NewObject, Throws] Promise<void> close();
  [NewObject, Throws] Promise<void> connect(DOMString address);
  [NewObject, Throws] Promise<void> disconnect(DOMString address);
  [NewObject, Throws] Promise<void> addService(BluetoothGattService service);
  [NewObject, Throws] Promise<void> removeService(BluetoothGattService service);
  [NewObject, Throws] Promise<void> clearServices();
  [NewObject, Throws] Promise<void> notifyCharacteristicChanged(DOMString address, DOMString uuid, int instanceId, bool confirm);
  [NewObject, Throws] Promise<void> sendResponse(DOMString address, int status, int requestId, ArrayBuffer value);
};

Properties

services

Description
Array of services offered by this device.
Value Type
sequence<BluetoothGattService>
Default Value
Empty array (array with length = 0)