Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 3x 3x 3x | import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable, inject } from '@angular/core';
import { Observable } from 'rxjs';
import { BASE_URL } from 'src/shared/tokens/base-url.token';
@Injectable({
providedIn: 'root'
})
export class MeasureService {
private readonly http = inject(HttpClient);
private readonly baseUrl = inject(BASE_URL);
private readonly baseRoute = 'api/RecordRawDepth/';
private readonly getIsCapturingRoute = `${this.baseRoute}IsCapturing`;
private readonly getCurrentRecordIdRoute = `${this.baseRoute}CurrentRecordId`;
private readonly getCurrentSampleIdxRoute = `${this.baseRoute}CurrentSampleIdx`;
private readonly recordSamplesRoute = `${this.baseRoute}RecordSamples`;
// eslint-disable-next-line @typescript-eslint/naming-convention
private readonly headers = new HttpHeaders({ 'Content-Type': 'application/json' });
public isCapturing(): Observable<boolean> {
return this.http.get<boolean>(this.baseUrl + this.getIsCapturingRoute);
}
public getCurrentRecordId(): Observable<number> {
return this.http.get<number>(this.baseUrl + this.getCurrentRecordIdRoute);
}
public getCurrentSampleIdx(): Observable<number> {
return this.http.get<number>(this.baseUrl + this.getCurrentSampleIdxRoute);
}
public startCapture(captureId: number): Observable<string> {
return this.http.put(
this.baseUrl + this.recordSamplesRoute,
`{ "name" : "captureId", "value": ${captureId}}`,
{ headers: this.headers, responseType: 'text' }
);
}
}
|