1 import { Injectable } from '@angular/core';
2 import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
3 import { Observable,throwError } from 'rxjs'
4 import { timer, Subscription, pipe } from 'rxjs';
5 import { switchMap } from 'rxjs/operators';
7 import { delay } from 'rxjs/operators';
9 import { nodeDetails } from './datainterface';
12 import { retry,catchError } from 'rxjs/operators';
13 import { v4 as uuid } from 'uuid';
20 export class EaltserviceService {
23 private baseUrl = 'http://159.138.139.4:30281/';
25 private imageUploadUrl = this.baseUrl+'uploadimageinput';
27 private nodes_url = './../assets/data/nodes.json';
28 private packageUploadUrl = this.baseUrl+'uploadimageinput';
30 private historyIdUrl = this.baseUrl+'history/files';
32 private outputImageUrl = this.baseUrl
34 private inputImageUrl = this.baseUrl
36 private pcbDetectUrl = this.baseUrl
38 private monitorImageUrl = 'http://159.138.33.54:30092' + '/v1/inventry/image'
41 constructor(private http:HttpClient) {
45 headers: new HttpHeaders({
46 'Content-Type':'application/json'
50 getNodesInfoo(): Observable<nodeDetails> {
51 return this.http.get<nodeDetails>(this.nodes_url);
54 postHistoryId(data): Observable<Blob> {
55 return this.http.get<Blob>(this.historyIdUrl, {params: data} );
58 postDeploymentPackage(data): Observable<any> {
59 return this.http.post<any>(this.packageUploadUrl, data);
62 postInputImages(data): Observable<any> {
63 return this.http.post<any>(this.imageUploadUrl, data)
66 getOutputImage(): Observable<any> {
68 this.outputImageUrl = this.baseUrl + 'v1/pcb/resultimage';
69 return this.http.get<any>(this.outputImageUrl);
72 getInputImage(data): Observable<any> {
74 this.inputImageUrl = this.baseUrl + 'v1/pcb/preview/' + data;
75 // return this.http.get<any>(this.monitorImageUrl);
76 return this.http.get<any>(this.inputImageUrl);
79 pcbDetect(data): Observable<any> {
81 this.pcbDetectUrl = this.baseUrl + 'v1/pcb/detection/' + data;
82 return this.http.get<any>(this.pcbDetectUrl);