Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WebBluetooth BLE GATT Server API Proposal

103 views
Skip to first unread message

Jocelyn Liu

unread,
May 6, 2015, 5:23:48 AM5/6/15
to dev-w...@lists.mozilla.org, dev-bl...@lists.mozilla.org
Hi All,

We bluetooth team have almost finished the implementation of General
Attribute Profile (GATT) client API to add an initial bluetooth low energy
(BLE) support on Firefox OS for privileged apps, which is previously
discussed in the mail list [1], and some known action items will be
addressed before v3 (security review for example). Our next step is to
support GATT server API and we would like to obtain your valuable feedback
on our GATT server API draft.

With GATT server API, applications will be able to provide services for
exposing some information in the local device to remote BLE devices (GATT
clients).

For example,

1.

Alert Notification Service [2]: Expose alert information in a device,
including different types of alerts(ex: email) with the short text
messages, the count of new alert messages, and the count of unread alerts.
A remote GATT client can also subscribe notifications on the alert
information.
2.

Battery Service [3]: Expose the state of battery within a device.
3.

Time-Related Services: Current time service [4] for example.
4.

Customized services defined by applications.


The GATT server API is based on our prior refinement and GATT client API,
and including following additional attributes, methods, dictionaries, and
interfaces.


-

Attribute
-

BluetoothAdapter.gattServer
<https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#BluetoothAdapter>
-

Method
-

BluetoothGattService.addCharacteristic
<https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#BluetoothGattService>
-

BluetoothGattService.addIncludedService
<https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#BluetoothGattService>
-

BluetoothGattCharacteristic.addDescriptor
<https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic#BluetoothGattCharacteristic>
-

Dictionary
-

Permissions
<https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic#Permissions>
-

Interface
-

BluetoothGattServer
<https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#BluetoothGattServer>


Please find the full documentation at
https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2.

Sample code of setting up the GATT server which exposes a service with a
characteristic value for connected GATT clients to read:

if (adapter.gattServer) {

// Setting up a GATT server with a service and a characteristic

var service = new BluetoothGattService(serviceUuid, true);

service.addCharacteristic(

charUuid, {read: true}, {read:true},
*charValue*).then(function(characteristic)
{

gattServer.addService(service);

});

adapter.gattServer.onattributereadreq = function onAttributeReadReq(evt) {

sendResponse(evt.address, 0, evt.requestId, evt.characteristic.value);

};

// Connect to a GATT client which was discovered by classic discovery or
LE scan

// and start to listen to client’s requests

adapter.gattServer.connect(devAddr).then(function() {

console.log(“A GATT client has been connected”);

});

}

[1]
https://groups.google.com/d/topic/mozilla.dev.webapi/Z-ZXdtigktI/discussion

[2]

https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.alert_notification.xml

[3]
https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml
[4]
https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.current_time.xml

Fabrice Desré

unread,
May 6, 2015, 1:38:17 PM5/6/15
to dev-w...@lists.mozilla.org, dev-bl...@lists.mozilla.org
On 05/06/2015 02:23 AM, Jocelyn Liu wrote:

> 4.
>
> Customized services defined by applications.

That part looks really great! Do we also have the client side available
for customized services?

Fabrice
--
Fabrice Desré
b2g team
Mozilla Corporation

Jocelyn Liu

unread,
May 6, 2015, 8:35:09 PM5/6/15
to Fabrice Desré, dev-w...@lists.mozilla.org, dev-bl...@lists.mozilla.org
Hi,

On Thursday, May 7, 2015, Fabrice Desré <fab...@mozilla.com> wrote:

> On 05/06/2015 02:23 AM, Jocelyn Liu wrote:
>
> > 4.
> >
> > Customized services defined by applications.
>
> That part looks really great! Do we also have the client side available
> for customized services?
>
> Fabrice


Good to hear it, we're also excited about it!
Yes, client sides are supported by our GATT client API which we already
discussed and implemented in Firefox OS.

Thanks,
Jocelyn

--
> Fabrice Desré
> b2g team
> Mozilla Corporation
> _______________________________________________
> dev-bluetooth mailing list
> dev-bl...@lists.mozilla.org <javascript:;>
> https://lists.mozilla.org/listinfo/dev-bluetooth
>

Jocelyn Liu

unread,
May 29, 2015, 9:53:37 AM5/29/15
to dev-w...@lists.mozilla.org, dev-bl...@lists.mozilla.org
Hi All,

If there is no disagreement on our current GATT server API draft, we will
start to implement it on Firefox OS from the next week. (Bug 933358)
Please feel free to feedback us on the API draft anytime.

Thanks,
Jocelyn


On Wed, May 6, 2015 at 5:23 PM, Jocelyn Liu <jo...@mozilla.com> wrote:

> Hi All,
>
> We bluetooth team have almost finished the implementation of General
> Attribute Profile (GATT) client API to add an initial bluetooth low energy
> (BLE) support on Firefox OS for privileged apps, which is previously
> discussed in the mail list [1], and some known action items will be
> addressed before v3 (security review for example). Our next step is to
> support GATT server API and we would like to obtain your valuable feedback
> on our GATT server API draft.
>
> With GATT server API, applications will be able to provide services for
> exposing some information in the local device to remote BLE devices (GATT
> clients).
>
> For example,
>
> 1.
>
> Alert Notification Service [2]: Expose alert information in a device,
> including different types of alerts(ex: email) with the short text
> messages, the count of new alert messages, and the count of unread alerts.
> A remote GATT client can also subscribe notifications on the alert
> information.
> 2.
>
> Battery Service [3]: Expose the state of battery within a device.
> 3.
>
> Time-Related Services: Current time service [4] for example.
> 4.
>
> Customized services defined by applications.
>
>
0 new messages