gsd 7 months ago
parent
commit
d25d07d7a8
  1. 2
      pipboyUI/dist/pipboy-ui/index.html
  2. 1
      pipboyUI/dist/pipboy-ui/main.4f49978fff4f95f7.js
  3. 1
      pipboyUI/dist/pipboy-ui/main.dcb951af32c9d3b0.js
  4. 3
      pipboyUI/src/app/components/UpperHeaders/meshtastic-header.component.ts
  5. 16
      pipboyUI/src/app/services/MeshtasticService.ts

2
pipboyUI/dist/pipboy-ui/index.html

@ -10,6 +10,6 @@
<style>@font-face{font-family:RobotoTodd;src:url(Roboto-Regular.a8e6f6203d22df08.ttf);font-weight:400;font-style:normal}@font-face{font-family:RobotoTodd;src:url(Roboto-Bold.3b887fc8dca30f62.ttf);font-weight:700;font-style:normal}html,body{height:320px;width:460px;background-color:#000}body{margin:0;font-family:RobotoTodd,Helvetica Neue,sans-serif;color:#00f200}</style><link rel="stylesheet" href="styles.0f01a56d899ea41a.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.0f01a56d899ea41a.css"></noscript></head>
<body>
<app-root></app-root>
<script src="runtime.5ce4d2517a1e7b85.js" type="module"></script><script src="polyfills.f09cd0637b821a03.js" type="module"></script><script src="main.dcb951af32c9d3b0.js" type="module"></script>
<script src="runtime.5ce4d2517a1e7b85.js" type="module"></script><script src="polyfills.f09cd0637b821a03.js" type="module"></script><script src="main.4f49978fff4f95f7.js" type="module"></script>
</body></html>

1
pipboyUI/dist/pipboy-ui/main.4f49978fff4f95f7.js

File diff suppressed because one or more lines are too long

1
pipboyUI/dist/pipboy-ui/main.dcb951af32c9d3b0.js

File diff suppressed because one or more lines are too long

3
pipboyUI/src/app/components/UpperHeaders/meshtastic-header.component.ts

@ -5,7 +5,7 @@ import {
MeshtasticService,
NOT_CONNECTED,
RECONNECT,
WAIT_CONFIG
WAIT_CONFIG, WS_ERR
} from "../../services/MeshtasticService";
@Component({
@ -44,6 +44,7 @@ export class MeshtasticHeaderComponent {
case AVAILABLE: return "Доступен";
case ERR: return "Ошибка модуля";
case RECONNECT: return "Переподключение";
case WS_ERR: return "Ошибка вебсокета";
default: return "Хуй знает";
}
}

16
pipboyUI/src/app/services/MeshtasticService.ts

@ -1,7 +1,7 @@
import {Injectable} from "@angular/core";
import {WebSocketSubject} from "rxjs/internal/observable/dom/WebSocketSubject";
import {webSocket} from "rxjs/webSocket";
import {BehaviorSubject} from "rxjs";
import {BehaviorSubject, delay, retryWhen, tap} from "rxjs";
export const WS_EVENT_CHANNEL = 0;
export const WS_EVENT_NODE = 1;
@ -18,6 +18,7 @@ export const WAIT_CONFIG = 1;
export const AVAILABLE = 2;
export const ERR = 3;
export const RECONNECT = 4;
export const WS_ERR = 5;
interface MeshNodeShort {
id: number;
@ -33,7 +34,7 @@ interface MeshChannel {
providedIn: 'root'
})
export class MeshtasticService {
private socket$?: WebSocketSubject<any>;
private socket$?: any;
public channels: MeshChannel[] = [];
public nodes: MeshNodeShort[] = [];
public messages = new BehaviorSubject('{}')
@ -56,7 +57,13 @@ export class MeshtasticService {
}
private connect() {
this.socket$ = webSocket(`ws://${location.host}/mesh/ws`)
this.socket$ = webSocket(`ws://${location.host}/mesh/ws`).pipe(
retryWhen(errors => errors.pipe(
tap(err => {console.log('WebSocket error, reconnecting...', err); this.state = WS_ERR;}),
delay(3000)
))
);
this.socket$.subscribe(
(parsed: {type: number, event: number, data: any}) => {
switch (parsed.event) {
@ -94,8 +101,7 @@ export class MeshtasticService {
}
}
},
(err) => {}
}
)
}
}

Loading…
Cancel
Save