diff options
Diffstat (limited to 'connection/SMPPConnection.st')
-rw-r--r-- | connection/SMPPConnection.st | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/connection/SMPPConnection.st b/connection/SMPPConnection.st index ac7ed2b..05564c5 100644 --- a/connection/SMPPConnection.st +++ b/connection/SMPPConnection.st @@ -38,15 +38,11 @@ Osmo.OsmoStreamSocketBase subclass: SMPPConnection [ ] scheduleBindTrx [ - | header body seq data | - - seq := nextSeq. - nextSeq := nextSeq + 1. + | header body | header := SMPPPDUHeader new commandId: SMPPBindTransceiver messageType; commandStatus: 0; - sequenceNumber: seq; yourself. body := SMPPBindTransceiver new systemId: systemId; @@ -58,11 +54,18 @@ Osmo.OsmoStreamSocketBase subclass: SMPPConnection [ addressRange: #[]; yourself. - data := (SMPPMessage new + self send: (SMPPMessage new header: header; - body: body; - toMessage) asByteArray. - writeQueue nextPut: data. + body: body) + ] + + send: aMessage [ + | seq | + seq := nextSeq. + nextSeq := nextSeq + 1. + + aMessage header sequenceNumber: seq. + writeQueue nextPut: aMessage toMessage asByteArray ] connect [ @@ -84,11 +87,26 @@ Osmo.OsmoStreamSocketBase subclass: SMPPConnection [ [ msg := SMPPMessage readFrom: socket. - msg inspect. + msg body connectionDispatchOn: self with: msg ] on: Error do: [:e | e inspect; pass ] ] + + respondToEnquire: aMessage [ + | msg | + msg := SMPPMessage new + header: (SMPPPDUHeader new + commandId: SMPPBodyBase enquireLinkResp; + commandStatus: 0; + sequenceNumber: aMessage header sequenceNumber; + yourself); + body: #[]. + self send: msg + ] + + receviedResponse: aMessage [ + ] ] |