├── .editorconfig ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── Bug_report.md │ └── Feature_request.md └── workflows │ └── angular.yml ├── .gitignore ├── .nvmrc ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── _config.yml ├── angular.json ├── docs ├── changelog.html ├── classes │ ├── AppPage.html │ ├── FakeBluetoothDevice.html │ ├── FakeBluetoothRemoteGATTCharacteristic.html │ ├── FakeBluetoothRemoteGATTServer.html │ └── FakeBluetoothRemoteGATTService.html ├── components │ ├── AppComponent.html │ ├── BatteryLevelComponent.html │ ├── DashboardComponent.html │ ├── DemoComponent.html │ ├── HumidityComponent.html │ ├── StepCounterComponent.html │ └── TemperatureComponent.html ├── coverage.html ├── dependencies.html ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── fontawesome-webfont.woff2 │ ├── ionicons.eot │ ├── ionicons.svg │ ├── ionicons.ttf │ ├── ionicons.woff │ ├── ionicons.woff2 │ ├── roboto-v15-latin-300.eot │ ├── roboto-v15-latin-300.svg │ ├── roboto-v15-latin-300.ttf │ ├── roboto-v15-latin-300.woff │ ├── roboto-v15-latin-300.woff2 │ ├── roboto-v15-latin-700.eot │ ├── roboto-v15-latin-700.svg │ ├── roboto-v15-latin-700.ttf │ ├── roboto-v15-latin-700.woff │ ├── roboto-v15-latin-700.woff2 │ ├── roboto-v15-latin-italic.eot │ ├── roboto-v15-latin-italic.svg │ ├── roboto-v15-latin-italic.ttf │ ├── roboto-v15-latin-italic.woff │ ├── roboto-v15-latin-italic.woff2 │ ├── roboto-v15-latin-regular.eot │ ├── roboto-v15-latin-regular.svg │ ├── roboto-v15-latin-regular.ttf │ ├── roboto-v15-latin-regular.woff │ └── roboto-v15-latin-regular.woff2 ├── graph │ └── dependencies.svg ├── images │ ├── compodoc-vectorise-inverted.png │ ├── compodoc-vectorise-inverted.svg │ ├── compodoc-vectorise.png │ ├── compodoc-vectorise.svg │ ├── coverage-badge-documentation.svg │ ├── coverage-badge.svg │ └── favicon.ico ├── index.html ├── injectables │ ├── BatteryLevelService.html │ ├── BleService.html │ ├── BluetoothCore.html │ ├── BrowserWebBluetooth.html │ ├── ConsoleLoggerService.html │ ├── HumidityThingy52Service.html │ ├── NoLoggerService.html │ ├── ServerWebBluetooth.html │ └── TemperatureThingy52Service.html ├── interfaces │ ├── AWBOptions.html │ └── Logger.html ├── js │ ├── compodoc.js │ ├── lazy-load-graphs.js │ ├── libs │ │ ├── EventDispatcher.js │ │ ├── bootstrap-native.js │ │ ├── clipboard.min.js │ │ ├── custom-elements-es5-adapter.js │ │ ├── custom-elements.min.js │ │ ├── d3.v3.min.js │ │ ├── deep-iterator.js │ │ ├── es6-shim.min.js │ │ ├── htmlparser.js │ │ ├── innersvg.js │ │ ├── lit-html.js │ │ ├── prism.js │ │ ├── promise.min.js │ │ ├── svg-pan-zoom.min.js │ │ ├── tablesort.min.js │ │ ├── tablesort.number.min.js │ │ ├── vis.min.js │ │ └── zepto.min.js │ ├── menu-wc.js │ ├── menu-wc_es5.js │ ├── menu.js │ ├── routes.js │ ├── search │ │ ├── lunr.min.js │ │ ├── search-lunr.js │ │ ├── search.js │ │ └── search_index.js │ ├── sourceCode.js │ ├── svg-pan-zoom.controls.js │ ├── tabs.js │ └── tree.js ├── license.html ├── miscellaneous │ ├── functions.html │ ├── typealiases.html │ └── variables.html ├── modules.html ├── modules │ ├── AppModule.html │ ├── AppModule │ │ └── dependencies.svg │ └── WebBluetoothModule.html ├── overview.html ├── properties.html └── styles │ ├── bootstrap-card.css │ ├── bootstrap.min.css │ ├── compodoc.css │ ├── dark.css │ ├── font-awesome.min.css │ ├── ionicons.min.css │ ├── laravel.css │ ├── material.css │ ├── original.css │ ├── postmark.css │ ├── prism.css │ ├── readthedocs.css │ ├── reset.css │ ├── stripe.css │ ├── style.css │ ├── tablesort.css │ └── vagrant.css ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── jest.config.js ├── package-lock.json ├── package.json ├── projects └── manekinekko │ └── angular-web-bluetooth │ ├── .release-it.json │ ├── README.md │ ├── jest.config.js │ ├── ng-package.json │ ├── package.json │ ├── src │ ├── lib │ │ ├── bluetooth.module.ts │ │ ├── bluetooth.service.spec.ts │ │ ├── bluetooth.service.ts │ │ ├── lang │ │ │ └── uuids │ │ │ │ ├── index.ts │ │ │ │ └── ti-sensortag2.ts │ │ ├── logger.service.ts │ │ ├── platform │ │ │ ├── browser.ts │ │ │ └── server.ts │ │ └── test.utils.ts │ └── public_api.ts │ ├── test-setup.ts │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ └── tsconfig.spec.json ├── src ├── app │ ├── app.component.ts │ ├── app.module.ts │ ├── ble.service.spec.ts │ ├── ble.service.ts │ ├── dashboard │ │ ├── dashboard.component.css │ │ ├── dashboard.component.html │ │ └── dashboard.component.ts │ └── thingy52 │ │ ├── __snapshots__ │ │ └── battery-level.component.spec.ts.snap │ │ ├── battery-level.component.spec.ts │ │ ├── battery-level.component.ts │ │ ├── humidity.component.ts │ │ ├── stepcounter.component.ts │ │ └── temperature.component.ts ├── assets │ ├── .gitkeep │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── angular-web-ble.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── screenshot.png │ └── site.webmanifest ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── styles.css └── typing.d.ts ├── test-setup.ts ├── tsconfig.app.json ├── tsconfig.json └── tsconfig.spec.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: manekinekko 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Desktop (please complete the following information):** 24 | - OS: [e.g. iOS] 25 | - Browser [e.g. chrome, safari] 26 | - Version [e.g. 22] 27 | 28 | **Smartphone (please complete the following information):** 29 | - Device: [e.g. iPhone6] 30 | - OS: [e.g. iOS8.1] 31 | - Browser [e.g. stock browser, safari] 32 | - Version [e.g. 22] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/workflows/angular.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Angular CI 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | pull_request: 10 | branches: [ main ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [18.x] 20 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 21 | 22 | steps: 23 | - uses: actions/checkout@v2 24 | - name: Use Node.js ${{ matrix.node-version }} 25 | uses: actions/setup-node@v2 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | - run: npm ci --legacy-peer-deps 29 | - run: npm run build --if-present 30 | - run: npm test 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.angular/cache 29 | /.sass-cache 30 | /connect.lock 31 | /coverage 32 | /libpeerconnection.log 33 | npm-debug.log 34 | yarn-error.log 35 | testem.log 36 | /typings 37 | 38 | # System Files 39 | .DS_Store 40 | Thumbs.db 41 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at github@wassimchegham.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) Copyright (c) 2017 - Wassim CHEGHAM 3 | 4 | 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: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | 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. 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

The missing Web Bluetooth module for Angular

5 |

6 | 7 | ## Install 8 | 9 | ``` 10 | npm install -S @manekinekko/angular-web-bluetooth @types/web-bluetooth 11 | ``` 12 | 13 | > Note: Make also sure the `@types/web-bluetooth` is installed correctly in your `node_modules`. 14 | 15 | ## Getting started 16 | 17 | ## 1) import the `WebBluetoothModule` module 18 | 19 | ```typescript 20 | import { NgModule } from '@angular/core'; 21 | import { WebBluetoothModule } from '@manekinekko/angular-web-bluetooth'; 22 | 23 | @NgModule({ 24 | imports: [ 25 | //..., 26 | WebBluetoothModule.forRoot({ 27 | enableTracing: true // or false, this will enable logs in the browser's console 28 | }) 29 | ] 30 | //... 31 | }) 32 | export class AppModule {} 33 | ``` 34 | 35 | ## 2.a) use it in your service/component (the easiest way) 36 | 37 | Here is an annotated example using the `BluetoothCore` service: 38 | 39 | ```javascript 40 | import { Injectable } from '@angular/core'; 41 | import { BluetoothCore } from '@manekinekko/angular-web-bluetooth'; 42 | import { map } from 'rxjs/operators'; 43 | 44 | @Injectable({ 45 | providedIn: 'root' 46 | }) 47 | export class BatteryLevelService { 48 | 49 | constructor(public readonly ble: BluetoothCore) {} 50 | 51 | getDevice() { 52 | // call this method to get the connected device 53 | return this.ble.getDevice$(); 54 | } 55 | 56 | stream() { 57 | // call this method to get a stream of values emitted by the device for a given characteristic 58 | return this.ble.streamValues$().pipe( 59 | map((value: DataView) => value.getInt8(0)) 60 | ); 61 | } 62 | 63 | disconnectDevice() { 64 | // call this method to disconnect from the device. This method will also stop clear all subscribed notifications 65 | this.ble.disconnectDevice(); 66 | } 67 | 68 | value() { 69 | console.log('Getting Battery level...'); 70 | 71 | return this.ble 72 | .value$({ 73 | service: 'battery_service', 74 | characteristic: 'battery_level' 75 | }); 76 | } 77 | 78 | } 79 | ``` 80 | 81 | 82 | ## 2.b) use it in your service/component (the advanced way) 83 | 84 | Here is an annotated example using the `BluetoothCore` service: 85 | 86 | ```javascript 87 | import { Injectable } from '@angular/core'; 88 | import { map, mergeMap } from 'rxjs/operators'; 89 | import { BluetoothCore } from '@manekinekko/angular-web-bluetooth'; 90 | 91 | @Injectable({ 92 | providedIn: 'root' 93 | }) 94 | export class BatteryLevelService { 95 | static GATT_CHARACTERISTIC_BATTERY_LEVEL = 'battery_level'; 96 | static GATT_PRIMARY_SERVICE = 'battery_service'; 97 | 98 | constructor(public ble: BluetoothCore) {} 99 | 100 | getDevice() { 101 | // call this method to get the connected device 102 | return this.ble.getDevice$(); 103 | } 104 | 105 | stream() { 106 | // call this method to get a stream of values emitted by the device 107 | return this.ble.streamValues$().pipe(map((value: DataView) => value.getUint8(0))); 108 | } 109 | 110 | disconnectDevice() { 111 | this.ble.disconnectDevice(); 112 | } 113 | 114 | /** 115 | * Get Battery Level GATT Characteristic value. 116 | * This logic is specific to this service, this is why we can't abstract it elsewhere. 117 | * The developer is free to provide any service, and characteristics they want. 118 | * 119 | * @return Emites the value of the requested service read from the device 120 | */ 121 | value() { 122 | console.log('Getting Battery level...'); 123 | 124 | return this.ble 125 | 126 | // 1) call the discover method will trigger the discovery process (by the browser) 127 | .discover$({ 128 | acceptAllDevices: true, 129 | optionalServices: [BatteryLevelService.GATT_PRIMARY_SERVICE] 130 | }) 131 | .pipe( 132 | 133 | // 2) get that service 134 | mergeMap((gatt: BluetoothRemoteGATTServer) => { 135 | return this.ble.getPrimaryService$(gatt, BatteryLevelService.GATT_PRIMARY_SERVICE); 136 | }), 137 | 138 | // 3) get a specific characteristic on that service 139 | mergeMap((primaryService: BluetoothRemoteGATTService) => { 140 | return this.ble.getCharacteristic$(primaryService, BatteryLevelService.GATT_CHARACTERISTIC_BATTERY_LEVEL); 141 | }), 142 | 143 | // 4) ask for the value of that characteristic (will return a DataView) 144 | mergeMap((characteristic: BluetoothRemoteGATTCharacteristic) => { 145 | return this.ble.readValue$(characteristic); 146 | }), 147 | 148 | // 5) on that DataView, get the right value 149 | map((value: DataView) => value.getUint8(0)) 150 | ) 151 | } 152 | } 153 | ``` 154 | 155 | ## API documentation 156 | 157 | The API documentation can be found here: https://manekinekko.github.io/angular-web-bluetooth/ 158 | 159 | ## Need a starter? 160 | 161 | 162 | 163 | This project serves also as a starter. Run the following command: 164 | 165 | ```bash 166 | npm start 167 | ``` 168 | 169 | ## Blog post 170 | 171 | Checkout my full [blog post on dev.to](https://dev.to/angular/the-web-bluetooth-module-for-angular-314b) about how to use this package in your app. 172 | 173 | ## Have a PR? 174 | 175 | All contributions are welcome. Here are few [open issues](https://github.com/manekinekko/angular-web-bluetooth/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) that I need help with ;) 176 | 177 | # License 178 | 179 | The MIT License (MIT) Copyright (c) 2017 - Wassim CHEGHAM 180 | 181 | 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: 182 | 183 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 184 | 185 | 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. 186 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "angular-web-bluetooth-starter": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "ble", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:application", 15 | "options": { 16 | "outputPath": "dist/angular-web-bluetooth-starter", 17 | "index": "src/index.html", 18 | "browser": "src/main.ts", 19 | "polyfills": [ 20 | "zone.js" 21 | ], 22 | "tsConfig": "tsconfig.app.json", 23 | "assets": [ 24 | "src/favicon.ico", 25 | "src/assets" 26 | ], 27 | "styles": [ 28 | "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", 29 | "src/styles.css" 30 | ], 31 | "scripts": [ 32 | "./node_modules/smoothie/smoothie.js" 33 | ] 34 | }, 35 | "configurations": { 36 | "production": { 37 | "budgets": [ 38 | { 39 | "type": "initial", 40 | "maximumWarning": "500kb", 41 | "maximumError": "1mb" 42 | }, 43 | { 44 | "type": "anyComponentStyle", 45 | "maximumWarning": "2kb", 46 | "maximumError": "4kb" 47 | } 48 | ], 49 | "outputHashing": "all" 50 | }, 51 | "development": { 52 | "optimization": false, 53 | "extractLicenses": false, 54 | "sourceMap": true 55 | } 56 | }, 57 | "defaultConfiguration": "production" 58 | }, 59 | "serve": { 60 | "builder": "@angular-devkit/build-angular:dev-server", 61 | "configurations": { 62 | "production": { 63 | "buildTarget": "angular-web-bluetooth-starter:build:production" 64 | }, 65 | "development": { 66 | "buildTarget": "angular-web-bluetooth-starter:build:development" 67 | } 68 | }, 69 | "defaultConfiguration": "development" 70 | }, 71 | "extract-i18n": { 72 | "builder": "@angular-devkit/build-angular:extract-i18n", 73 | "options": { 74 | "buildTarget": "angular-web-bluetooth-starter:build" 75 | } 76 | }, 77 | "test": { 78 | "builder": "@angular-builders/jest:run", 79 | "options": { 80 | "setupFilesAfterEnv": "/test-setup.ts", 81 | "detectOpenHandles": true 82 | } 83 | }, 84 | "e2e": { 85 | "builder": "@angular-devkit/build-angular:protractor", 86 | "options": { 87 | "protractorConfig": "e2e/protractor.conf.js", 88 | "devServerTarget": "angular-web-bluetooth-starter:serve" 89 | }, 90 | "configurations": { 91 | "production": { 92 | "devServerTarget": "angular-web-bluetooth-starter:serve:production" 93 | } 94 | } 95 | } 96 | } 97 | }, 98 | "@manekinekko/angular-web-bluetooth": { 99 | "projectType": "library", 100 | "root": "projects/manekinekko/angular-web-bluetooth", 101 | "sourceRoot": "projects/manekinekko/angular-web-bluetooth/src", 102 | "prefix": "lib", 103 | "architect": { 104 | "build": { 105 | "builder": "@angular-devkit/build-angular:ng-packagr", 106 | "options": { 107 | "project": "projects/manekinekko/angular-web-bluetooth/ng-package.json" 108 | }, 109 | "configurations": { 110 | "production": { 111 | "tsConfig": "projects/manekinekko/angular-web-bluetooth/tsconfig.lib.prod.json" 112 | }, 113 | "development": { 114 | "tsConfig": "projects/manekinekko/angular-web-bluetooth/tsconfig.lib.json" 115 | } 116 | }, 117 | "defaultConfiguration": "production" 118 | }, 119 | "test": { 120 | "builder": "@angular-builders/jest:run", 121 | "options": { 122 | "setupFilesAfterEnv": "./test-setup.ts", 123 | "detectOpenHandles": true 124 | } 125 | } 126 | } 127 | } 128 | }, 129 | "cli": { 130 | "analytics": "6c503e91-213a-464d-801c-5af37e13087c" 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /docs/dependencies.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | angular-web-bluetooth-starter documentation 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 74 | 75 | 79 | 80 | 83 | 84 |
85 |
86 | 89 | 90 |
91 |
92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 110 |
    111 |
  • 112 | @angular/animations : ^17.1.3
  • 113 |
  • 114 | @angular/cdk : ^17.1.2
  • 115 |
  • 116 | @angular/common : ^17.1.3
  • 117 |
  • 118 | @angular/compiler : ^17.1.3
  • 119 |
  • 120 | @angular/core : ^17.1.3
  • 121 |
  • 122 | @angular/forms : ^17.1.3
  • 123 |
  • 124 | @angular/material : ^17.1.2
  • 125 |
  • 126 | @angular/platform-browser : ^17.1.3
  • 127 |
  • 128 | @angular/platform-browser-dynamic : ^17.1.3
  • 129 |
  • 130 | @angular/router : ^17.1.3
  • 131 |
  • 132 | @manekinekko/angular-web-bluetooth : file:../../@manekinekko/angular-web-bluetooth/dist/manekinekko/angular-web-bluetooth
  • 133 |
  • 134 | @types/web-bluetooth : 0.0.6
  • 135 |
  • 136 | rxjs : ~7.8.0
  • 137 |
  • 138 | smoothie : ^1.35.0
  • 139 |
  • 140 | ts-jest : ^29.0.5
  • 141 |
  • 142 | tslib : ^2.3.0
  • 143 |
  • 144 | zone.js : ~0.14.3
  • 145 |
146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 |
154 |
155 |

results matching ""

156 |
    157 |
    158 |
    159 |

    No results matching ""

    160 |
    161 |
    162 |
    163 | 164 |
    165 |
    166 | 167 | 175 | 176 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /docs/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/ionicons.eot -------------------------------------------------------------------------------- /docs/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/ionicons.ttf -------------------------------------------------------------------------------- /docs/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/ionicons.woff -------------------------------------------------------------------------------- /docs/fonts/ionicons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/ionicons.woff2 -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-300.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-300.eot -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-300.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-300.ttf -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-300.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-300.woff -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-300.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-300.woff2 -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-700.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-700.eot -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-700.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-700.ttf -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-700.woff -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-700.woff2 -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-italic.eot -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-italic.ttf -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-italic.woff -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-italic.woff2 -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-regular.eot -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-regular.woff -------------------------------------------------------------------------------- /docs/fonts/roboto-v15-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/fonts/roboto-v15-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/graph/dependencies.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | dependencies 11 | 12 | Legend 13 | 14 |  Declarations 15 | 16 |  Module 17 | 18 |  Bootstrap 19 | 20 |  Providers 21 | 22 |  Exports 23 | 24 | cluster_AppModule 25 | 26 | 27 | 28 | cluster_AppModule_declarations 29 | 30 | 31 | 32 | cluster_AppModule_imports 33 | 34 | 35 | 36 | cluster_AppModule_bootstrap 37 | 38 | 39 | 40 | 41 | AppComponent 42 | 43 | AppComponent 44 | 45 | 46 | 47 | AppModule 48 | 49 | AppModule 50 | 51 | 52 | 53 | AppComponent->AppModule 54 | 55 | 56 | 57 | 58 | 59 | BatteryLevelComponent 60 | 61 | BatteryLevelComponent 62 | 63 | 64 | 65 | BatteryLevelComponent->AppModule 66 | 67 | 68 | 69 | 70 | 71 | DashboardComponent 72 | 73 | DashboardComponent 74 | 75 | 76 | 77 | DashboardComponent->AppModule 78 | 79 | 80 | 81 | 82 | 83 | HumidityComponent 84 | 85 | HumidityComponent 86 | 87 | 88 | 89 | HumidityComponent->AppModule 90 | 91 | 92 | 93 | 94 | 95 | StepCounterComponent 96 | 97 | StepCounterComponent 98 | 99 | 100 | 101 | StepCounterComponent->AppModule 102 | 103 | 104 | 105 | 106 | 107 | TemperatureComponent 108 | 109 | TemperatureComponent 110 | 111 | 112 | 113 | TemperatureComponent->AppModule 114 | 115 | 116 | 117 | 118 | 119 | AppComponent 120 | 121 | AppComponent 122 | 123 | 124 | 125 | AppModule->AppComponent 126 | 127 | 128 | 129 | 130 | 131 | WebBluetoothModule 132 | 133 | WebBluetoothModule 134 | 135 | 136 | 137 | WebBluetoothModule->AppModule 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/images/compodoc-vectorise-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/images/compodoc-vectorise-inverted.png -------------------------------------------------------------------------------- /docs/images/compodoc-vectorise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/images/compodoc-vectorise.png -------------------------------------------------------------------------------- /docs/images/coverage-badge-documentation.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | documentation 7 | 1% 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/images/coverage-badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | documentation 7 | 1% 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/docs/images/favicon.ico -------------------------------------------------------------------------------- /docs/js/compodoc.js: -------------------------------------------------------------------------------- 1 | var compodoc = { 2 | EVENTS: { 3 | READY: 'compodoc.ready', 4 | SEARCH_READY: 'compodoc.search.ready' 5 | } 6 | }; 7 | 8 | Object.assign( compodoc, EventDispatcher.prototype ); 9 | 10 | document.addEventListener('DOMContentLoaded', function() { 11 | compodoc.dispatchEvent({ 12 | type: compodoc.EVENTS.READY 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /docs/js/lazy-load-graphs.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function() { 2 | var lazyGraphs = [].slice.call(document.querySelectorAll('[lazy]')); 3 | var active = false; 4 | 5 | var lazyLoad = function() { 6 | if (active === false) { 7 | active = true; 8 | 9 | setTimeout(function() { 10 | lazyGraphs.forEach(function(lazyGraph) { 11 | if ( 12 | lazyGraph.getBoundingClientRect().top <= window.innerHeight && 13 | lazyGraph.getBoundingClientRect().bottom >= 0 && 14 | getComputedStyle(lazyGraph).display !== 'none' 15 | ) { 16 | lazyGraph.data = lazyGraph.getAttribute('lazy'); 17 | lazyGraph.removeAttribute('lazy'); 18 | 19 | lazyGraphs = lazyGraphs.filter(function(image) { return image !== lazyGraph}); 20 | 21 | if (lazyGraphs.length === 0) { 22 | document.removeEventListener('scroll', lazyLoad); 23 | window.removeEventListener('resize', lazyLoad); 24 | window.removeEventListener('orientationchange', lazyLoad); 25 | } 26 | } 27 | }); 28 | 29 | active = false; 30 | }, 200); 31 | } 32 | }; 33 | 34 | // initial load 35 | lazyLoad(); 36 | 37 | var container = document.querySelector('.container-fluid.modules'); 38 | if (container) { 39 | container.addEventListener('scroll', lazyLoad); 40 | window.addEventListener('resize', lazyLoad); 41 | window.addEventListener('orientationchange', lazyLoad); 42 | } 43 | 44 | }); 45 | -------------------------------------------------------------------------------- /docs/js/libs/EventDispatcher.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | var EventDispatcher=function(){};Object.assign(EventDispatcher.prototype,{addEventListener:function(i,t){void 0===this._listeners&&(this._listeners={});var e=this._listeners;void 0===e[i]&&(e[i]=[]),-1===e[i].indexOf(t)&&e[i].push(t)},hasEventListener:function(i,t){if(void 0===this._listeners)return!1;var e=this._listeners;return void 0!==e[i]&&-1!==e[i].indexOf(t)},removeEventListener:function(i,t){if(void 0!==this._listeners){var e=this._listeners[i];if(void 0!==e){var s=e.indexOf(t);-1!==s&&e.splice(s,1)}}},dispatchEvent:function(i){if(void 0!==this._listeners){var t=this._listeners[i.type];if(void 0!==t){i.target=this;var e=[],s=0,n=t.length;for(s=0;s",">"));else if(1==i){if(r.push("<",e.tagName),e.hasAttributes())for(var n=e.attributes,s=0,o=n.length;s");for(var h=e.childNodes,s=0,o=h.length;s")}else r.push("/>")}else{if(8!=i)throw"Error serializing XML. Unhandled node of type: "+i;r.push("\x3c!--",e.nodeValue,"--\x3e")}};Object.defineProperty(e.prototype,"innerHTML",{get:function(){for(var e=[],r=this.firstChild;r;)t(r,e),r=r.nextSibling;return e.join("")},set:function(e){for(;this.firstChild;)this.removeChild(this.firstChild);try{var t=new DOMParser;t.async=!1,sXML=""+e+"";for(var r=t.parseFromString(sXML,"text/xml").documentElement.firstChild;r;)this.appendChild(this.ownerDocument.importNode(r,!0)),r=r.nextSibling}catch(e){throw new Error("Error parsing XML string")}}})}}((0,eval)("this").SVGElement); -------------------------------------------------------------------------------- /docs/js/libs/promise.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2013 (c) Pierre Duquesne 3 | * Licensed under the New BSD License. 4 | * https://github.com/stackp/promisejs 5 | */ 6 | (function(a){function b(){this._callbacks=[];}b.prototype.then=function(a,c){var d;if(this._isdone)d=a.apply(c,this.result);else{d=new b();this._callbacks.push(function(){var b=a.apply(c,arguments);if(b&&typeof b.then==='function')b.then(d.done,d);});}return d;};b.prototype.done=function(){this.result=arguments;this._isdone=true;for(var a=0;a=300)&&j.status!==304);h.done(a,j.responseText,j);}};j.send(k);return h;}function h(a){return function(b,c,d){return g(a,b,c,d);};}var i={Promise:b,join:c,chain:d,ajax:g,get:h('GET'),post:h('POST'),put:h('PUT'),del:h('DELETE'),ENOXHR:1,ETIMEOUT:2,ajaxTimeout:0};if(typeof define==='function'&&define.amd)define(function(){return i;});else a.promise=i;})(this); -------------------------------------------------------------------------------- /docs/js/libs/tablesort.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * tablesort v5.2.1 (2021-10-30) 3 | * http://tristen.ca/tablesort/demo/ 4 | * Copyright (c) 2021 ; Licensed MIT 5 | */ 6 | !function(){function a(b,c){if(!(this instanceof a))return new a(b,c);if(!b||"TABLE"!==b.tagName)throw new Error("Element must be a table");this.init(b,c||{})}var b=[],c=function(a){var b;return window.CustomEvent&&"function"==typeof window.CustomEvent?b=new CustomEvent(a):(b=document.createEvent("CustomEvent"),b.initCustomEvent(a,!1,!1,void 0)),b},d=function(a,b){return a.getAttribute(b.sortAttribute||"data-sort")||a.textContent||a.innerText||""},e=function(a,b){return a=a.trim().toLowerCase(),b=b.trim().toLowerCase(),a===b?0:a0)if(a.tHead&&a.tHead.rows.length>0){for(e=0;e0&&n.push(m),o++;if(!n)return}for(o=0;o 0) { 9 | tabs = tabs[0].querySelectorAll('li'); 10 | for (var i = 0; i < tabs.length; i++) { 11 | tabs[i].addEventListener('click', updateAddress); 12 | var linkTag = tabs[i].querySelector('a'); 13 | if (location.hash !== '') { 14 | var currentHash = location.hash.substr(1); 15 | if (currentHash === linkTag.dataset.link) { 16 | linkTag.click(); 17 | } 18 | } 19 | } 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /docs/js/tree.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function() { 2 | var tabs = document.getElementsByClassName('nav-tabs')[0], 3 | tabsCollection = tabs.getElementsByTagName('A'), 4 | treeTab; 5 | var len = tabsCollection.length; 6 | for(var i = 0; i < len; i++) { 7 | if (tabsCollection[i].getAttribute('id') === 'tree-tab') { 8 | treeTab = tabsCollection[i]; 9 | } 10 | } 11 | 12 | // short-circuit if no tree tab 13 | if (!treeTab) return; 14 | 15 | var handler = new Tautologistics.NodeHtmlParser.HtmlBuilder(function(error, dom) { 16 | if (error) { 17 | console.log('handler ko'); 18 | } 19 | }), 20 | parser = new Tautologistics.NodeHtmlParser.Parser(handler), 21 | currentLocation = window.location; 22 | parser.parseComplete(COMPONENT_TEMPLATE); 23 | 24 | var newNodes = [], 25 | newEdges = [], 26 | parsedHtml = handler.dom[0], 27 | nodeCount = 0, 28 | nodeLevel = 0; 29 | 30 | newNodes.push({ 31 | _id: 0, 32 | label: parsedHtml.name, 33 | type: parsedHtml.type 34 | }) 35 | //Add id for nodes 36 | var traverseIds = function(o) { 37 | for (i in o) { 38 | if (!!o[i] && typeof(o[i]) == "object") { 39 | if (!o[i].length && o[i].type === 'tag') { 40 | nodeCount += 1; 41 | o[i]._id = nodeCount; 42 | } 43 | traverseIds(o[i]); 44 | } 45 | } 46 | } 47 | parsedHtml._id = 0; 48 | traverseIds(parsedHtml); 49 | 50 | 51 | var DeepIterator = deepIterator.default, 52 | it = DeepIterator(parsedHtml); 53 | for (let { 54 | value, 55 | parent, 56 | parentNode, 57 | key, 58 | type 59 | } of it) { 60 | if (type === 'NonIterableObject' && typeof key !== 'undefined' && value.type === 'tag') { 61 | var newNode = { 62 | id: value._id, 63 | label: value.name, 64 | type: value.type 65 | }; 66 | for(var i = 0; i < COMPONENTS.length; i++) { 67 | if (COMPONENTS[i].selector === value.name) { 68 | newNode.font = { 69 | multi: 'html' 70 | }; 71 | newNode.label = '' + newNode.label + ''; 72 | newNode.color = '#FB7E81'; 73 | newNode.name = COMPONENTS[i].name; 74 | } 75 | } 76 | for(var i = 0; i < DIRECTIVES.length; i++) { 77 | if (value.attributes) { 78 | for(attr in value.attributes) { 79 | if (DIRECTIVES[i].selector.indexOf(attr) !== -1) { 80 | newNode.font = { 81 | multi: 'html' 82 | }; 83 | newNode.label = '' + newNode.label + ''; 84 | newNode.color = '#FF9800'; 85 | newNode.name = DIRECTIVES[i].name; 86 | } 87 | } 88 | } 89 | } 90 | newNodes.push(newNode); 91 | newEdges.push({ 92 | from: parentNode._parent._id, 93 | to: value._id, 94 | arrows: 'to' 95 | }); 96 | } 97 | } 98 | 99 | newNodes.shift(); 100 | 101 | var container = document.getElementById('tree-container'), 102 | data = { 103 | nodes: newNodes, 104 | edges: newEdges 105 | }, 106 | options = { 107 | layout: { 108 | hierarchical: { 109 | sortMethod: 'directed', 110 | enabled: true 111 | } 112 | }, 113 | nodes: { 114 | shape: 'ellipse', 115 | fixed: true 116 | } 117 | }, 118 | 119 | handleClickNode = function(params) { 120 | var clickeNodeId; 121 | if (params.nodes.length > 0) { 122 | clickeNodeId = params.nodes[0]; 123 | for(var i = 0; i < newNodes.length; i++) { 124 | if (newNodes[i].id === clickeNodeId) { 125 | for(var j = 0; j < COMPONENTS.length; j++) { 126 | if (COMPONENTS[j].name === newNodes[i].name) { 127 | document.location.href = currentLocation.origin + currentLocation.pathname.replace(ACTUAL_COMPONENT.name, newNodes[i].name); 128 | } 129 | } 130 | } 131 | } 132 | } 133 | }, 134 | 135 | loadTree = function () { 136 | setTimeout(function() { 137 | container.style.height = document.getElementsByClassName('content')[0].offsetHeight - 140 + 'px'; 138 | var network = new vis.Network(container, data, options); 139 | network.on('click', handleClickNode); 140 | }, 200); // Fade is 0.150 141 | }; 142 | 143 | loadTree(); 144 | treeTab.addEventListener('click', function() { 145 | loadTree(); 146 | }); 147 | }); 148 | -------------------------------------------------------------------------------- /docs/license.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | angular-web-bluetooth-starter documentation 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 74 | 75 | 79 | 80 | 83 | 84 |
    85 |
    86 | 89 | 90 |
    91 |
    92 | 93 |

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

    94 |

    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:

    95 |

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

    96 |

    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.

    97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
    119 |
    120 |

    results matching ""

    121 |
      122 |
      123 |
      124 |

      No results matching ""

      125 |
      126 |
      127 |
      128 | 129 |
      130 |
      131 | 132 | 140 | 141 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /docs/modules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | angular-web-bluetooth-starter documentation 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 74 | 75 | 79 | 80 | 83 | 84 |
      85 |
      86 | 89 | 90 |
      91 |
      92 | 93 | 94 | 95 | 98 |
      99 |
      100 |
      101 |
      102 |
      103 |

      AppModule

      104 |
      105 |
      106 |

      107 | 108 | Your browser does not support SVG 109 | 110 |

      111 | 114 |
      115 |
      116 |
      117 |
      118 |
      119 |
      120 |

      WebBluetoothModule

      121 |
      122 |
      123 |

      124 | No graph available. 125 |

      126 | 129 |
      130 |
      131 |
      132 |
      133 |
      134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 |
      153 |
      154 |

      results matching ""

      155 |
        156 |
        157 |
        158 |

        No results matching ""

        159 |
        160 |
        161 |
        162 | 163 |
        164 |
        165 | 166 | 174 | 175 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | -------------------------------------------------------------------------------- /docs/modules/AppModule/dependencies.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | dependencies 11 | 12 | Legend 13 | 14 |  Declarations 15 | 16 |  Module 17 | 18 |  Bootstrap 19 | 20 |  Providers 21 | 22 |  Exports 23 | 24 | cluster_AppModule 25 | 26 | 27 | 28 | cluster_AppModule_imports 29 | 30 | 31 | 32 | cluster_AppModule_bootstrap 33 | 34 | 35 | 36 | cluster_AppModule_declarations 37 | 38 | 39 | 40 | 41 | AppComponent 42 | 43 | AppComponent 44 | 45 | 46 | 47 | AppModule 48 | 49 | AppModule 50 | 51 | 52 | 53 | AppComponent->AppModule 54 | 55 | 56 | 57 | 58 | 59 | BatteryLevelComponent 60 | 61 | BatteryLevelComponent 62 | 63 | 64 | 65 | BatteryLevelComponent->AppModule 66 | 67 | 68 | 69 | 70 | 71 | DashboardComponent 72 | 73 | DashboardComponent 74 | 75 | 76 | 77 | DashboardComponent->AppModule 78 | 79 | 80 | 81 | 82 | 83 | HumidityComponent 84 | 85 | HumidityComponent 86 | 87 | 88 | 89 | HumidityComponent->AppModule 90 | 91 | 92 | 93 | 94 | 95 | StepCounterComponent 96 | 97 | StepCounterComponent 98 | 99 | 100 | 101 | StepCounterComponent->AppModule 102 | 103 | 104 | 105 | 106 | 107 | TemperatureComponent 108 | 109 | TemperatureComponent 110 | 111 | 112 | 113 | TemperatureComponent->AppModule 114 | 115 | 116 | 117 | 118 | 119 | AppComponent 120 | 121 | AppComponent 122 | 123 | 124 | 125 | AppModule->AppComponent 126 | 127 | 128 | 129 | 130 | 131 | WebBluetoothModule 132 | 133 | WebBluetoothModule 134 | 135 | 136 | 137 | WebBluetoothModule->AppModule 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /docs/properties.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | angular-web-bluetooth-starter documentation 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 74 | 75 | 79 | 80 | 83 | 84 |
        85 |
        86 | 89 | 90 |
        91 |
        92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 111 |
          112 |
        • 113 | Version : 17.0.0
        • 114 |
        115 | 116 | 117 | 118 | 119 | 120 |
        121 |
        122 |

        results matching ""

        123 |
          124 |
          125 |
          126 |

          No results matching ""

          127 |
          128 |
          129 |
          130 | 131 |
          132 |
          133 | 134 | 142 | 143 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /docs/styles/bootstrap-card.css: -------------------------------------------------------------------------------- 1 | .card { 2 | position: relative; 3 | display: block; 4 | margin-bottom: 20px; 5 | background-color: #fff; 6 | border: 1px solid #ddd; 7 | border-radius: 4px; 8 | } 9 | 10 | .card-block { 11 | padding: 15px; 12 | } 13 | .card-block:before, .card-block:after { 14 | content: " "; 15 | display: table; 16 | } 17 | .card-block:after { 18 | clear: both; 19 | } 20 | 21 | .card-title { 22 | margin: 5px; 23 | margin-bottom: 2px; 24 | text-align: center; 25 | } 26 | 27 | .card-subtitle { 28 | margin-top: -10px; 29 | margin-bottom: 0; 30 | } 31 | 32 | .card-text:last-child { 33 | margin-bottom: 0; 34 | margin-top: 10px; 35 | } 36 | 37 | .card-link:hover { 38 | text-decoration: none; 39 | } 40 | .card-link + .card-link { 41 | margin-left: 15px; 42 | } 43 | 44 | .card > .list-group:first-child .list-group-item:first-child { 45 | border-top-right-radius: 4px; 46 | border-top-left-radius: 4px; 47 | } 48 | .card > .list-group:last-child .list-group-item:last-child { 49 | border-bottom-right-radius: 4px; 50 | border-bottom-left-radius: 4px; 51 | } 52 | 53 | .card-header { 54 | padding: 10px 15px; 55 | background-color: #f5f5f5; 56 | border-bottom: 1px solid #ddd; 57 | } 58 | .card-header:before, .card-header:after { 59 | content: " "; 60 | display: table; 61 | } 62 | .card-header:after { 63 | clear: both; 64 | } 65 | .card-header:first-child { 66 | border-radius: 4px 4px 0 0; 67 | } 68 | 69 | .card-footer { 70 | padding: 10px 15px; 71 | background-color: #f5f5f5; 72 | border-top: 1px solid #ddd; 73 | } 74 | .card-footer:before, .card-footer:after { 75 | content: " "; 76 | display: table; 77 | } 78 | .card-footer:after { 79 | clear: both; 80 | } 81 | .card-footer:last-child { 82 | border-radius: 0 0 4px 4px; 83 | } 84 | 85 | .card-header-tabs { 86 | margin-right: -5px; 87 | margin-bottom: -10px; 88 | margin-left: -5px; 89 | border-bottom: 0; 90 | } 91 | 92 | .card-header-pills { 93 | margin-right: -5px; 94 | margin-left: -5px; 95 | } 96 | 97 | .card-primary { 98 | background-color: #337ab7; 99 | border-color: #337ab7; 100 | } 101 | .card-primary .card-header, 102 | .card-primary .card-footer { 103 | background-color: transparent; 104 | } 105 | 106 | .card-success { 107 | background-color: #5cb85c; 108 | border-color: #5cb85c; 109 | } 110 | .card-success .card-header, 111 | .card-success .card-footer { 112 | background-color: transparent; 113 | } 114 | 115 | .card-info { 116 | background-color: #5bc0de; 117 | border-color: #5bc0de; 118 | } 119 | .card-info .card-header, 120 | .card-info .card-footer { 121 | background-color: transparent; 122 | } 123 | 124 | .card-warning { 125 | background-color: #f0ad4e; 126 | border-color: #f0ad4e; 127 | } 128 | .card-warning .card-header, 129 | .card-warning .card-footer { 130 | background-color: transparent; 131 | } 132 | 133 | .card-danger { 134 | background-color: #d9534f; 135 | border-color: #d9534f; 136 | } 137 | .card-danger .card-header, 138 | .card-danger .card-footer { 139 | background-color: transparent; 140 | } 141 | 142 | .card-outline-primary { 143 | background-color: transparent; 144 | border-color: #337ab7; 145 | } 146 | 147 | .card-outline-secondary { 148 | background-color: transparent; 149 | border-color: #ccc; 150 | } 151 | 152 | .card-outline-info { 153 | background-color: transparent; 154 | border-color: #5bc0de; 155 | } 156 | 157 | .card-outline-success { 158 | background-color: transparent; 159 | border-color: #5cb85c; 160 | } 161 | 162 | .card-outline-warning { 163 | background-color: transparent; 164 | border-color: #f0ad4e; 165 | } 166 | 167 | .card-outline-danger { 168 | background-color: transparent; 169 | border-color: #d9534f; 170 | } 171 | 172 | .card-inverse .card-header, 173 | .card-inverse .card-footer { 174 | border-color: rgba(255, 255, 255, 0.2); 175 | } 176 | .card-inverse .card-header, 177 | .card-inverse .card-footer, 178 | .card-inverse .card-title, 179 | .card-inverse .card-blockquote { 180 | color: #fff; 181 | } 182 | .card-inverse .card-link, 183 | .card-inverse .card-text, 184 | .card-inverse .card-subtitle, 185 | .card-inverse .card-blockquote .blockquote-footer { 186 | color: rgba(255, 255, 255, 0.65); 187 | } 188 | .card-inverse .card-link:hover, .card-inverse .card-link:focus { 189 | color: #fff; 190 | } 191 | 192 | .card-blockquote { 193 | padding: 0; 194 | margin-bottom: 0; 195 | border-left: 0; 196 | } 197 | 198 | .card-img { 199 | border-radius: .25em; 200 | } 201 | 202 | .card-img-overlay { 203 | position: absolute; 204 | top: 0; 205 | right: 0; 206 | bottom: 0; 207 | left: 0; 208 | padding: 15px; 209 | } 210 | 211 | .card-img-top { 212 | border-top-right-radius: 4px; 213 | border-top-left-radius: 4px; 214 | } 215 | 216 | .card-img-bottom { 217 | border-bottom-right-radius: 4px; 218 | border-bottom-left-radius: 4px; 219 | } 220 | -------------------------------------------------------------------------------- /docs/styles/dark.css: -------------------------------------------------------------------------------- 1 | body.dark { 2 | background: #212121; 3 | color: #fafafa; 4 | } 5 | 6 | .dark code { 7 | color: #e09393; 8 | } 9 | 10 | .dark a, 11 | .dark .menu ul.list li a.active { 12 | color: #7fc9ff; 13 | } 14 | 15 | .dark .menu { 16 | background: #212121; 17 | border-right: 1px solid #444; 18 | } 19 | 20 | .dark .menu ul.list li a { 21 | color: #fafafa; 22 | } 23 | 24 | .dark .menu ul.list li.divider { 25 | background: #444; 26 | } 27 | 28 | .dark .xs-menu ul.list li:nth-child(2) { 29 | margin: 0; 30 | background: none; 31 | } 32 | 33 | .dark .menu ul.list li:nth-child(2) { 34 | margin: 0; 35 | background: none; 36 | } 37 | 38 | .dark #book-search-input { 39 | background: #212121; 40 | border-top: 1px solid #444; 41 | border-bottom: 1px solid #444; 42 | color: #fafafa; 43 | } 44 | 45 | .dark .table.metadata > tbody > tr:hover { 46 | color: #555; 47 | } 48 | 49 | .dark .table-bordered { 50 | border: 1px solid #444; 51 | } 52 | 53 | .dark .table-bordered > tbody > tr > td, 54 | .dark .table-bordered > tbody > tr > th, 55 | .dark .table-bordered > tfoot > tr > td, 56 | .dark .table-bordered > tfoot > tr > th, 57 | .dark .table-bordered > thead > tr > td, 58 | .dark .table-bordered > thead > tr > th { 59 | border: 1px solid #444; 60 | } 61 | 62 | .dark .coverage a, 63 | .dark .coverage-count { 64 | color: #fafafa; 65 | } 66 | 67 | .dark .coverage-header { 68 | color: black; 69 | } 70 | 71 | .dark .routes svg text, 72 | .dark .routes svg a { 73 | fill: white; 74 | } 75 | .dark .routes svg rect { 76 | fill: #212121 !important; 77 | } 78 | 79 | .dark .navbar-default, 80 | .dark .btn-default { 81 | background-color: black; 82 | border-color: #444; 83 | color: #fafafa; 84 | } 85 | 86 | .dark .navbar-default .navbar-brand { 87 | color: #fafafa; 88 | } 89 | 90 | .dark .overview .card, 91 | .dark .modules .card { 92 | background: #171717; 93 | color: #fafafa; 94 | border: 1px solid #444; 95 | } 96 | .dark .overview .card a { 97 | color: #fafafa; 98 | } 99 | 100 | .dark .modules .card-header { 101 | background: none; 102 | border-bottom: 1px solid #444; 103 | } 104 | 105 | .dark .module .list-group-item { 106 | background: none; 107 | border: 1px solid #444; 108 | } 109 | 110 | .dark .container-fluid.module h3 a { 111 | color: #337ab7; 112 | } 113 | 114 | .dark table.params thead { 115 | background: #484848; 116 | color: #fafafa; 117 | } 118 | 119 | .dark .content table { 120 | --bs-table-color: #fafafa; 121 | } 122 | -------------------------------------------------------------------------------- /docs/styles/laravel.css: -------------------------------------------------------------------------------- 1 | .nav-tabs > li > a { 2 | text-decoration: none; 3 | } 4 | 5 | .navbar-default .navbar-brand { 6 | color: #f4645f; 7 | text-decoration: none; 8 | font-size: 16px; 9 | } 10 | 11 | .menu ul.list li a[data-type='chapter-link'], 12 | .menu ul.list li.chapter .simple { 13 | color: #525252; 14 | border-bottom: 1px dashed rgba(0, 0, 0, 0.1); 15 | } 16 | 17 | .content h1, 18 | .content h2, 19 | .content h3, 20 | .content h4, 21 | .content h5 { 22 | color: #292e31; 23 | font-weight: normal; 24 | } 25 | 26 | .content { 27 | color: #4c555a; 28 | } 29 | 30 | a { 31 | color: #f4645f; 32 | text-decoration: underline; 33 | } 34 | a:hover { 35 | color: #f1362f; 36 | } 37 | 38 | .menu ul.list li:nth-child(2) { 39 | margin-top: 0; 40 | } 41 | 42 | .menu ul.list li.title a { 43 | color: #f4645f; 44 | text-decoration: none; 45 | font-size: 16px; 46 | } 47 | 48 | .menu ul.list li a { 49 | color: #f4645f; 50 | text-decoration: none; 51 | } 52 | .menu ul.list li a.active { 53 | color: #f4645f; 54 | font-weight: bold; 55 | } 56 | 57 | code { 58 | box-sizing: border-box; 59 | display: inline-block; 60 | padding: 0 5px; 61 | background: #f0f2f1; 62 | border-radius: 3px; 63 | color: #b93d6a; 64 | font-size: 13px; 65 | line-height: 20px; 66 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125); 67 | } 68 | 69 | pre { 70 | margin: 0; 71 | padding: 12px 12px; 72 | background: rgba(238, 238, 238, 0.35); 73 | border-radius: 3px; 74 | font-size: 13px; 75 | line-height: 1.5em; 76 | font-weight: 500; 77 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125); 78 | } 79 | 80 | .dark body { 81 | color: #fafafa; 82 | } 83 | .dark .content h1, 84 | .dark .content h2, 85 | .dark .content h3, 86 | .dark .content h4, 87 | .dark .content h5 { 88 | color: #fafafa; 89 | } 90 | 91 | .dark code { 92 | background: none; 93 | } 94 | 95 | .dark .content { 96 | color: #fafafa; 97 | } 98 | 99 | .dark .menu ul.list li a[data-type='chapter-link'], 100 | .dark .menu ul.list li.chapter .simple { 101 | color: #fafafa; 102 | } 103 | 104 | .dark .menu ul.list li.title a { 105 | color: #fafafa; 106 | } 107 | 108 | .dark .menu ul.list li a { 109 | color: #fafafa; 110 | } 111 | .dark .menu ul.list li a.active { 112 | color: #7fc9ff; 113 | } 114 | -------------------------------------------------------------------------------- /docs/styles/material.css: -------------------------------------------------------------------------------- 1 | .menu { 2 | background: none; 3 | } 4 | 5 | a:hover { 6 | text-decoration: none; 7 | } 8 | 9 | /** LINK **/ 10 | 11 | .menu ul.list li a { 12 | text-decoration: none; 13 | } 14 | 15 | .menu ul.list li a:hover, 16 | .menu ul.list li.chapter .simple:hover { 17 | background-color: #f8f9fa; 18 | text-decoration: none; 19 | } 20 | 21 | #book-search-input { 22 | margin-bottom: 0; 23 | } 24 | 25 | .menu ul.list li.divider { 26 | margin-top: 0; 27 | background: #e9ecef; 28 | } 29 | 30 | .menu .title:hover { 31 | background-color: #f8f9fa; 32 | } 33 | 34 | /** CARD **/ 35 | 36 | .card { 37 | box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 38 | 0 1px 5px 0 rgba(0, 0, 0, 0.12); 39 | border-radius: 0.125rem; 40 | border: 0; 41 | margin-top: 1px; 42 | } 43 | 44 | .card-header { 45 | background: none; 46 | } 47 | 48 | /** BUTTON **/ 49 | 50 | .btn { 51 | border-radius: 0.125rem; 52 | } 53 | 54 | /** NAV BAR **/ 55 | 56 | .nav { 57 | border: 0; 58 | } 59 | .nav-tabs > li > a { 60 | border: 0; 61 | border-bottom: 0.214rem solid transparent; 62 | color: rgba(0, 0, 0, 0.54); 63 | margin-right: 0; 64 | } 65 | .nav-tabs > li.active > a, 66 | .nav-tabs > li.active > a:focus, 67 | .nav-tabs > li.active > a:hover { 68 | color: rgba(0, 0, 0, 0.87); 69 | border-top: 0; 70 | border-left: 0; 71 | border-right: 0; 72 | border-bottom: 0.214rem solid transparent; 73 | border-color: #008cff; 74 | font-weight: bold; 75 | } 76 | .nav > li > a:focus, 77 | .nav > li > a:hover { 78 | background: none; 79 | } 80 | 81 | /** LIST **/ 82 | 83 | .list-group-item:first-child { 84 | border-top-left-radius: 0.125rem; 85 | border-top-right-radius: 0.125rem; 86 | } 87 | .list-group-item:last-child { 88 | border-bottom-left-radius: 0.125rem; 89 | border-bottom-right-radius: 0.125rem; 90 | } 91 | 92 | /** MISC **/ 93 | 94 | .modifier { 95 | border-radius: 0.125rem; 96 | } 97 | 98 | pre[class*='language-'] { 99 | border-radius: 0.125rem; 100 | } 101 | 102 | /** TABLE **/ 103 | 104 | .table-hover > tbody > tr:hover { 105 | background: rgba(0, 0, 0, 0.075); 106 | } 107 | 108 | table.params thead { 109 | background: none; 110 | } 111 | table.params thead td { 112 | color: rgba(0, 0, 0, 0.54); 113 | font-weight: bold; 114 | } 115 | 116 | .dark .menu .title:hover { 117 | background-color: #2d2d2d; 118 | } 119 | .dark .menu ul.list li a:hover, 120 | .dark .menu ul.list li.chapter .simple:hover { 121 | background-color: #2d2d2d; 122 | } 123 | .dark .nav-tabs > li:not(.active) > a { 124 | color: #fafafa; 125 | } 126 | .dark table.params thead { 127 | background: #484848; 128 | } 129 | .dark table.params thead td { 130 | color: #fafafa; 131 | } 132 | -------------------------------------------------------------------------------- /docs/styles/original.css: -------------------------------------------------------------------------------- 1 | .navbar-default .navbar-brand, 2 | .menu ul.list li.title { 3 | font-weight: bold; 4 | color: #3c3c3c; 5 | padding-bottom: 5px; 6 | } 7 | 8 | .menu ul.list li a[data-type='chapter-link'], 9 | .menu ul.list li.chapter .simple { 10 | font-weight: bold; 11 | font-size: 14px; 12 | } 13 | 14 | .menu ul.list li a[href='./routes.html'] { 15 | border-bottom: none; 16 | } 17 | 18 | .menu ul.list > li:nth-child(2) { 19 | display: none; 20 | } 21 | 22 | .menu ul.list li.chapter ul.links { 23 | background: #fff; 24 | padding-left: 0; 25 | } 26 | 27 | .menu ul.list li.chapter ul.links li { 28 | border-bottom: 1px solid #ddd; 29 | padding-left: 20px; 30 | } 31 | 32 | .menu ul.list li.chapter ul.links li:last-child { 33 | border-bottom: none; 34 | } 35 | 36 | .menu ul.list li a.active { 37 | color: #337ab7; 38 | font-weight: bold; 39 | } 40 | 41 | #book-search-input { 42 | margin-bottom: 0; 43 | border-bottom: none; 44 | } 45 | .menu ul.list li.divider { 46 | margin: 0; 47 | } 48 | 49 | .dark .menu ul.list li.chapter ul.links { 50 | background: none; 51 | } 52 | -------------------------------------------------------------------------------- /docs/styles/postmark.css: -------------------------------------------------------------------------------- 1 | .navbar-default { 2 | background: #ffde00; 3 | border: none; 4 | } 5 | 6 | .navbar-default .navbar-brand { 7 | color: #333; 8 | font-weight: bold; 9 | } 10 | 11 | .menu { 12 | background: #333; 13 | color: #fcfcfc; 14 | } 15 | 16 | .menu ul.list li a { 17 | color: #333; 18 | } 19 | 20 | .menu ul.list li.title { 21 | background: #ffde00; 22 | color: #333; 23 | padding-bottom: 5px; 24 | } 25 | 26 | .menu ul.list li:nth-child(2) { 27 | margin-top: 0; 28 | } 29 | 30 | .menu ul.list li.chapter a, 31 | .menu ul.list li.chapter .simple { 32 | color: white; 33 | text-decoration: none; 34 | } 35 | 36 | .menu ul.list li.chapter ul.links a { 37 | color: #949494; 38 | text-transform: none; 39 | padding-left: 35px; 40 | } 41 | 42 | .menu ul.list li.chapter ul.links a:hover, 43 | .menu ul.list li.chapter ul.links a.active { 44 | color: #ffde00; 45 | } 46 | 47 | .menu ul.list li.chapter ul.links { 48 | padding-left: 0; 49 | } 50 | 51 | .menu ul.list li.divider { 52 | background: rgba(255, 255, 255, 0.07); 53 | } 54 | 55 | #book-search-input input, 56 | #book-search-input input:focus, 57 | #book-search-input input:hover { 58 | color: #949494; 59 | } 60 | 61 | .copyright { 62 | color: #b3b3b3; 63 | background: #272525; 64 | } 65 | 66 | .content { 67 | background: #fcfcfc; 68 | } 69 | 70 | .content a { 71 | color: #007dcc; 72 | } 73 | 74 | .content a:visited { 75 | color: #0165a5; 76 | } 77 | 78 | .menu ul.list li:nth-last-child(2) { 79 | background: none; 80 | } 81 | 82 | .list-group-item:first-child, 83 | .list-group-item:last-child { 84 | border-radius: 0; 85 | } 86 | 87 | .menu ul.list li.title a { 88 | text-decoration: none; 89 | font-weight: bold; 90 | } 91 | 92 | .menu ul.list li.title a:hover { 93 | background: rgba(255, 255, 255, 0.1); 94 | } 95 | 96 | .breadcrumb > li + li:before { 97 | content: '»\00a0'; 98 | } 99 | 100 | .breadcrumb { 101 | padding-bottom: 15px; 102 | border-bottom: 1px solid #e1e4e5; 103 | } 104 | 105 | code { 106 | white-space: nowrap; 107 | max-width: 100%; 108 | background: #f5f5f5; 109 | padding: 2px 5px; 110 | color: #666666; 111 | overflow-x: auto; 112 | border-radius: 0; 113 | } 114 | 115 | pre { 116 | white-space: pre; 117 | margin: 0; 118 | padding: 12px 12px; 119 | font-size: 12px; 120 | line-height: 1.5; 121 | display: block; 122 | overflow: auto; 123 | color: #404040; 124 | background: #f3f3f3; 125 | } 126 | 127 | pre code.hljs { 128 | border: none; 129 | background: inherit; 130 | } 131 | 132 | /* 133 | Atom One Light by Daniel Gamage 134 | Original One Light Syntax theme from https://github.com/atom/one-light-syntax 135 | base: #fafafa 136 | mono-1: #383a42 137 | mono-2: #686b77 138 | mono-3: #a0a1a7 139 | hue-1: #0184bb 140 | hue-2: #4078f2 141 | hue-3: #a626a4 142 | hue-4: #50a14f 143 | hue-5: #e45649 144 | hue-5-2: #c91243 145 | hue-6: #986801 146 | hue-6-2: #c18401 147 | */ 148 | 149 | .hljs { 150 | display: block; 151 | overflow-x: auto; 152 | padding: 0.5em; 153 | color: #383a42; 154 | background: #fafafa; 155 | } 156 | 157 | .hljs-comment, 158 | .hljs-quote { 159 | color: #a0a1a7; 160 | font-style: italic; 161 | } 162 | 163 | .hljs-doctag, 164 | .hljs-keyword, 165 | .hljs-formula { 166 | color: #a626a4; 167 | } 168 | 169 | .hljs-section, 170 | .hljs-name, 171 | .hljs-selector-tag, 172 | .hljs-deletion, 173 | .hljs-subst { 174 | color: #e45649; 175 | } 176 | 177 | .hljs-literal { 178 | color: #0184bb; 179 | } 180 | 181 | .hljs-string, 182 | .hljs-regexp, 183 | .hljs-addition, 184 | .hljs-attribute, 185 | .hljs-meta-string { 186 | color: #50a14f; 187 | } 188 | 189 | .hljs-built_in, 190 | .hljs-class .hljs-title { 191 | color: #c18401; 192 | } 193 | 194 | .hljs-attr, 195 | .hljs-variable, 196 | .hljs-template-variable, 197 | .hljs-type, 198 | .hljs-selector-class, 199 | .hljs-selector-attr, 200 | .hljs-selector-pseudo, 201 | .hljs-number { 202 | color: #986801; 203 | } 204 | 205 | .hljs-symbol, 206 | .hljs-bullet, 207 | .hljs-link, 208 | .hljs-meta, 209 | .hljs-selector-id, 210 | .hljs-title { 211 | color: #4078f2; 212 | } 213 | 214 | .hljs-emphasis { 215 | font-style: italic; 216 | } 217 | 218 | .hljs-strong { 219 | font-weight: bold; 220 | } 221 | 222 | .hljs-link { 223 | text-decoration: underline; 224 | } 225 | 226 | .dark .content { 227 | background: none; 228 | } 229 | .dark code { 230 | background: none; 231 | color: #e09393; 232 | } 233 | .dark .menu ul.list li.chapter a.active { 234 | color: #ffde00; 235 | } 236 | .dark .menu { 237 | background: #272525; 238 | } 239 | -------------------------------------------------------------------------------- /docs/styles/prism.css: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.24.0 2 | https://prismjs.com/download.html?#themes=prism-okaidia&languages=markup+css+clike+javascript+apacheconf+aspnet+bash+c+csharp+cpp+coffeescript+dart+docker+elm+git+go+graphql+handlebars+haskell+http+ignore+java+json+kotlin+less+markdown+markup-templating+nginx+php+powershell+ruby+rust+sass+scss+sql+swift+typescript+wasm+yaml&plugins=line-highlight+line-numbers+toolbar+copy-to-clipboard */ 3 | /** 4 | * okaidia theme for JavaScript, CSS and HTML 5 | * Loosely based on Monokai textmate theme by http://www.monokai.nl/ 6 | * @author ocodia 7 | */ 8 | 9 | code[class*='language-'], 10 | pre[class*='language-'] { 11 | color: #f8f8f2; 12 | background: none; 13 | text-shadow: 0 1px rgba(0, 0, 0, 0.3); 14 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 15 | font-size: 1em; 16 | text-align: left; 17 | white-space: pre; 18 | word-spacing: normal; 19 | word-break: normal; 20 | word-wrap: normal; 21 | line-height: 1.5; 22 | 23 | -moz-tab-size: 4; 24 | -o-tab-size: 4; 25 | tab-size: 4; 26 | 27 | -webkit-hyphens: none; 28 | -moz-hyphens: none; 29 | -ms-hyphens: none; 30 | hyphens: none; 31 | } 32 | 33 | /* Code blocks */ 34 | pre[class*='language-'] { 35 | padding: 1em; 36 | margin: 0.5em 0; 37 | overflow: auto; 38 | border-radius: 0.3em; 39 | } 40 | 41 | :not(pre) > code[class*='language-'], 42 | pre[class*='language-'] { 43 | background: #272822; 44 | } 45 | 46 | /* Inline code */ 47 | :not(pre) > code[class*='language-'] { 48 | padding: 0.1em; 49 | border-radius: 0.3em; 50 | white-space: normal; 51 | } 52 | 53 | .token.comment, 54 | .token.prolog, 55 | .token.doctype, 56 | .token.cdata { 57 | color: #8292a2; 58 | } 59 | 60 | .token.punctuation { 61 | color: #f8f8f2; 62 | } 63 | 64 | .token.namespace { 65 | opacity: 0.7; 66 | } 67 | 68 | .token.property, 69 | .token.tag, 70 | .token.constant, 71 | .token.symbol, 72 | .token.deleted { 73 | color: #f92672; 74 | } 75 | 76 | .token.boolean, 77 | .token.number { 78 | color: #ae81ff; 79 | } 80 | 81 | .token.selector, 82 | .token.attr-name, 83 | .token.string, 84 | .token.char, 85 | .token.builtin, 86 | .token.inserted { 87 | color: #a6e22e; 88 | } 89 | 90 | .token.operator, 91 | .token.entity, 92 | .token.url, 93 | .language-css .token.string, 94 | .style .token.string, 95 | .token.variable { 96 | color: #f8f8f2; 97 | } 98 | 99 | .token.atrule, 100 | .token.attr-value, 101 | .token.function, 102 | .token.class-name { 103 | color: #e6db74; 104 | } 105 | 106 | .token.keyword { 107 | color: #66d9ef; 108 | } 109 | 110 | .token.regex, 111 | .token.important { 112 | color: #fd971f; 113 | } 114 | 115 | .token.important, 116 | .token.bold { 117 | font-weight: bold; 118 | } 119 | .token.italic { 120 | font-style: italic; 121 | } 122 | 123 | .token.entity { 124 | cursor: help; 125 | } 126 | 127 | pre[data-line] { 128 | position: relative; 129 | padding: 1em 0 1em 3em; 130 | } 131 | 132 | .line-highlight { 133 | position: absolute; 134 | left: 0; 135 | right: 0; 136 | padding: inherit 0; 137 | margin-top: 1em; /* Same as .prism’s padding-top */ 138 | 139 | background: hsla(24, 20%, 50%, 0.08); 140 | background: linear-gradient(to right, hsla(24, 20%, 50%, 0.1) 70%, hsla(24, 20%, 50%, 0)); 141 | 142 | pointer-events: none; 143 | 144 | line-height: inherit; 145 | white-space: pre; 146 | } 147 | 148 | @media print { 149 | .line-highlight { 150 | /* 151 | * This will prevent browsers from replacing the background color with white. 152 | * It's necessary because the element is layered on top of the displayed code. 153 | */ 154 | -webkit-print-color-adjust: exact; 155 | color-adjust: exact; 156 | } 157 | } 158 | 159 | .line-highlight:before, 160 | .line-highlight[data-end]:after { 161 | content: attr(data-start); 162 | position: absolute; 163 | top: 0.4em; 164 | left: 0.6em; 165 | min-width: 1em; 166 | padding: 0 0.5em; 167 | background-color: hsla(24, 20%, 50%, 0.4); 168 | color: hsl(24, 20%, 95%); 169 | font: bold 65%/1.5 sans-serif; 170 | text-align: center; 171 | vertical-align: 0.3em; 172 | border-radius: 999px; 173 | text-shadow: none; 174 | box-shadow: 0 1px white; 175 | } 176 | 177 | .line-highlight[data-end]:after { 178 | content: attr(data-end); 179 | top: auto; 180 | bottom: 0.4em; 181 | } 182 | 183 | .line-numbers .line-highlight:before, 184 | .line-numbers .line-highlight:after { 185 | content: none; 186 | } 187 | 188 | pre[id].linkable-line-numbers span.line-numbers-rows { 189 | pointer-events: all; 190 | } 191 | pre[id].linkable-line-numbers span.line-numbers-rows > span:before { 192 | cursor: pointer; 193 | } 194 | pre[id].linkable-line-numbers span.line-numbers-rows > span:hover:before { 195 | background-color: rgba(128, 128, 128, 0.2); 196 | } 197 | 198 | pre[class*='language-'].line-numbers { 199 | position: relative; 200 | padding-left: 3.8em; 201 | counter-reset: linenumber; 202 | } 203 | 204 | pre[class*='language-'].line-numbers > code { 205 | position: relative; 206 | white-space: inherit; 207 | } 208 | 209 | .line-numbers .line-numbers-rows { 210 | position: absolute; 211 | pointer-events: none; 212 | top: 0; 213 | font-size: 100%; 214 | left: -3.8em; 215 | width: 3em; /* works for line-numbers below 1000 lines */ 216 | letter-spacing: -1px; 217 | border-right: 1px solid #999; 218 | 219 | -webkit-user-select: none; 220 | -moz-user-select: none; 221 | -ms-user-select: none; 222 | user-select: none; 223 | } 224 | 225 | .line-numbers-rows > span { 226 | display: block; 227 | counter-increment: linenumber; 228 | } 229 | 230 | .line-numbers-rows > span:before { 231 | content: counter(linenumber); 232 | color: #999; 233 | display: block; 234 | padding-right: 0.8em; 235 | text-align: right; 236 | } 237 | 238 | div.code-toolbar { 239 | position: relative; 240 | } 241 | 242 | div.code-toolbar > .toolbar { 243 | position: absolute; 244 | top: 0.3em; 245 | right: 0.2em; 246 | transition: opacity 0.3s ease-in-out; 247 | opacity: 0; 248 | } 249 | 250 | div.code-toolbar:hover > .toolbar { 251 | opacity: 1; 252 | } 253 | 254 | /* Separate line b/c rules are thrown out if selector is invalid. 255 | IE11 and old Edge versions don't support :focus-within. */ 256 | div.code-toolbar:focus-within > .toolbar { 257 | opacity: 1; 258 | } 259 | 260 | div.code-toolbar > .toolbar .toolbar-item { 261 | display: inline-block; 262 | } 263 | 264 | div.code-toolbar > .toolbar a { 265 | cursor: pointer; 266 | } 267 | 268 | div.code-toolbar > .toolbar button { 269 | background: none; 270 | border: 0; 271 | color: inherit; 272 | font: inherit; 273 | line-height: normal; 274 | overflow: visible; 275 | padding: 0; 276 | -webkit-user-select: none; /* for button */ 277 | -moz-user-select: none; 278 | -ms-user-select: none; 279 | } 280 | 281 | div.code-toolbar > .toolbar a, 282 | div.code-toolbar > .toolbar button, 283 | div.code-toolbar > .toolbar span { 284 | color: #bbb; 285 | font-size: 0.8em; 286 | padding: 0 0.5em; 287 | background: #f5f2f0; 288 | background: rgba(224, 224, 224, 0.2); 289 | box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.2); 290 | border-radius: 0.5em; 291 | } 292 | 293 | div.code-toolbar > .toolbar a:hover, 294 | div.code-toolbar > .toolbar a:focus, 295 | div.code-toolbar > .toolbar button:hover, 296 | div.code-toolbar > .toolbar button:focus, 297 | div.code-toolbar > .toolbar span:hover, 298 | div.code-toolbar > .toolbar span:focus { 299 | color: inherit; 300 | text-decoration: none; 301 | } 302 | -------------------------------------------------------------------------------- /docs/styles/readthedocs.css: -------------------------------------------------------------------------------- 1 | .navbar-default { 2 | background: #2980b9; 3 | border: none; 4 | } 5 | 6 | .navbar-default .navbar-brand { 7 | color: #fcfcfc; 8 | } 9 | 10 | .menu { 11 | background: #343131; 12 | color: #fcfcfc; 13 | } 14 | 15 | .menu ul.list li a { 16 | color: #fcfcfc; 17 | } 18 | 19 | .menu ul.list li.title { 20 | background: #2980b9; 21 | padding-bottom: 5px; 22 | } 23 | 24 | .menu ul.list li:nth-child(2) { 25 | margin-top: 0; 26 | } 27 | 28 | .menu ul.list li.chapter a, 29 | .menu ul.list li.chapter .simple { 30 | color: #555; 31 | text-transform: uppercase; 32 | text-decoration: none; 33 | } 34 | 35 | .menu ul.list li.chapter ul.links a { 36 | color: #b3b3b3; 37 | text-transform: none; 38 | padding-left: 35px; 39 | } 40 | 41 | .menu ul.list li.chapter ul.links a:hover { 42 | background: #4e4a4a; 43 | } 44 | 45 | .menu ul.list li.chapter a.active, 46 | .menu ul.list li.chapter ul.links a.active { 47 | color: #0099e5; 48 | } 49 | 50 | .menu ul.list li.chapter ul.links { 51 | padding-left: 0; 52 | } 53 | 54 | .menu ul.list li.divider { 55 | background: rgba(255, 255, 255, 0.07); 56 | } 57 | 58 | #book-search-input input, 59 | #book-search-input input:focus, 60 | #book-search-input input:hover { 61 | color: #949494; 62 | } 63 | 64 | .copyright { 65 | color: #b3b3b3; 66 | background: #272525; 67 | } 68 | 69 | .content { 70 | background: #fcfcfc; 71 | } 72 | 73 | .content a { 74 | color: #2980b9; 75 | } 76 | 77 | .content a:hover { 78 | color: #3091d1; 79 | } 80 | 81 | .content a:visited { 82 | color: #9b59b6; 83 | } 84 | 85 | .menu ul.list li:nth-last-child(2) { 86 | background: none; 87 | } 88 | 89 | code { 90 | white-space: nowrap; 91 | max-width: 100%; 92 | background: #fff; 93 | padding: 2px 5px; 94 | color: #e74c3c; 95 | overflow-x: auto; 96 | border-radius: 0; 97 | } 98 | 99 | pre { 100 | white-space: pre; 101 | margin: 0; 102 | padding: 12px 12px; 103 | font-size: 12px; 104 | line-height: 1.5; 105 | display: block; 106 | overflow: auto; 107 | color: #404040; 108 | background: rgba(238, 238, 238, 0.35); 109 | } 110 | 111 | .dark .content { 112 | background: none; 113 | } 114 | .dark code { 115 | background: none; 116 | color: #e09393; 117 | } 118 | -------------------------------------------------------------------------------- /docs/styles/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | 6 | html, 7 | body, 8 | div, 9 | span, 10 | applet, 11 | object, 12 | iframe, 13 | h1, 14 | h2, 15 | h3, 16 | h4, 17 | h5, 18 | h6, 19 | p, 20 | blockquote, 21 | pre, 22 | a, 23 | abbr, 24 | acronym, 25 | address, 26 | big, 27 | cite, 28 | code, 29 | del, 30 | dfn, 31 | em, 32 | img, 33 | ins, 34 | kbd, 35 | q, 36 | s, 37 | samp, 38 | small, 39 | strike, 40 | strong, 41 | sub, 42 | sup, 43 | tt, 44 | var, 45 | b, 46 | u, 47 | i, 48 | center, 49 | dl, 50 | dt, 51 | dd, 52 | ol, 53 | ul, 54 | li, 55 | fieldset, 56 | form, 57 | label, 58 | legend, 59 | table, 60 | caption, 61 | tbody, 62 | tfoot, 63 | thead, 64 | tr, 65 | th, 66 | td, 67 | article, 68 | aside, 69 | canvas, 70 | details, 71 | embed, 72 | figure, 73 | figcaption, 74 | footer, 75 | header, 76 | hgroup, 77 | menu, 78 | nav, 79 | output, 80 | ruby, 81 | section, 82 | summary, 83 | time, 84 | mark, 85 | audio, 86 | video { 87 | margin: 0; 88 | padding: 0; 89 | border: 0; 90 | font: inherit; 91 | font-size: 100%; 92 | vertical-align: baseline; 93 | } 94 | /* HTML5 display-role reset for older browsers */ 95 | article, 96 | aside, 97 | details, 98 | figcaption, 99 | figure, 100 | footer, 101 | header, 102 | hgroup, 103 | menu, 104 | nav, 105 | section { 106 | display: block; 107 | } 108 | body { 109 | line-height: 1; 110 | } 111 | ol, 112 | ul { 113 | list-style: none; 114 | } 115 | blockquote, 116 | q { 117 | quotes: none; 118 | } 119 | blockquote:before, 120 | blockquote:after, 121 | q:before, 122 | q:after { 123 | content: ''; 124 | content: none; 125 | } 126 | table { 127 | border-collapse: collapse; 128 | border-spacing: 0; 129 | } 130 | -------------------------------------------------------------------------------- /docs/styles/stripe.css: -------------------------------------------------------------------------------- 1 | .navbar-default .navbar-brand { 2 | color: #0099e5; 3 | } 4 | 5 | .menu ul.list li a[data-type='chapter-link'], 6 | .menu ul.list li.chapter .simple { 7 | color: #939da3; 8 | text-transform: uppercase; 9 | } 10 | 11 | .content h1, 12 | .content h2, 13 | .content h3, 14 | .content h4, 15 | .content h5 { 16 | color: #292e31; 17 | font-weight: normal; 18 | } 19 | 20 | .content { 21 | color: #4c555a; 22 | } 23 | 24 | .menu ul.list li.title { 25 | padding: 5px 0; 26 | } 27 | 28 | a { 29 | color: #0099e5; 30 | text-decoration: none; 31 | } 32 | a:hover { 33 | color: #292e31; 34 | text-decoration: none; 35 | } 36 | 37 | .menu ul.list li:nth-child(2) { 38 | margin-top: 0; 39 | } 40 | 41 | .menu ul.list li.title a, 42 | .navbar a { 43 | color: #0099e5; 44 | text-decoration: none; 45 | font-size: 16px; 46 | } 47 | 48 | .menu ul.list li a.active { 49 | color: #0099e5; 50 | } 51 | 52 | code { 53 | box-sizing: border-box; 54 | display: inline-block; 55 | padding: 0 5px; 56 | background: #fafcfc; 57 | border-radius: 4px; 58 | color: #b93d6a; 59 | font-size: 13px; 60 | line-height: 20px; 61 | } 62 | 63 | pre { 64 | margin: 0; 65 | padding: 12px 12px; 66 | background: #272b2d; 67 | border-radius: 5px; 68 | font-size: 13px; 69 | line-height: 1.5em; 70 | font-weight: 500; 71 | } 72 | 73 | .dark body { 74 | color: #fafafa; 75 | } 76 | .dark .content h1, 77 | .dark .content h2, 78 | .dark .content h3, 79 | .dark .content h4, 80 | .dark .content h5 { 81 | color: #fafafa; 82 | } 83 | 84 | .dark code { 85 | background: none; 86 | } 87 | 88 | .dark .content { 89 | color: #fafafa; 90 | } 91 | 92 | .dark .menu ul.list li a[data-type='chapter-link'], 93 | .dark .menu ul.list li.chapter .simple { 94 | color: #fafafa; 95 | } 96 | 97 | .dark .menu ul.list li.title a { 98 | color: #fafafa; 99 | } 100 | 101 | .dark .menu ul.list li a { 102 | color: #fafafa; 103 | } 104 | .dark .menu ul.list li a.active { 105 | color: #7fc9ff; 106 | } 107 | -------------------------------------------------------------------------------- /docs/styles/style.css: -------------------------------------------------------------------------------- 1 | @import "./reset.css"; 2 | @import "./bootstrap.min.css"; 3 | @import "./bootstrap-card.css"; 4 | @import "./prism.css"; 5 | @import "./ionicons.min.css"; 6 | @import "./compodoc.css"; 7 | @import "./tablesort.css"; 8 | -------------------------------------------------------------------------------- /docs/styles/tablesort.css: -------------------------------------------------------------------------------- 1 | th[role=columnheader]:not(.no-sort) { 2 | cursor: pointer; 3 | } 4 | 5 | th[role=columnheader]:not(.no-sort):after { 6 | content: ''; 7 | float: right; 8 | margin-top: 7px; 9 | border-width: 0 4px 4px; 10 | border-style: solid; 11 | border-color: #404040 transparent; 12 | visibility: visible; 13 | opacity: 1; 14 | -ms-user-select: none; 15 | -webkit-user-select: none; 16 | -moz-user-select: none; 17 | user-select: none; 18 | } 19 | 20 | th[aria-sort=ascending]:not(.no-sort):after { 21 | border-bottom: none; 22 | border-width: 4px 4px 0; 23 | } 24 | 25 | th[aria-sort]:not(.no-sort):after { 26 | visibility: visible; 27 | opacity: 0.4; 28 | } 29 | 30 | th[role=columnheader]:not(.no-sort):hover:after { 31 | visibility: visible; 32 | opacity: 1; 33 | } 34 | -------------------------------------------------------------------------------- /docs/styles/vagrant.css: -------------------------------------------------------------------------------- 1 | .navbar-default .navbar-brand { 2 | background: white; 3 | color: #8d9ba8; 4 | } 5 | 6 | .menu .list { 7 | background: #0c5593; 8 | } 9 | 10 | .menu .chapter { 11 | padding: 0 20px; 12 | } 13 | 14 | .menu ul.list li a[data-type='chapter-link'], 15 | .menu ul.list li.chapter .simple { 16 | color: white; 17 | text-transform: uppercase; 18 | border-bottom: 1px solid rgba(255, 255, 255, 0.4); 19 | } 20 | 21 | .content h1, 22 | .content h2, 23 | .content h3, 24 | .content h4, 25 | .content h5 { 26 | color: #292e31; 27 | font-weight: normal; 28 | } 29 | 30 | .content { 31 | color: #4c555a; 32 | } 33 | 34 | a { 35 | color: #0094bf; 36 | text-decoration: underline; 37 | } 38 | a:hover { 39 | color: #f1362f; 40 | } 41 | 42 | .menu ul.list li.title { 43 | background: white; 44 | padding-bottom: 5px; 45 | } 46 | 47 | .menu ul.list li:nth-child(2) { 48 | margin-top: 0; 49 | } 50 | 51 | .menu ul.list li:nth-last-child(2) { 52 | background: none; 53 | } 54 | 55 | .menu ul.list li.title a { 56 | padding: 10px 15px; 57 | } 58 | 59 | .menu ul.list li.title a, 60 | .navbar a { 61 | color: #8d9ba8; 62 | text-decoration: none; 63 | font-size: 16px; 64 | font-weight: 300; 65 | } 66 | 67 | .menu ul.list li a { 68 | color: white; 69 | padding: 10px; 70 | font-weight: 300; 71 | text-decoration: none; 72 | } 73 | .menu ul.list li a.active { 74 | color: white; 75 | font-weight: bold; 76 | } 77 | 78 | .copyright { 79 | color: white; 80 | background: #000; 81 | } 82 | 83 | code { 84 | box-sizing: border-box; 85 | display: inline-block; 86 | padding: 0 5px; 87 | background: rgba(0, 148, 191, 0.1); 88 | border-radius: 3px; 89 | color: #0094bf; 90 | font-size: 13px; 91 | line-height: 20px; 92 | } 93 | 94 | pre { 95 | margin: 0; 96 | padding: 12px 12px; 97 | background: rgba(238, 238, 238, 0.35); 98 | border-radius: 3px; 99 | font-size: 13px; 100 | line-height: 1.5em; 101 | font-weight: 500; 102 | } 103 | 104 | .dark body { 105 | color: #fafafa; 106 | } 107 | .dark .content h1, 108 | .dark .content h2, 109 | .dark .content h3, 110 | .dark .content h4, 111 | .dark .content h5 { 112 | color: #fafafa; 113 | } 114 | 115 | .dark code { 116 | background: none; 117 | } 118 | 119 | .dark .content { 120 | color: #fafafa; 121 | } 122 | 123 | .dark .menu ul.list li.title a, 124 | .dark .navbar a { 125 | color: #8d9ba8; 126 | } 127 | 128 | .dark .menu ul.list li a { 129 | color: #fafafa; 130 | } 131 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('angular-web-bluetooth-starter app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo(): Promise { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es2018", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'jest-preset-angular', 3 | displayName: "angular-web-bluetooth-starter", 4 | setupFilesAfterEnv: ["/test-setup.ts"], 5 | modulePathIgnorePatterns: ["dist/*"], 6 | moduleNameMapper: { 7 | "@manekinekko/(.+)": "/projects/manekinekko/$1/src/public_api.ts", 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-web-bluetooth-starter", 3 | "version": "17.1.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "watch": "ng build --watch --configuration development", 8 | "prestart": "npm run build", 9 | "prebuild": "ng build @manekinekko/angular-web-bluetooth --configuration production && cp README.md dist/manekinekko/angular-web-bluetooth/", 10 | "build": "ng build angular-web-bluetooth-starter --configuration production", 11 | "postbuild": "npm run docs", 12 | "test": "ng test", 13 | "test:lib": "ng test @manekinekko/angular-web-bluetooth", 14 | "test:starter": "ng test angular-web-bluetooth-starter", 15 | "lint": "ng lint", 16 | "e2e": "echo 'skipping test'", 17 | "docs": "compodoc -p tsconfig.json --theme material -d docs", 18 | "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", 19 | "prerelease": "npm run prebuild", 20 | "release": "cd dist/manekinekko/angular-web-bluetooth && release-it --no-git.requireUpstream" 21 | }, 22 | "private": true, 23 | "dependencies": { 24 | "@angular/animations": "^17.1.3", 25 | "@angular/cdk": "^17.1.2", 26 | "@angular/common": "^17.1.3", 27 | "@angular/compiler": "^17.1.3", 28 | "@angular/core": "^17.1.3", 29 | "@angular/forms": "^17.1.3", 30 | "@angular/material": "^17.1.2", 31 | "@angular/platform-browser": "^17.1.3", 32 | "@angular/platform-browser-dynamic": "^17.1.3", 33 | "@angular/router": "^17.1.3", 34 | "@types/web-bluetooth": "0.0.6", 35 | "rxjs": "~7.8.0", 36 | "smoothie": "^1.35.0", 37 | "ts-jest": "^29.0.5", 38 | "tslib": "^2.3.0", 39 | "zone.js": "~0.14.3" 40 | }, 41 | "devDependencies": { 42 | "@angular-builders/jest": "^17.0.0", 43 | "@angular-devkit/build-angular": "^17.1.3", 44 | "@angular-devkit/core": "^17.1.3", 45 | "@angular/cli": "^17.1.3", 46 | "@angular/compiler-cli": "^17.1.3", 47 | "@angular/language-service": "^17.1.3", 48 | "@compodoc/compodoc": "^1.1.11", 49 | "@types/jasmine": "~5.1.4", 50 | "@types/jasminewd2": "~2.0.8", 51 | "@types/jest": "^29.5.12", 52 | "@types/node": "^20.11.17", 53 | "jasmine-core": "~5.1.2", 54 | "jasmine-spec-reporter": "~5.0.0", 55 | "jest": "^29.7.0", 56 | "jest-preset-angular": "^14.0.2", 57 | "karma": "~6.4.0", 58 | "karma-chrome-launcher": "~3.1.0", 59 | "karma-coverage": "~2.2.0", 60 | "karma-jasmine": "~5.1.0", 61 | "karma-jasmine-html-reporter": "~2.1.0", 62 | "ng-packagr": "^17.1.2", 63 | "release-it": "^17.0.3", 64 | "typescript": "~5.3.3" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": { 3 | "@release-it/conventional-changelog": { 4 | "preset": "angular" 5 | } 6 | }, 7 | "git": { 8 | "commitMessage": "chore(release): v${version}", 9 | "tagName": "${version}", 10 | "tagAnnotation": "Release ${version}", 11 | "push": true, 12 | "commit": true 13 | }, 14 | "github": { 15 | "release": true, 16 | "preRelease": true, 17 | "releaseName": "v${version}", 18 | "draft": false, 19 | "tokenRef": "GITHUB_TOKEN" 20 | }, 21 | "npm": { 22 | "publish": true 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/README.md: -------------------------------------------------------------------------------- 1 | # AngularWebBluetooth 2 | 3 | This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.0. 4 | 5 | ## Code scaffolding 6 | 7 | Run `ng generate component component-name --project @manekinekko/angular-web-bluetooth` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project @manekinekko/angular-web-bluetooth`. 8 | > Note: Don't forget to add `--project @manekinekko/angular-web-bluetooth` or else it will be added to the default project in your `angular.json` file. 9 | 10 | ## Build 11 | 12 | Run `ng build @manekinekko/angular-web-bluetooth` to build the project. The build artifacts will be stored in the `dist/` directory. 13 | 14 | ## Publishing 15 | 16 | After building your library with `ng build @manekinekko/angular-web-bluetooth`, go to the dist folder `cd dist/manekinekko/angular-web-bluetooth` and run `npm publish`. 17 | 18 | ## Running unit tests 19 | 20 | Run `ng test @manekinekko/angular-web-bluetooth` to execute the unit tests via [Jest](https://jestjs.io). 21 | 22 | ## Further help 23 | 24 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 25 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | displayName: "@manekinekko/angular-web-bluetooth", 3 | preset: "jest-preset-angular", 4 | displayName: "angular-web-bluetooth-starter", 5 | setupFilesAfterEnv: ["/test-setup.ts"], 6 | modulePathIgnorePatterns: ["dist/*"], 7 | }; 8 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../../dist/manekinekko/angular-web-bluetooth", 4 | "lib": { 5 | "entryFile": "src/public_api.ts" 6 | } 7 | } -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@manekinekko/angular-web-bluetooth", 3 | "version": "17.0.0", 4 | "license": "MIT", 5 | "author": { 6 | "name": "Wassim Chegham", 7 | "email": "github@wassim.dev" 8 | }, 9 | "engines": { 10 | "node": ">= 18" 11 | }, 12 | "contributors": [ 13 | "urish" 14 | ], 15 | "repository": { 16 | "type": "git", 17 | "url": "git@github.com:manekinekko/angular-web-bluetooth.git" 18 | }, 19 | "homepage": "https://github.com/manekinekko/angular-web-bluetooth", 20 | "bugs": "https://github.com/manekinekko/angular-web-bluetooth/issues", 21 | "description": "The missing Web Bluetooth module for Angular", 22 | "types": "./dist/manekinekko/angular-web-bluetooth/public_api.d.ts", 23 | "readme": "https://github.com/manekinekko/angular-web-bluetooth/blob/main/README.md", 24 | "private": false, 25 | "dependencies": { 26 | "tslib": "^2.3.0" 27 | }, 28 | "keywords": [ 29 | "angular", 30 | "angular2", 31 | "bluetooth", 32 | "low", 33 | "energy", 34 | "web", 35 | "ble", 36 | "iot", 37 | "sensor", 38 | "accelerometer", 39 | "luxometer", 40 | "transmitter", 41 | "magnetometer", 42 | "ir", 43 | "nfc", 44 | "thermometer", 45 | "puckjs", 46 | "sensortag" 47 | ], 48 | "peerDependencies": { 49 | "@angular/common": "^17.1.0", 50 | "@angular/core": "^17.1.0" 51 | }, 52 | "sideEffects": false 53 | } 54 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/lib/bluetooth.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, ModuleWithProviders, InjectionToken, Optional } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | 4 | import { BluetoothCore } from './bluetooth.service'; 5 | import { BrowserWebBluetooth } from './platform/browser'; 6 | 7 | import { ConsoleLoggerService, NoLoggerService } from './logger.service'; 8 | 9 | export interface AWBOptions { 10 | enableTracing?: boolean; 11 | } 12 | 13 | export function browserWebBluetooth() { 14 | return new BrowserWebBluetooth(); 15 | } 16 | 17 | export function consoleLoggerServiceConfig(options: AWBOptions) { 18 | if (options && options.enableTracing) { 19 | return new ConsoleLoggerService(); 20 | } else { 21 | return new NoLoggerService(); 22 | } 23 | } 24 | export function makeMeTokenInjector() { 25 | return new InjectionToken('AWBOptions'); 26 | } 27 | 28 | @NgModule({ 29 | imports: [CommonModule] 30 | }) 31 | export class WebBluetoothModule { 32 | static forRoot(options: AWBOptions = {}): ModuleWithProviders { 33 | return { 34 | ngModule: WebBluetoothModule, 35 | providers: [ 36 | BluetoothCore, 37 | { 38 | provide: BrowserWebBluetooth, 39 | useFactory: browserWebBluetooth 40 | }, 41 | { 42 | provide: makeMeTokenInjector, 43 | useValue: options 44 | }, 45 | { 46 | provide: ConsoleLoggerService, 47 | useFactory: consoleLoggerServiceConfig, 48 | deps: [makeMeTokenInjector] 49 | } 50 | ] 51 | }; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/lib/bluetooth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { bufferCount, skip, take } from 'rxjs/operators'; 3 | import { BluetoothCore } from './bluetooth.service'; 4 | import { ConsoleLoggerService, NoLoggerService } from './logger.service'; 5 | import { BrowserWebBluetooth } from './platform/browser'; 6 | import { 7 | FakeBluetoothRemoteGATTCharacteristic, 8 | FakeBluetoothRemoteGATTServer, 9 | FakeBluetoothRemoteGATTService, 10 | FakeBluetoothDevice, 11 | } from './test.utils'; 12 | 13 | describe('BluetoothCore', () => { 14 | let serviceUnderTest: BluetoothCore; 15 | 16 | // fake fixtures 17 | const fakeDevice = new FakeBluetoothDevice('1', 'device 1'); 18 | const fakeDataView = new DataView(new ArrayBuffer(8)); 19 | fakeDataView.setInt8(0, 99); 20 | const fakeCharacteristic = new FakeBluetoothRemoteGATTCharacteristic( 21 | { notify: false } as BluetoothCharacteristicProperties, 22 | fakeDataView 23 | ); 24 | const fakeService = new FakeBluetoothRemoteGATTService(fakeDevice, { 25 | battery_level: fakeCharacteristic, 26 | }); 27 | const fakeGATTServer = new FakeBluetoothRemoteGATTServer(fakeDevice, { 28 | battery_service: { 29 | service: fakeService, 30 | primary: true, 31 | }, 32 | }); 33 | 34 | // Set navigator fake bluetooth test double 35 | Object.defineProperty(navigator, 'bluetooth', { 36 | value: { 37 | requestDevice: (options: RequestDeviceOptions) => 38 | Promise.resolve(fakeDevice), 39 | }, 40 | }); 41 | 42 | beforeEach(async () => { 43 | TestBed.configureTestingModule({ 44 | providers: [ 45 | BluetoothCore, 46 | BrowserWebBluetooth, 47 | { provide: ConsoleLoggerService, useClass: NoLoggerService }, 48 | ], 49 | }); 50 | 51 | serviceUnderTest = TestBed.inject(BluetoothCore); 52 | }); 53 | 54 | it('should create service', () => { 55 | expect(serviceUnderTest).toBeDefined(); 56 | }); 57 | 58 | it('should discover device', async () => { 59 | // when 60 | const device = await serviceUnderTest.discover(); 61 | // then 62 | expect(device).toBe(fakeDevice); 63 | }); 64 | 65 | it('should emit discovered device', (done) => { 66 | // async then 67 | serviceUnderTest 68 | .getDevice$() 69 | .pipe(take(1)) 70 | .subscribe({ 71 | next: (next) => { 72 | expect(next).toBe(fakeDevice); 73 | done(); 74 | }, 75 | error: (_error) => done(), 76 | }); 77 | 78 | // when 79 | serviceUnderTest.discover(); 80 | }); 81 | 82 | it('should connect device', async () => { 83 | // when 84 | const device = await serviceUnderTest.discover(); 85 | const gattServer = await serviceUnderTest.connectDevice(device); 86 | // then 87 | expect(gattServer).toBe(fakeGATTServer); 88 | }); 89 | 90 | it('should emit connected gatt server', (done) => { 91 | // async then 92 | serviceUnderTest 93 | .getGATT$() 94 | .pipe(take(1)) 95 | .subscribe({ 96 | next: (next) => { 97 | expect(next).toBe(fakeGATTServer); 98 | done(); 99 | }, 100 | error: (_error) => done(), 101 | }); 102 | 103 | serviceUnderTest 104 | .discover() 105 | .then((device) => serviceUnderTest.connectDevice(device)); 106 | }); 107 | 108 | xit('should disconnect device', (done) => { 109 | // async then 110 | let gattServerDisconnectSpy: any; 111 | serviceUnderTest 112 | .getDevice$() 113 | // skip the first emission which will be the fake device 114 | // and take only the second one which will be null 115 | .pipe(take(2), skip(1)) 116 | .subscribe({ 117 | next: (next) => { 118 | expect(next).toBeNull(); 119 | expect(gattServerDisconnectSpy).toHaveBeenCalledTimes(1); 120 | done(); 121 | }, 122 | complete: () => done, 123 | error: (_error) => done(), 124 | }); 125 | 126 | // when 127 | serviceUnderTest 128 | .discover() 129 | .then((device) => serviceUnderTest.connectDevice(device)) 130 | .then((gattServer) => { 131 | gattServerDisconnectSpy = jest.spyOn(gattServer as any, 'disconnect'); 132 | }) 133 | .finally(() => serviceUnderTest.disconnectDevice()); 134 | }); 135 | 136 | it('should read provided service and characteristic', async () => { 137 | // when 138 | const value = await serviceUnderTest.value({ 139 | service: 'battery_service', 140 | characteristic: 'battery_level', 141 | }); 142 | 143 | // then 144 | expect(value.getUint8(0)).toEqual(99); 145 | }); 146 | 147 | it('should emit characteristic value changes', (done) => { 148 | // given 149 | const newDataView1 = new DataView(new ArrayBuffer(8)); 150 | newDataView1.setInt8(0, 25); 151 | 152 | const newDataView2 = new DataView(new ArrayBuffer(8)); 153 | newDataView2.setInt8(0, 15); 154 | 155 | // async then 156 | serviceUnderTest 157 | .streamValues$() 158 | .pipe(bufferCount(2)) 159 | .subscribe({ 160 | next: (next: DataView[]) => { 161 | expect(next.map((dv) => dv.getUint8(0))).toEqual([25, 15]); 162 | done(); 163 | }, 164 | error: (_error) => done(), 165 | }); 166 | 167 | // when 168 | serviceUnderTest 169 | .value({ 170 | service: 'battery_service', 171 | characteristic: 'battery_level', 172 | }) 173 | .then(() => { 174 | fakeCharacteristic.changeValue(newDataView1); 175 | fakeCharacteristic.changeValue(newDataView2); 176 | }); 177 | }); 178 | }); 179 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/lib/lang/uuids/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ti-sensortag2'; 2 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/lib/lang/uuids/ti-sensortag2.ts: -------------------------------------------------------------------------------- 1 | // http://processors.wiki.ti.com/images/a/a8/BLE_SensorTag_GATT_Server.pdf 2 | 3 | // prettier-ignore 4 | export const TiTag = { 5 | 6 | DEVICE_INFORMATION : { 7 | SERVICE : 'f000180a-0451-4000-b000-000000000000', 8 | SYSTEM_ID : 'f0002a23-0451-4000-b000-000000000000', 9 | MODEL_NUMBER : 'f0002a24-0451-4000-b000-000000000000', 10 | SERIAL_NUMBER : 'f0002a25-0451-4000-b000-000000000000', 11 | FIRMWARE_REV : 'f0002a26-0451-4000-b000-000000000000', 12 | HARDWARE_REV : 'f0002a27-0451-4000-b000-000000000000', 13 | SOFTWARE_REV : 'f0002a28-0451-4000-b000-000000000000', 14 | MANIFACTURER : 'f0002a29-0451-4000-b000-000000000000', 15 | IEEE11073 : 'f0002a2a-0451-4000-b000-000000000000', 16 | PNP_ID : 'f0002a50-0451-4000-b000-000000000000' 17 | }, 18 | 19 | BATTERY : { 20 | SERVICE : 'f000180f-0451-4000-b000-000000000000', 21 | LEVEL : 'f0002a19-0451-4000-b000-000000000000' 22 | }, 23 | 24 | TEMPERATURE : { 25 | SERVICE : 'f000aa00-0451-4000-b000-000000000000', 26 | DATA : 'f000aa01-0451-4000-b000-000000000000', 27 | CONFIGURATION : 'f000aa02-0451-4000-b000-000000000000', 28 | PERIOD : 'f000aa03-0451-4000-b000-000000000000' 29 | }, 30 | 31 | HUMIDITY : { 32 | SERVICE : 'f000aa20-0451-4000-b000-000000000000', 33 | DATA : 'f000aa21-0451-4000-b000-000000000000', 34 | CONFIGURATION : 'f000aa22-0451-4000-b000-000000000000', 35 | PERIOD : 'f000aa23-0451-4000-b000-000000000000' 36 | }, 37 | 38 | BAROMETER : { 39 | SERVICE : 'f000aa40-0451-4000-b000-000000000000', 40 | DATA : 'f000aa41-0451-4000-b000-000000000000', 41 | CONFIGURATION : 'f000aa42-0451-4000-b000-000000000000', 42 | PERIOD : 'f000aa44-0451-4000-b000-000000000000' 43 | }, 44 | 45 | // service not available in model CC2650 46 | // ACCELEROMETER : { 47 | // SERVICE : 'f000aa10-0451-4000-b000-000000000000', 48 | // DATA : 'f000aa11-0451-4000-b000-000000000000', 49 | // CONFIGURATION : 'f000aa12-0451-4000-b000-000000000000', 50 | // PERIOD : 'f000aa13-0451-4000-b000-000000000000' 51 | // }, 52 | 53 | // service not available in model CC2650 54 | // MAGNETOMETER : { 55 | // SERVICE : 'f000aa30-0451-4000-b000-000000000000', 56 | // DATA : 'f000aa31-0451-4000-b000-000000000000', 57 | // CONFIGURATION : 'f000aa32-0451-4000-b000-000000000000', 58 | // PERIOD : 'f000aa33-0451-4000-b000-000000000000' 59 | // }, 60 | 61 | // service not available in model CC2650 62 | // GYROSCOPE : { 63 | // SERVICE : 'f000aa50-0451-4000-b000-000000000000', 64 | // DATA : 'f000aa51-0451-4000-b000-000000000000', 65 | // CONFIGURATION : 'f000aa52-0451-4000-b000-000000000000', 66 | // PERIOD : 'f000aa53-0451-4000-b000-000000000000' 67 | // }, 68 | 69 | MOVEMENT : { 70 | SERVICE : 'f000aa80-0451-4000-b000-000000000000', 71 | DATA : 'f000aa81-0451-4000-b000-000000000000', 72 | CONFIGURATION : 'f000aa82-0451-4000-b000-000000000000', 73 | PERIOD : 'f000aa83-0451-4000-b000-000000000000' 74 | }, 75 | 76 | LIGHT : { 77 | SERVICE : 'f000aa70-0451-4000-b000-000000000000', 78 | DATA : 'f000aa71-0451-4000-b000-000000000000', 79 | CONFIGURATION : 'f000aa72-0451-4000-b000-000000000000', 80 | PERIOD : 'f000aa73-0451-4000-b000-000000000000' 81 | }, 82 | 83 | KEYPRESS : { 84 | SERVICE : 'f000ffe0-0451-4000-b000-000000000000', 85 | STATE : 'f000ffe1-0451-4000-b000-000000000000' 86 | }, 87 | 88 | __REGISTER__ : { 89 | SERVICE : 'f000ac00-0451-4000-b000-000000000000', 90 | DATA : 'f000ac01-0451-4000-b000-000000000000', 91 | ADDRESS : 'f000ac02-0451-4000-b000-000000000000', 92 | DEVICE_ID : 'f000ac03-0451-4000-b000-000000000000' 93 | }, 94 | 95 | CONTROL : { 96 | SERVICE : 'f000ccc0-0451-4000-b000-000000000000', 97 | CURRENT_USED_PARAMETERS : 'f000ccc1-0451-4000-b000-000000000000', 98 | REQUEST_NEW_PARAMETERS : 'f000ccc2-0451-4000-b000-000000000000', 99 | DISCONNECT_REQUEST : 'f000ccc3-0451-4000-b000-000000000000' 100 | }, 101 | 102 | OAD : { 103 | SERVICE : 'f000ffc0-0451-4000-b000-000000000000', 104 | IMAGE_NOTIFY : 'f000ffc1-0451-4000-b000-000000000000', 105 | IMAGE_BLOCK_REQUEST : 'f000ffc2-0451-4000-b000-000000000000', 106 | IMAGE_COUNT : 'f000ffc3-0451-4000-b000-000000000000', 107 | IMAGE_STATUS : 'f000ffc4-0451-4000-b000-000000000000' 108 | }, 109 | 110 | IO : { 111 | SERVICE : 'f000aa64-0451-4000-b000-000000000000', 112 | DATA : 'f000aa65-0451-4000-b000-000000000000', 113 | CONFIG : 'f000aa66-0451-4000-b000-000000000000' 114 | } 115 | }; 116 | 117 | export const TI_SENSORAG_SERVICES: string[] = Object.keys(TiTag).map((key: string) => (TiTag as any)[key].SERVICE); 118 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/lib/logger.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | export interface Logger { 4 | log(args: string[]): void; 5 | error(args: string[]): void; 6 | warn(args: string[]): void; 7 | } 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class ConsoleLoggerService implements Logger { 13 | log(...args: any[]) { 14 | console.log.apply(console, args); 15 | } 16 | error(...args: any[]) { 17 | console.error.apply(console, args); 18 | } 19 | warn(...args: any[]) { 20 | console.warn.apply(console, args); 21 | } 22 | } 23 | 24 | @Injectable({ 25 | providedIn: 'root' 26 | }) 27 | export class NoLoggerService implements Logger { 28 | log(...args: any[]) {} 29 | error(...args: any[]) {} 30 | warn(...args: any[]) {} 31 | } 32 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/lib/platform/browser.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class BrowserWebBluetooth { 5 | private ble; 6 | 7 | constructor() { 8 | this.ble = navigator.bluetooth; 9 | if (!this.ble) { 10 | throw new Error('Your browser does not support Smart Bluetooth. See http://caniuse.com/#search=Bluetooth for more details.'); 11 | } 12 | } 13 | 14 | requestDevice(options: RequestDeviceOptions): Promise { 15 | return this.ble.requestDevice(options); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/lib/platform/server.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable() 4 | export class ServerWebBluetooth { 5 | static instance() { 6 | // mocked object for now 7 | return {}; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/lib/test.utils.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Fake Web Bluetooth implementation 3 | * Replace real browser Bluetooth objects by a much simpler objects that implement some required functionalities 4 | */ 5 | 6 | export class FakeBluetoothDevice { 7 | gatt: BluetoothRemoteGATTServer | null = null; 8 | private listeners: { 9 | [key: string]: EventListener[] 10 | } = { 11 | gattserverdisconnected: [] 12 | }; 13 | 14 | constructor(public id: string, public name: string) { 15 | } 16 | 17 | addEventListener(type: string, listener: EventListener) { 18 | this.listeners[type] = [ 19 | ...this.listeners[type], 20 | listener 21 | ]; 22 | } 23 | 24 | disconnect() { 25 | const mockedEvent = {target: this} as unknown; 26 | this.listeners['gattserverdisconnected'].forEach(listener => listener(mockedEvent as Event)); 27 | } 28 | 29 | clear() { 30 | this.id = ""; 31 | this.name = ""; 32 | this.listeners = { 33 | gattserverdisconnected: [] 34 | }; 35 | } 36 | } 37 | 38 | export class FakeBluetoothRemoteGATTServer { 39 | connected = false; 40 | 41 | constructor(public device: any, public services: { [key: string]: { service: any, primary: boolean } }) { 42 | device.gatt = this; 43 | } 44 | 45 | connect() { 46 | this.connected = true; 47 | return Promise.resolve(this); 48 | } 49 | 50 | getPrimaryService(service: BluetoothServiceUUID) { 51 | return Promise.resolve(this.services[service].service); 52 | } 53 | 54 | disconnect() { 55 | this.device.disconnect(); 56 | this.connected = false; 57 | } 58 | } 59 | 60 | export class FakeBluetoothRemoteGATTService { 61 | constructor(public device: any, public characteristics: any) { 62 | this.characteristics.service = this; 63 | } 64 | 65 | getCharacteristic(characteristic: BluetoothCharacteristicUUID) { 66 | return Promise.resolve(this.characteristics[characteristic]); 67 | } 68 | } 69 | 70 | export class FakeBluetoothRemoteGATTCharacteristic { 71 | value: DataView | undefined; 72 | properties: BluetoothCharacteristicProperties; 73 | private readonly initialValue: DataView | undefined; 74 | private listeners: { 75 | [key: string]: EventListener[] 76 | } = { 77 | characteristicvaluechanged: [] 78 | }; 79 | 80 | constructor(properties: BluetoothCharacteristicProperties, initialValue?: DataView) { 81 | this.properties = properties; 82 | this.value = initialValue; 83 | this.initialValue = initialValue; 84 | } 85 | 86 | readValue() { 87 | return Promise.resolve(this.value); 88 | } 89 | 90 | addEventListener(type: string, listener: EventListener) { 91 | this.listeners[type] = [ 92 | ...this.listeners[type], 93 | listener 94 | ]; 95 | } 96 | 97 | changeValue(value: DataView) { 98 | this.value = value; 99 | const mockedEvent = {target: this} as unknown; 100 | this.listeners['characteristicvaluechanged'].forEach(listener => listener(mockedEvent as Event)); 101 | } 102 | 103 | clear() { 104 | this.value = this.initialValue; 105 | this.listeners = { 106 | characteristicvaluechanged: [] 107 | }; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/src/public_api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of angular-web-bluetooth 3 | */ 4 | 5 | export * from './lib/platform/browser'; 6 | export * from './lib/platform/server'; 7 | export * from './lib/bluetooth.service'; 8 | export * from './lib/logger.service'; 9 | export * from './lib/bluetooth.module'; 10 | export * from './lib/lang/uuids'; 11 | export * from './lib/test.utils'; 12 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../out-tsc/lib", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "noImplicitAny": false, 8 | "strictNullChecks": false, 9 | "inlineSources": true, 10 | "types": ["node", "web-bluetooth"], 11 | }, 12 | "exclude": [ 13 | "src/test.ts", 14 | "**/*.spec.ts" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": false 5 | }, 6 | "angularCompilerOptions": { 7 | "compilationMode": "partial" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /projects/manekinekko/angular-web-bluetooth/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../../out-tsc/spec", 5 | "types": [ 6 | "jest", 7 | "node", 8 | "web-bluetooth" 9 | ] 10 | }, 11 | "files": [ 12 | "test-setup.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ble-root', 5 | template: ` 6 | 7 | ` 8 | }) 9 | export class AppComponent {} 10 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { LayoutModule } from '@angular/cdk/layout'; 2 | import { NgModule } from '@angular/core'; 3 | import { MatButtonModule } from '@angular/material/button'; 4 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 5 | import { MatCardModule } from '@angular/material/card'; 6 | import { MatExpansionModule } from '@angular/material/expansion'; 7 | import { MatGridListModule } from '@angular/material/grid-list'; 8 | import { MatIconModule } from '@angular/material/icon'; 9 | import { MatListModule } from '@angular/material/list'; 10 | import { MatMenuModule } from '@angular/material/menu'; 11 | import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; 12 | import { MatSnackBarModule } from '@angular/material/snack-bar'; 13 | import { MatToolbarModule } from '@angular/material/toolbar'; 14 | 15 | import { WebBluetoothModule } from '@manekinekko/angular-web-bluetooth'; 16 | import { AppComponent } from './app.component'; 17 | import { BatteryLevelComponent } from './thingy52/battery-level.component'; 18 | import { DashboardComponent } from './dashboard/dashboard.component'; 19 | import { HumidityComponent } from './thingy52/humidity.component'; 20 | import { StepCounterComponent } from './thingy52/stepcounter.component'; 21 | import { TemperatureComponent } from './thingy52/temperature.component'; 22 | import { BrowserModule } from '@angular/platform-browser'; 23 | 24 | @NgModule({ 25 | declarations: [ 26 | AppComponent, 27 | BatteryLevelComponent, 28 | TemperatureComponent, 29 | HumidityComponent, 30 | StepCounterComponent, 31 | DashboardComponent 32 | ], 33 | imports: [ 34 | BrowserModule, 35 | BrowserAnimationsModule, 36 | WebBluetoothModule.forRoot({ 37 | enableTracing: true 38 | }), 39 | LayoutModule, 40 | MatToolbarModule, 41 | MatButtonModule, 42 | MatIconModule, 43 | MatListModule, 44 | MatExpansionModule, 45 | MatSnackBarModule, 46 | MatProgressSpinnerModule, 47 | MatGridListModule, 48 | MatCardModule, 49 | MatMenuModule 50 | ], 51 | bootstrap: [AppComponent] 52 | }) 53 | export class AppModule {} 54 | -------------------------------------------------------------------------------- /src/app/ble.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { Subject } from 'rxjs'; 3 | import { bufferCount, take } from 'rxjs/operators'; 4 | import { BluetoothCore } from '@manekinekko/angular-web-bluetooth'; 5 | import { BleService } from './ble.service'; 6 | 7 | describe('BleService', () => { 8 | let serviceUnderTest: BleService; 9 | 10 | const fakeDevice = new Subject(); 11 | const fakeStreamValue = new Subject(); 12 | const fakeRequestValue = jest.fn((options) => fakeStreamValue); 13 | const fakeDeviceDisconnect = jest.fn(); 14 | 15 | const fakeBluetoothCore = { 16 | getDevice$() { 17 | return fakeDevice; 18 | }, 19 | streamValues$() { 20 | return fakeStreamValue; 21 | }, 22 | value$(options: any) { 23 | return fakeRequestValue(options); 24 | }, 25 | disconnectDevice() { 26 | fakeDeviceDisconnect(); 27 | } 28 | }; 29 | 30 | beforeEach(() => { 31 | TestBed.configureTestingModule({ 32 | providers: [ 33 | BleService, 34 | {provide: BluetoothCore, useValue: fakeBluetoothCore} 35 | ] 36 | }); 37 | 38 | serviceUnderTest = TestBed.inject(BleService); 39 | }); 40 | 41 | it('should create service', () => { 42 | expect(serviceUnderTest).toBeDefined(); 43 | }); 44 | 45 | it('should request decoded service characteristic values', (done) => { 46 | // given 47 | serviceUnderTest.config({ 48 | service: 'battery_service', 49 | characteristic: 'battery_level', 50 | decoder: (value: DataView) => value.getInt8(0) 51 | }); 52 | 53 | // async then 54 | // Kiss or use marble tests ? That's the question 55 | serviceUnderTest.value() 56 | .pipe(take(1)) 57 | .subscribe(next => { 58 | expect(next).toEqual(99); 59 | expect(fakeRequestValue).toBeCalledWith({ 60 | service: 'battery_service', 61 | characteristic: 'battery_level', 62 | }); 63 | done(); 64 | }, _error => done()); 65 | 66 | // when 67 | const fakeDataView = new DataView(new ArrayBuffer(8)); 68 | fakeDataView.setInt8(0, 99); 69 | fakeStreamValue.next(fakeDataView); 70 | }); 71 | 72 | it('should stream decoded characteristic values change', (done) => { 73 | // given 74 | serviceUnderTest.config({ 75 | service: 'battery_service', 76 | characteristic: 'battery_level', 77 | decoder: (value: DataView) => value.getInt8(0) 78 | }); 79 | 80 | // async then 81 | serviceUnderTest.stream() 82 | .pipe(bufferCount(2)) 83 | .subscribe(next => { 84 | expect(next).toEqual([99, 100]); 85 | done(); 86 | }, _error => done()); 87 | 88 | // when 89 | const fakeDataView = new DataView(new ArrayBuffer(8)); 90 | fakeDataView.setInt8(0, 99); 91 | fakeStreamValue.next(fakeDataView); 92 | 93 | fakeDataView.setInt8(0, 100); 94 | fakeStreamValue.next(fakeDataView); 95 | }); 96 | 97 | it('should disconnect device', () => { 98 | // when 99 | serviceUnderTest.disconnectDevice(); 100 | 101 | // then 102 | expect(fakeDeviceDisconnect).toHaveBeenCalled(); 103 | }); 104 | }); 105 | -------------------------------------------------------------------------------- /src/app/ble.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { BluetoothCore } from '@manekinekko/angular-web-bluetooth'; 3 | import { map, tap } from 'rxjs/operators'; 4 | 5 | type ServiceOptions = { 6 | characteristic: string; 7 | service: string, 8 | decoder(value: DataView): number 9 | }; 10 | 11 | @Injectable({ 12 | providedIn: 'root' 13 | }) 14 | export class BleService { 15 | 16 | // tslint:disable-next-line: variable-name 17 | private _config: ServiceOptions = {} as any; 18 | 19 | constructor(public ble: BluetoothCore) {} 20 | 21 | config(options: ServiceOptions) { 22 | this._config = options; 23 | } 24 | 25 | getDevice() { 26 | return this.ble.getDevice$(); 27 | } 28 | 29 | stream() { 30 | return this.ble.streamValues$().pipe( 31 | tap(value => console.log(value)), 32 | map(this._config.decoder) 33 | ); 34 | } 35 | 36 | value() { 37 | return this.ble 38 | .value$({ 39 | service: this._config.service, 40 | characteristic: this._config.characteristic 41 | }) 42 | .pipe( 43 | map(this._config.decoder) 44 | ); 45 | } 46 | 47 | disconnectDevice() { 48 | this.ble.disconnectDevice(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/app/dashboard/dashboard.component.css: -------------------------------------------------------------------------------- 1 | section { 2 | padding: 40px; 3 | max-width: 700px; 4 | margin: 0 auto; 5 | } 6 | 7 | .mat-toolbar.mat-primary { 8 | position: sticky; 9 | top: 0; 10 | z-index: 1; 11 | } 12 | 13 | .grid-container { 14 | margin: 20px; 15 | } 16 | 17 | .dashboard-card { 18 | position: absolute; 19 | top: 15px; 20 | left: 15px; 21 | right: 15px; 22 | bottom: 15px; 23 | } 24 | 25 | .more-button { 26 | position: absolute; 27 | top: 5px; 28 | right: 10px; 29 | } 30 | 31 | .dashboard-card-content { 32 | text-align: center; 33 | } 34 | 35 | 36 | img { 37 | width: 32px; 38 | margin: 0 10px; 39 | } 40 | 41 | .mat-icon { 42 | margin: 0 10px 0 0; 43 | } -------------------------------------------------------------------------------- /src/app/dashboard/dashboard.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Angular Web BLE Demo 4 | 5 | 6 |
          7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Battery Level 16 | 19 | 20 | 24 | 28 | 29 | 30 | 31 | {{ device.name }} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Humidity Level 47 | 50 | 51 | 55 | 59 | 60 | 61 | 62 | {{ device.name }} 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | Temperature 78 | 81 | 82 | 86 | 90 | 91 | 92 | 93 | {{ device.name }} 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | Stepper 109 | 112 | 113 | 117 | 121 | 122 | 123 | 124 | {{ device.name }} 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 |
          135 | -------------------------------------------------------------------------------- /src/app/dashboard/dashboard.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'ble-dashboard', 5 | templateUrl: './dashboard.component.html', 6 | styleUrls: ['./dashboard.component.css'], 7 | }) 8 | export class DashboardComponent { 9 | 10 | constructor() {} 11 | } 12 | -------------------------------------------------------------------------------- /src/app/thingy52/__snapshots__/battery-level.component.spec.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`BatteryLevelComponent should create 1`] = ` 4 | 15 | 18 | 19 | % 20 | 21 | 28 | 44 | 65 | 72 | 73 | `; 74 | 75 | exports[`BatteryLevelComponent should display device connected state 1`] = ` 76 | 87 | 90 | 000 91 | 92 | % 93 | 94 | 105 | 124 | 184 | 192 | 193 | `; 194 | -------------------------------------------------------------------------------- /src/app/thingy52/battery-level.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | import { MatIconModule } from '@angular/material/icon'; 3 | import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; 4 | import { MatSnackBarModule } from '@angular/material/snack-bar'; 5 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 6 | import { Subject } from 'rxjs'; 7 | import { 8 | BluetoothCore, 9 | BrowserWebBluetooth, 10 | ConsoleLoggerService, 11 | FakeBluetoothDevice, NoLoggerService 12 | } from '@manekinekko/angular-web-bluetooth'; 13 | import { BleService } from '../ble.service'; 14 | import { BatteryLevelComponent } from './battery-level.component'; 15 | 16 | 17 | describe('BatteryLevelComponent', () => { 18 | let component: BatteryLevelComponent; 19 | let fixture: ComponentFixture; 20 | 21 | const fakeDevice = new Subject(); 22 | const fakeStreamValue = new Subject(); 23 | const fakeValue = new Subject(); 24 | const fakeValueFn = jest.fn((options) => fakeValue); 25 | const fakeDeviceDisconnectFn = jest.fn(); 26 | 27 | const fakeBluetoothCore: unknown = { 28 | test: 'bob', 29 | getDevice$() { 30 | return fakeDevice; 31 | }, 32 | streamValues$() { 33 | return fakeStreamValue; 34 | }, 35 | value$(options: any) { 36 | return fakeValueFn(options); 37 | }, 38 | disconnectDevice() { 39 | fakeDeviceDisconnectFn(); 40 | } 41 | }; 42 | const fakeBleService = new BleService(fakeBluetoothCore as BluetoothCore); 43 | 44 | beforeEach(() => { 45 | TestBed 46 | .configureTestingModule({ 47 | imports: [ 48 | MatSnackBarModule, 49 | MatIconModule, 50 | MatProgressSpinnerModule, 51 | NoopAnimationsModule, 52 | ], 53 | declarations: [ 54 | BatteryLevelComponent, 55 | ], 56 | }) 57 | .overrideProvider(BleService, {useValue: fakeBleService}) 58 | .overrideProvider(BluetoothCore, {useValue: jest.fn()}) 59 | .overrideProvider(BrowserWebBluetooth, {useValue: jest.fn()}) 60 | .overrideProvider(ConsoleLoggerService, {useValue: new NoLoggerService()}); 61 | 62 | fixture = TestBed.createComponent(BatteryLevelComponent); 63 | component = fixture.componentInstance; 64 | }); 65 | 66 | it('should create', () => { 67 | expect(component).toBeDefined(); 68 | expect(fixture).toMatchSnapshot(); 69 | }); 70 | 71 | it('should display device connected state', () => { 72 | // given 73 | component.ngOnInit(); 74 | component.requestValue(); 75 | 76 | // when 77 | fakeDevice.next(new FakeBluetoothDevice('1', 'My Device')); 78 | fixture.detectChanges(); 79 | 80 | // then 81 | expect(fixture).toMatchSnapshot(); 82 | }); 83 | 84 | it('should display device service/characteristic value changes', () => { 85 | // given 86 | component.ngOnInit(); 87 | component.requestValue(); 88 | 89 | // when 90 | // 1 st value change 91 | const dataView = new DataView(new ArrayBuffer(8)); 92 | dataView.setInt8(0, 99); 93 | fakeStreamValue.next(dataView); 94 | 95 | // then 96 | fixture.detectChanges(); 97 | const nativeElement: HTMLElement = fixture.nativeElement; 98 | 99 | expect(component.value).toEqual(99); 100 | expect(nativeElement.querySelector('[data-testid="value"]')!.textContent).toEqual('99%'); 101 | 102 | // when 103 | // 2 nd value change 104 | dataView.setInt8(0, 100); 105 | fakeStreamValue.next(dataView); 106 | 107 | // then 108 | fixture.detectChanges(); 109 | expect(component.value).toEqual(100); 110 | expect(nativeElement.querySelector('[data-testid="value"]')!.textContent).toEqual('100%'); 111 | }); 112 | 113 | it('should disconnect', () => { 114 | // given 115 | component.ngOnInit(); 116 | component.requestValue(); 117 | fakeDevice.next(new FakeBluetoothDevice('1', 'My Device')); 118 | 119 | // when 120 | component.disconnect(); 121 | 122 | // then 123 | expect(fakeDeviceDisconnectFn).toHaveBeenCalled(); 124 | }); 125 | }); 126 | -------------------------------------------------------------------------------- /src/app/thingy52/battery-level.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnDestroy, OnInit } from '@angular/core'; 2 | import { MatSnackBar } from '@angular/material/snack-bar'; 3 | import { 4 | BluetoothCore, 5 | BrowserWebBluetooth, 6 | ConsoleLoggerService, 7 | } from '@manekinekko/angular-web-bluetooth'; 8 | import { Subscription } from 'rxjs'; 9 | import { BleService } from '../ble.service'; 10 | import { ProgressSpinnerMode } from '@angular/material/progress-spinner'; 11 | 12 | export const bleCore = (b: BrowserWebBluetooth, l: ConsoleLoggerService) => 13 | new BluetoothCore(b, l); 14 | export const bleService = (b: BluetoothCore) => new BleService(b); 15 | 16 | // make sure we get a singleton instance of each service 17 | const PROVIDERS = [ 18 | { 19 | provide: BluetoothCore, 20 | useFactory: bleCore, 21 | deps: [BrowserWebBluetooth, ConsoleLoggerService], 22 | }, 23 | { 24 | provide: BleService, 25 | useFactory: bleService, 26 | deps: [BluetoothCore], 27 | }, 28 | ]; 29 | 30 | @Component({ 31 | selector: 'ble-battery-level', 32 | template: ` 33 | {{ value || '000' }}% 34 | 41 | 42 | battery_charging_full 43 | `, 44 | styles: [ 45 | ` 46 | :host { 47 | display: flex; 48 | justify-content: center; 49 | flex-direction: row; 50 | text-align: center; 51 | } 52 | span { 53 | font-size: 5em; 54 | position: absolute; 55 | top: 222px; 56 | width: 120px; 57 | display: block; 58 | text-align: center; 59 | } 60 | sup { 61 | font-size: 24px; 62 | } 63 | mat-progress-spinner { 64 | top: 90px; 65 | left: 5px; 66 | } 67 | mat-icon { 68 | position: absolute; 69 | bottom: 255px; 70 | } 71 | `, 72 | ], 73 | providers: PROVIDERS, 74 | }) 75 | export class BatteryLevelComponent implements OnInit, OnDestroy { 76 | value = 0; 77 | mode: ProgressSpinnerMode = 'determinate'; 78 | color = 'primary'; 79 | valuesSubscription: Subscription | null = null; 80 | streamSubscription: Subscription | null = null; 81 | deviceSubscription: Subscription | null = null; 82 | 83 | get device() { 84 | return this.service.getDevice(); 85 | } 86 | 87 | constructor( 88 | public service: BleService, 89 | public snackBar: MatSnackBar, 90 | public console: ConsoleLoggerService 91 | ) { 92 | service.config({ 93 | decoder: (value: DataView) => value.getInt8(0), 94 | service: 'battery_service', 95 | characteristic: 'battery_level', 96 | }); 97 | } 98 | 99 | ngOnInit() { 100 | this.getDeviceStatus(); 101 | 102 | this.streamSubscription = this.service.stream().subscribe( 103 | ( 104 | value: 105 | | number 106 | | { 107 | [key: string]: number; 108 | } 109 | ) => { 110 | this.updateValue(value); 111 | }, 112 | (error) => this.hasError(error) 113 | ); 114 | } 115 | 116 | getDeviceStatus() { 117 | this.deviceSubscription = this.service.getDevice().subscribe((device) => { 118 | if (device) { 119 | this.color = 'warn'; 120 | this.mode = 'indeterminate'; 121 | this.value = 0; 122 | } else { 123 | // device not connected or disconnected 124 | this.value = 0; 125 | this.mode = 'determinate'; 126 | this.color = 'primary'; 127 | } 128 | }, this.hasError.bind(this)); 129 | } 130 | 131 | requestValue() { 132 | this.valuesSubscription = this.service.value().subscribe({ 133 | next: ( 134 | val: 135 | | number 136 | | { 137 | [key: string]: number; 138 | } 139 | ) => this.updateValue(val), 140 | error: (err) => this.hasError(err), 141 | }); 142 | } 143 | 144 | updateValue( 145 | value: 146 | | number 147 | | { 148 | [key: string]: number; 149 | } 150 | ) { 151 | 152 | if (typeof value === 'number') { 153 | this.value = value; 154 | } else { 155 | this.value = value['']; 156 | } 157 | 158 | this.console.log('Reading battery level %d', value); 159 | this.mode = 'determinate'; 160 | } 161 | 162 | disconnect() { 163 | this.service.disconnectDevice(); 164 | this.deviceSubscription!.unsubscribe(); 165 | this.valuesSubscription!.unsubscribe(); 166 | } 167 | 168 | hasError(error: string) { 169 | this.snackBar.open(error, 'Close'); 170 | } 171 | 172 | ngOnDestroy() { 173 | this.valuesSubscription?.unsubscribe(); 174 | this.deviceSubscription?.unsubscribe(); 175 | this.streamSubscription?.unsubscribe(); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /src/app/thingy52/humidity.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'; 2 | import { MatSnackBar } from '@angular/material/snack-bar'; 3 | import { BluetoothCore, BrowserWebBluetooth, ConsoleLoggerService } from '@manekinekko/angular-web-bluetooth'; 4 | import { of, Subscription } from 'rxjs'; 5 | import { SmoothieChart, TimeSeries } from 'smoothie'; 6 | import { BleService } from '../ble.service'; 7 | 8 | export const bleCore = (b: BrowserWebBluetooth, l: ConsoleLoggerService) => new BluetoothCore(b, l); 9 | export const bleService = (b: BluetoothCore) => new BleService(b); 10 | 11 | 12 | // make sure we get a singleton instance of each service 13 | const PROVIDERS = [{ 14 | provide: BluetoothCore, 15 | useFactory: bleCore, 16 | deps: [BrowserWebBluetooth, ConsoleLoggerService] 17 | }, { 18 | provide: BleService, 19 | useFactory: bleService, 20 | deps: [BluetoothCore] 21 | }]; 22 | 23 | @Component({ 24 | selector: 'ble-humidity', 25 | template: ` 26 | 27 | `, 28 | styles: [` 29 | :host { 30 | display: block; 31 | } 32 | canvas { 33 | margin-left: -16px; 34 | }`], 35 | providers: PROVIDERS 36 | }) 37 | export class HumidityComponent implements OnInit, OnDestroy { 38 | series: TimeSeries | null = null; 39 | chart: SmoothieChart | null = null; 40 | valuesSubscription: Subscription | null = null; 41 | streamSubscription: Subscription | null = null; 42 | 43 | @ViewChild('chart', { static: true }) 44 | chartRef: ElementRef | null = null; 45 | 46 | get device() { 47 | return this.service.getDevice(); 48 | } 49 | 50 | constructor( 51 | public service: BleService, 52 | public snackBar: MatSnackBar) { 53 | 54 | service.config({ 55 | decoder: (value: DataView) => value.getInt8(0), 56 | service: 'ef680200-9b35-4933-9b10-52ffa9740042', 57 | characteristic: 'ef680203-9b35-4933-9b10-52ffa9740042' 58 | }); 59 | } 60 | 61 | ngOnInit() { 62 | this.initChart(); 63 | 64 | this.streamSubscription = this.service.stream() 65 | .subscribe({ 66 | next: (val: number | { [key: string]: number; }) => this.updateValue(val), 67 | error: (err) => this.hasError(err) 68 | }); 69 | } 70 | 71 | initChart() { 72 | this.series = new window.TimeSeries() as TimeSeries; 73 | const canvas = this.chartRef!.nativeElement; 74 | // tslint:disable-next-line: max-line-length 75 | this.chart = new window.SmoothieChart({ interpolation: 'step', grid: { fillStyle: '#ffffff', strokeStyle: 'rgba(119,119,119,0.18)', borderVisible: false }, labels: { fillStyle: '#000000', fontSize: 17 }, tooltip: true }); 76 | this.chart!.addTimeSeries(this.series, { lineWidth: 1, strokeStyle: '#ff0000', fillStyle: 'rgba(255,161,161,0.30)' }); 77 | this.chart!.streamTo(canvas); 78 | this.chart!.stop(); 79 | } 80 | 81 | requestValue() { 82 | this.valuesSubscription = this.service.value() 83 | .subscribe( 84 | () => null, 85 | () => of(this.hasError.bind(this)), 86 | ); 87 | } 88 | 89 | 90 | updateValue(value: number | { [key: string]: number; }) { 91 | console.log('Reading humidity %d', value); 92 | 93 | if (typeof value === 'number') { 94 | this.series!.append(Date.now(), value); 95 | this.chart!.start(); 96 | } 97 | 98 | } 99 | 100 | 101 | disconnect() { 102 | this.service.disconnectDevice(); 103 | this.series!.clear(); 104 | this.chart!.stop(); 105 | this.valuesSubscription!.unsubscribe(); 106 | } 107 | 108 | hasError(error: string) { 109 | this.snackBar.open(error, 'Close'); 110 | } 111 | 112 | ngOnDestroy() { 113 | this.valuesSubscription!.unsubscribe(); 114 | this.streamSubscription!.unsubscribe(); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/app/thingy52/stepcounter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnDestroy, OnInit } from '@angular/core'; 2 | import { MatSnackBar } from '@angular/material/snack-bar'; 3 | import { BluetoothCore, BrowserWebBluetooth, ConsoleLoggerService } from '@manekinekko/angular-web-bluetooth'; 4 | import { Subscription } from 'rxjs'; 5 | import { BleService } from '../ble.service'; 6 | 7 | export const bleCore = (b: BrowserWebBluetooth, l: ConsoleLoggerService) => new BluetoothCore(b, l); 8 | export const bleService = (b: BluetoothCore) => new BleService(b); 9 | 10 | 11 | // make sure we get a singleton instance of each service 12 | const PROVIDERS = [{ 13 | provide: BluetoothCore, 14 | useFactory: bleCore, 15 | deps: [BrowserWebBluetooth, ConsoleLoggerService] 16 | }, { 17 | provide: BleService, 18 | useFactory: bleService, 19 | deps: [BluetoothCore] 20 | }]; 21 | 22 | @Component({ 23 | selector: 'ble-stepcounter', 24 | template: ` 25 | {{ value || "000" }} 26 | directions_walk 27 | `, 28 | styles: [` 29 | :host { 30 | display: block; 31 | } 32 | span { 33 | font-size: 5em; 34 | position: absolute; 35 | top: 112px; 36 | left: 214px; 37 | width: 120px; 38 | display: block; 39 | text-align: center; 40 | } 41 | mat-icon { 42 | font-size: 11em; 43 | width: 100%; 44 | height: 100%; 45 | }`], 46 | providers: PROVIDERS 47 | }) 48 | export class StepCounterComponent implements OnInit, OnDestroy { 49 | valuesSubscription: Subscription | null = null; 50 | streamSubscription: Subscription | null = null; 51 | value = 0; 52 | 53 | get device() { 54 | return this.service.getDevice(); 55 | } 56 | 57 | constructor( 58 | public service: BleService, 59 | public snackBar: MatSnackBar) { 60 | 61 | service.config({ 62 | decoder: (value: DataView) => { 63 | const count = value.getUint32(0, true); 64 | const time = value.getUint32(4, true); 65 | return count; 66 | }, 67 | service: 'ef680400-9b35-4933-9b10-52ffa9740042', 68 | characteristic: 'ef680405-9b35-4933-9b10-52ffa9740042' 69 | }); 70 | } 71 | 72 | ngOnInit() { 73 | this.streamSubscription = this.service.stream() 74 | .subscribe({ 75 | next: (val: number) => this.updateValue(val), 76 | error: (err) => this.hasError(err) 77 | }); 78 | } 79 | 80 | requestValue() { 81 | this.valuesSubscription = this.service.value() 82 | .subscribe(() => null, error => this.hasError.bind(this)); 83 | } 84 | 85 | updateValue(value: number) { 86 | console.log('Reading step counter %d', value); 87 | this.value = value; 88 | } 89 | 90 | disconnect() { 91 | this.service.disconnectDevice(); 92 | this.valuesSubscription!.unsubscribe(); 93 | } 94 | 95 | hasError(error: string) { 96 | this.snackBar.open(error, 'Close'); 97 | } 98 | 99 | ngOnDestroy() { 100 | this.valuesSubscription!.unsubscribe(); 101 | this.streamSubscription!.unsubscribe(); 102 | } 103 | } 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/app/thingy52/temperature.component.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Component, 3 | ElementRef, 4 | OnDestroy, 5 | OnInit, 6 | ViewChild, 7 | } from '@angular/core'; 8 | import { MatSnackBar } from '@angular/material/snack-bar'; 9 | import { 10 | BluetoothCore, 11 | BrowserWebBluetooth, 12 | ConsoleLoggerService, 13 | } from '@manekinekko/angular-web-bluetooth'; 14 | import { Subscription } from 'rxjs'; 15 | import { SmoothieChart, TimeSeries } from 'smoothie'; 16 | import { BleService } from '../ble.service'; 17 | 18 | export const bleCore = (b: BrowserWebBluetooth, l: ConsoleLoggerService) => 19 | new BluetoothCore(b, l); 20 | export const bleService = (b: BluetoothCore) => new BleService(b); 21 | 22 | // make sure we get a singleton instance of each service 23 | const PROVIDERS = [ 24 | { 25 | provide: BluetoothCore, 26 | useFactory: bleCore, 27 | deps: [BrowserWebBluetooth, ConsoleLoggerService], 28 | }, 29 | { 30 | provide: BleService, 31 | useFactory: bleService, 32 | deps: [BluetoothCore], 33 | }, 34 | ]; 35 | 36 | @Component({ 37 | selector: 'ble-temperature', 38 | template: ` `, 39 | styles: [ 40 | ` 41 | :host { 42 | display: block; 43 | } 44 | canvas { 45 | margin-left: -16px; 46 | } 47 | `, 48 | ], 49 | providers: PROVIDERS, 50 | }) 51 | export class TemperatureComponent implements OnInit, OnDestroy { 52 | series: TimeSeries | null = null; 53 | chart: SmoothieChart | null = null; 54 | valuesSubscription: Subscription | null = null; 55 | streamSubscription: Subscription | null = null; 56 | 57 | @ViewChild('chart', { static: true }) 58 | chartRef: ElementRef | null = null; 59 | 60 | get device() { 61 | return this.service.getDevice(); 62 | } 63 | 64 | constructor(public service: BleService, public snackBar: MatSnackBar) { 65 | service.config({ 66 | characteristic: 'ef680201-9b35-4933-9b10-52ffa9740042', 67 | service: 'ef680200-9b35-4933-9b10-52ffa9740042', 68 | decoder: (value: DataView) => { 69 | const integer = value.getInt8(0); 70 | const decimal = value.getUint8(1); 71 | return integer + decimal / 100; 72 | }, 73 | }); 74 | } 75 | 76 | ngOnInit() { 77 | this.initChart(); 78 | 79 | this.streamSubscription = this.service.stream().subscribe({ 80 | next: (val: number | { [key: string]: number; }) => this.updateValue(val), 81 | error: (err) => this.hasError(err), 82 | }); 83 | } 84 | 85 | initChart() { 86 | this.series = new window.TimeSeries() as TimeSeries; 87 | const canvas = this.chartRef!.nativeElement; 88 | this.chart = new window.SmoothieChart({ 89 | interpolation: 'step', 90 | grid: { 91 | fillStyle: '#ffffff', 92 | strokeStyle: 'rgba(119,119,119,0.18)', 93 | borderVisible: false, 94 | }, 95 | labels: { 96 | fillStyle: '#000000', 97 | fontSize: 17, 98 | }, 99 | tooltip: true, 100 | }); 101 | this.chart!.addTimeSeries(this.series, { 102 | lineWidth: 1, 103 | strokeStyle: '#ff0000', 104 | fillStyle: 'rgba(255,161,161,0.30)', 105 | }); 106 | this.chart!.streamTo(canvas); 107 | this.chart!.stop(); 108 | } 109 | 110 | requestValue() { 111 | this.valuesSubscription = this.service.value().subscribe( 112 | () => null, 113 | (error) => this.hasError.bind(this) 114 | ); 115 | } 116 | 117 | updateValue(value: number | { [key: string]: number; }) { 118 | console.log('Reading temperature %d', value); 119 | 120 | if (typeof value === 'number') { 121 | this.series!.append(Date.now(), value); 122 | this.chart!.start(); 123 | } 124 | } 125 | 126 | disconnect() { 127 | this.service.disconnectDevice(); 128 | this.series!.clear(); 129 | this.chart!.stop(); 130 | this.valuesSubscription!.unsubscribe(); 131 | } 132 | 133 | hasError(error: string) { 134 | this.snackBar.open(error, 'Close'); 135 | } 136 | 137 | ngOnDestroy() { 138 | this.valuesSubscription!.unsubscribe(); 139 | this.streamSubscription!.unsubscribe(); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/android-chrome-192x192.png -------------------------------------------------------------------------------- /src/assets/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/android-chrome-512x512.png -------------------------------------------------------------------------------- /src/assets/angular-web-ble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/angular-web-ble.png -------------------------------------------------------------------------------- /src/assets/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/apple-touch-icon.png -------------------------------------------------------------------------------- /src/assets/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/favicon-16x16.png -------------------------------------------------------------------------------- /src/assets/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/favicon-32x32.png -------------------------------------------------------------------------------- /src/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/favicon.ico -------------------------------------------------------------------------------- /src/assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/assets/screenshot.png -------------------------------------------------------------------------------- /src/assets/site.webmanifest: -------------------------------------------------------------------------------- 1 | {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manekinekko/angular-web-bluetooth/f38ed22ceedc9df697b7d4fe80fd535eabd32a16/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular Web Bluetooth Starter 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | 28 | 29 | Angular BLE logo 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | @import '@angular/material/prebuilt-themes/deeppurple-amber.css'; 4 | html, body { height: 100%; } 5 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 6 | 7 | body { 8 | min-width: 800px; 9 | } 10 | -------------------------------------------------------------------------------- /src/typing.d.ts: -------------------------------------------------------------------------------- 1 | declare interface Window { 2 | SmoothieChart: any; 3 | TimeSeries: any; 4 | } 5 | -------------------------------------------------------------------------------- /test-setup.ts: -------------------------------------------------------------------------------- 1 | import 'jest-preset-angular/setup-jest'; 2 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | ], 10 | "include": [ 11 | "src/**/*.d.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "paths": { 5 | "@manekinekko/angular-web-bluetooth": [ 6 | "./dist/manekinekko/angular-web-bluetooth" 7 | ] 8 | }, 9 | "outDir": "./dist/out-tsc", 10 | "forceConsistentCasingInFileNames": true, 11 | "strict": true, 12 | "noImplicitOverride": true, 13 | "noPropertyAccessFromIndexSignature": true, 14 | "noImplicitReturns": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "skipLibCheck": true, 17 | "esModuleInterop": true, 18 | "sourceMap": true, 19 | "declaration": false, 20 | "experimentalDecorators": true, 21 | "moduleResolution": "node", 22 | "importHelpers": true, 23 | "target": "ES2022", 24 | "module": "ES2022", 25 | "useDefineForClassFields": false, 26 | "lib": [ 27 | "ES2022", 28 | "dom" 29 | ] 30 | }, 31 | "angularCompilerOptions": { 32 | "enableI18nLegacyMessageIdFormat": false, 33 | "strictInjectionParameters": true, 34 | "strictInputAccessModifiers": true, 35 | "strictTemplates": true 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jest", 7 | "node", 8 | "web-bluetooth" 9 | ] 10 | }, 11 | "include": [ 12 | "src/**/*.spec.ts", 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | --------------------------------------------------------------------------------