Implement send default and R/W to file

This commit is contained in:
David Majdandžić
2023-03-28 03:51:52 +02:00
parent 1dd5b9ed7c
commit bb363deb2a
7 changed files with 250 additions and 1651 deletions

View File

@@ -1,5 +1,6 @@
const smpp = require("smpp");
// TODO: Implement on change event and propagate it to sessions
export class Job {
pdu: any;
perSecond?: number;
@@ -15,6 +16,14 @@ export class Job {
return JSON.stringify(this);
}
static deserialize(serialized: any): Job {
if (!serialized.pdu.command) {
throw new Error("Invalid serialized job");
}
let pdu: any = new smpp.PDU(serialized.pdu.command, serialized.pdu);
return new Job(pdu, serialized.perSecond, serialized.count);
}
static createEmptySingle(): Job {
return new Job({});
}