Skip to content

PBartrina/angular-web-bluetooth

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CircleCI

The missing Web Bluetooth module for Angular (v2+)

Install it

Yarn it

yarn add @manekinekko/angular-web-bluetooth

NPM it

npm i -S @manekinekko/angular-web-bluetooth

Use it

1) import the WebBluetoothModule module

import { NgModule } from '@angular/core';
import { WebBluetoothModule } from '@manekinekko/angular-web-bluetooth';

@NgModule({
  imports: [
    //...,
    WebBluetoothModule.forRoot()
  ],
  //...
})
export class AppModule { }

2) use it in your service

See the battery-level.service.ts file for a real use case.

Need a starter?

You're welcome: https://github.com/manekinekko/angular-web-bluetooth-starter

API

These are the most required API calls you will need but there are other helpers you can use (see service here):

Note: a cleaner documentation will come soon

getDevice$(): Observable

@todo: add description

discover$(options?: RequestDeviceOptions): Observable

@todo: add description

getGATT$(): Observable

@todo: add description

getPrimaryService$(gatt: BluetoothRemoteGATTServer, service: BluetoothServiceUUID): Observable

@todo: add description

getCharacteristic$(primaryService: BluetoothRemoteGATTService, characteristic: BluetoothCharacteristicUUID): Observable

@todo: add description

streamValues$(): Observable

@todo: add description

readValue$(characteristic: BluetoothRemoteGATTCharacteristic): Observable

@todo: add description

fakeNext(fakeValue?: Function): void

@todo: add description

Have a PR?

All contributions are welcome ;)

License

The MIT License (MIT) Copyright (c) 2017 - Wassim CHEGHAM

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

The missing Web Bluetooth module for Angular (v2+) πŸ”₯βš‘οΈπŸš€βœ¨πŸŽ‰πŸŽŠ

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 100.0%