1- import { Component , ElementRef , OnDestroy , OnInit , ViewChild } from '@angular/core' ;
1+ import { Component , OnDestroy , OnInit } from '@angular/core' ;
22import { MatSnackBar } from '@angular/material' ;
33import { BluetoothCore , BrowserWebBluetooth , ConsoleLoggerService } from '@manekinekko/angular-web-bluetooth' ;
44import { Subscription } from 'rxjs' ;
5- import { SmoothieChart , TimeSeries } from 'smoothie' ;
65import { BleService } from '../ble.service' ;
76
87// make sure we get a singleton instance of each service
@@ -54,20 +53,20 @@ export class StepCounterComponent implements OnInit, OnDestroy {
5453
5554 constructor (
5655 public service : BleService ,
57- public snackBar : MatSnackBar ) {
56+ public snackBar : MatSnackBar ) {
5857
59- service . config ( {
60- decoder : ( value : DataView ) => {
61- const count = value . getUint32 ( 0 , true ) ;
62- const time = value . getUint32 ( 4 , true ) ;
63- return {
64- count, time
65- }
66- } ,
67- service : "ef680400-9b35-4933-9b10-52ffa9740042" ,
68- characteristic : "ef680405-9b35-4933-9b10-52ffa9740042"
69- } )
70- }
58+ service . config ( {
59+ decoder : ( value : DataView ) => {
60+ const count = value . getUint32 ( 0 , true ) ;
61+ const time = value . getUint32 ( 4 , true ) ;
62+ return {
63+ count, time
64+ }
65+ } ,
66+ service : "ef680400-9b35-4933-9b10-52ffa9740042" ,
67+ characteristic : "ef680405-9b35-4933-9b10-52ffa9740042"
68+ } )
69+ }
7170
7271 ngOnInit ( ) {
7372 this . streamSubscription = this . service . stream ( )
@@ -79,7 +78,7 @@ export class StepCounterComponent implements OnInit, OnDestroy {
7978 . subscribe ( null , this . hasError . bind ( this ) ) ;
8079 }
8180
82- updateValue ( value : { time : number , count : number } ) {
81+ updateValue ( value : { time : number , count : number } ) {
8382 console . log ( 'Reading step counter %d' , value ) ;
8483 this . value = value . count ;
8584 }
0 commit comments