This commit is contained in:
PhatPhuckDave
2024-07-22 19:52:53 +02:00
parent a18ac0355c
commit 4a5aa484ba
57 changed files with 4213 additions and 3046 deletions

View File

@@ -1,17 +1,17 @@
import {PDU} from "./CommonObjects";
export default class MessageIdManager {
private static messages: { [key: string]: number } = {};
static addMessageId(message: PDU, id: number): void {
this.messages[this.getMessageHash(message)] = id;
}
static getMessageId(message: PDU): number | undefined {
return this.messages[this.getMessageHash(message)];
}
private static getMessageHash(message: PDU): string {
return btoa(`${message.source_addr}:${message.destination_addr}:${message.short_message}`);
}
}
import {PDU} from "./CommonObjects";
export default class MessageIdManager {
private static messages: { [key: string]: number } = {};
static addMessageId(message: PDU, id: number): void {
this.messages[this.getMessageHash(message)] = id;
}
static getMessageId(message: PDU): number | undefined {
return this.messages[this.getMessageHash(message)];
}
private static getMessageHash(message: PDU): string {
return btoa(`${message.source_addr}:${message.destination_addr}:${message.short_message}`);
}
}