94 lines
3.1 KiB
TypeScript
94 lines
3.1 KiB
TypeScript
import { baseRestService } from "../_base/baseRestService";
|
|
import { CONFIGURATION } from "@/config";
|
|
import { warmersActions } from "@/store/warmers.store";
|
|
import { store } from "@/store";
|
|
import Warmers from "@/app_modules_thermo/setup/riscaldi/components/base-components/warmers";
|
|
import Numeric from "@/app_modules_thermo/components/numeric";
|
|
|
|
export class WarmersService extends baseRestService {
|
|
|
|
BASE_URL = async () => (await CONFIGURATION).api.apiServerUrl + "api/warmers/";
|
|
|
|
async GetThermocameraStatus() {
|
|
let result = await this.Get((await this.BASE_URL()) + "TCamData");
|
|
warmersActions.setTcamStatus(store, result as Warmers.ICamStatus);
|
|
return result;
|
|
}
|
|
|
|
async GetChannels() {
|
|
let result = await this.Get((await this.BASE_URL()) + "channels");
|
|
warmersActions.setChannels(store, result as { [id: number]: Warmers.IChannel });
|
|
return result;
|
|
}
|
|
|
|
async GetResistances() {
|
|
let result = await this.Get((await this.BASE_URL()) + "resistances");
|
|
warmersActions.setResistances(store, result as { [id: number]: Warmers.IResistance });
|
|
return result;
|
|
}
|
|
|
|
async Update(model: any) {
|
|
let result = await this.Put<any>((await this.BASE_URL()) + "update", model, true);
|
|
return result;
|
|
}
|
|
|
|
async UpdateTemp(model: any) {
|
|
let result = await this.Put<any>((await this.BASE_URL()) + "updateTCamTemp", model, true);
|
|
return result;
|
|
}
|
|
|
|
async UpdateEnable(model: any) {
|
|
let result = await this.Put<any>((await this.BASE_URL()) + "updateTCamEnab", model, true);
|
|
return result;
|
|
}
|
|
|
|
async setTCamMode(model: boolean) {
|
|
let result = await this.Put<any>((await this.BASE_URL()) + "setTCamMode?enableTCam=" + model, {}, true);
|
|
return result;
|
|
}
|
|
|
|
async setTCamOn(model: boolean) {
|
|
let result = await this.Put<any>((await this.BASE_URL()) + "setTCamOn?setTCamOn=" + model, {}, true);
|
|
return result;
|
|
}
|
|
|
|
async Confirm() {
|
|
let result = await this.Put<any>((await this.BASE_URL()) + "confirm", null, true);
|
|
return result;
|
|
}
|
|
|
|
async Cancel() {
|
|
let result = await this.Put<any>((await this.BASE_URL()) + "cancel", null, true);
|
|
return result;
|
|
}
|
|
|
|
async SetConfig() {
|
|
let result = await this.Put<any>((await this.BASE_URL()) + "setConfig", null, true);
|
|
return result;
|
|
}
|
|
|
|
async GetTCamData() {
|
|
let result = await this.Get<{
|
|
imageSize: { x: number, y: number },
|
|
rangeTemperature: { max: number, min: number },
|
|
thermoCamConnected: boolean,
|
|
thermoOptionActive: boolean,
|
|
lastTakenImage: Date,
|
|
}>((await this.BASE_URL()) + "TCamData", true);
|
|
return result;
|
|
}
|
|
|
|
|
|
async GetMeasurePoints(setname: string): Promise<any> {
|
|
return await this.Get<any>((await this.BASE_URL()) + `getMeasurePoints?setName=${setname}`, true);
|
|
}
|
|
|
|
async SetMeasurePoints(x: number, y: number) {
|
|
return await this.Put((await this.BASE_URL()) + `addMeasurePoint?posX=${Math.round(x)}&posY=${Math.round(y)}`, null, true);
|
|
}
|
|
|
|
async ResetMeasurePoints() {
|
|
return this.Put((await this.BASE_URL()) + `resetMeasurePoint`, null, true);
|
|
}
|
|
}
|
|
export const warmersService = new WarmersService(); |