Working commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import {Client} from "../../../Client/Client";
|
||||
import {PDU} from "../../../CommonObjects";
|
||||
import Preprocessor from "../Preprocessor";
|
||||
|
||||
export class DestinationEnumeratorProcessor extends Preprocessor {
|
||||
serverSessionType: string = Client.name;
|
||||
private iterator = 0;
|
||||
|
||||
processPdu(session: any, pdu: PDU, ...args: any[]): Promise<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
if (!!pdu.destination_addr) {
|
||||
pdu.destination_addr = pdu.destination_addr + this.padLeft(String(this.iterator++), '0', 5);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private padLeft(str: string, pad: string, length: number): string {
|
||||
return (new Array(length + 1).join(pad) + str).slice(-length);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user