2018-01-26 15:10:39 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { WebSocketService } from './websocket.service';
|
|
|
|
|
|
|
|
|
|
|
|
class FSMUpdate {
|
|
|
|
current_state: string;
|
|
|
|
valid_transitions: object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class FSMUpdateService {
|
|
|
|
public current_state: string;
|
|
|
|
public valid_transitions: object;
|
|
|
|
|
2018-02-01 15:38:13 +00:00
|
|
|
constructor(private websocketService: WebSocketService) {}
|
2018-01-26 15:10:39 +00:00
|
|
|
|
|
|
|
public init(): void {
|
2018-02-01 15:38:13 +00:00
|
|
|
this.websocketService.observeAnchor<FSMUpdate>('FSMUpdate').subscribe((event) => {
|
2018-01-26 15:10:39 +00:00
|
|
|
this.current_state = event.data.current_state;
|
|
|
|
this.valid_transitions = event.data.valid_transitions;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|