Implement source and desination enumerators for client

This commit is contained in:
David Majdandžić
2023-04-04 09:49:44 +02:00
parent e2a7c52541
commit c498f6cfb7
9 changed files with 119 additions and 47 deletions

View File

@@ -35,8 +35,8 @@ export class Center extends SmppSession {
this._password = password;
this.port = port;
this._defaultSingleJob = Job.createEmptySingle();
this._defaultMultipleJob = Job.createEmptyMultiple();
this._defaultSingleJob = Job.createEmptySingle('deliver_sm');
this._defaultMultipleJob = Job.createEmptyMultiple('deliver_sm');
this.logger = new Logger(`Center-${id}`);
@@ -218,4 +218,21 @@ export class Center extends SmppSession {
this.setStatus(0);
}
}
// No reaason for this to be a promise
eventAnyPdu(session: any, pdu: any): Promise<any> {
this.eventEmitter.emit(this.EVENT.ANY_PDU, pdu);
let successful: number = 0;
this.pduProcessors.forEach((pduProcessor: PduProcessor) => {
pduProcessor.processPdu(session, pdu).then((result: any) => {
successful++;
}, (error: any) => {
});
});
if (successful === 0) {
return Promise.resolve("No PDU processor was able to process the PDU");
} else {
return Promise.resolve();
}
}
}