Skip to content

Commit 4a03f8c

Browse files
committed
chore: fix formatting
1 parent ab2c25c commit 4a03f8c

File tree

5 files changed

+24
-37
lines changed

5 files changed

+24
-37
lines changed

src/app/ble.service.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ type ServiceOptions = {
88
decoder(value: DataView): number | {[key: string]: number}
99
};
1010

11-
export function makeSingleton() {
12-
return [{
13-
provide: BluetoothCore,
14-
useFactory: (b, l) => new BluetoothCore(b, l),
15-
deps: [BrowserWebBluetooth, ConsoleLoggerService]
16-
}, {
17-
provide: BleService,
18-
useFactory: (b) => new BleService(b),
19-
deps: [BluetoothCore]
20-
}];
21-
}
22-
2311
@Injectable({
2412
providedIn: 'root'
2513
})

src/app/thingy52/battery-level.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Component, OnInit } from '@angular/core';
22
import { MatSnackBar } from '@angular/material';
3+
import { BluetoothCore, BrowserWebBluetooth, ConsoleLoggerService } from '@manekinekko/angular-web-bluetooth';
34
import { Subscription } from 'rxjs';
45
import { BleService } from '../ble.service';
5-
import { BluetoothCore, BrowserWebBluetooth, ConsoleLoggerService } from '@manekinekko/angular-web-bluetooth';
66

77
// make sure we get a singleton instance of each service
88
const PROVIDERS = [{

src/app/thingy52/humidity.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ export class HumidityComponent implements OnInit {
4747
public service: BleService,
4848
public snackBar: MatSnackBar) {
4949

50-
service.config({
51-
decoder: (value: DataView) => value.getInt8(0),
52-
service: "ef680200-9b35-4933-9b10-52ffa9740042",
53-
characteristic: "ef680203-9b35-4933-9b10-52ffa9740042"
54-
})
55-
}
50+
service.config({
51+
decoder: (value: DataView) => value.getInt8(0),
52+
service: "ef680200-9b35-4933-9b10-52ffa9740042",
53+
characteristic: "ef680203-9b35-4933-9b10-52ffa9740042"
54+
})
55+
}
5656

5757
ngOnInit() {
5858
this.initChart();

src/app/thingy52/stepcounter.component.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
1+
import { Component, OnDestroy, OnInit } from '@angular/core';
22
import { MatSnackBar } from '@angular/material';
33
import { BluetoothCore, BrowserWebBluetooth, ConsoleLoggerService } from '@manekinekko/angular-web-bluetooth';
44
import { Subscription } from 'rxjs';
5-
import { SmoothieChart, TimeSeries } from 'smoothie';
65
import { 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
}

src/app/thingy52/temperature.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
22
import { MatSnackBar } from '@angular/material';
3+
import { BluetoothCore, BrowserWebBluetooth, ConsoleLoggerService } from '@manekinekko/angular-web-bluetooth';
34
import { Subscription } from 'rxjs';
45
import { SmoothieChart, TimeSeries } from 'smoothie';
5-
import { BleService, makeSingleton } from '../ble.service';
6-
import { ConsoleLoggerService, BluetoothCore, BrowserWebBluetooth } from '@manekinekko/angular-web-bluetooth';
6+
import { BleService } from '../ble.service';
77

88
// make sure we get a singleton instance of each service
99
const PROVIDERS = [{

0 commit comments

Comments
 (0)