Fully implement delivery reports

This commit is contained in:
David Majdandžić
2023-04-05 22:00:33 +02:00
parent 3447194e99
commit 251658f385
9 changed files with 80 additions and 76 deletions

17
src/MessageIdManager.ts Normal file
View File

@@ -0,0 +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}`);
}
}