int numberPlan,
String addrRange)
throws java.io.IOException, InvalidParameterValueException,
IllegalArgumentException, AlreadyBoundException, VersionException,
SMPPProtocolException {
Bind bindReq = null;
// Must be reset before newInstance is called.
if (this.seqNumScheme != null) {
this.seqNumScheme.reset();
}
if (!asyncComms) {
// Ensure neither of the automatic reply settings are enabled.
ackQryLinks = false;
ackDeliverSm = false;
}
try {
switch (type) {
case TRANSMITTER:
bindReq = (Bind) newInstance(SMPPPacket.BIND_TRANSMITTER);
break;
case RECEIVER:
bindReq = (Bind) newInstance(SMPPPacket.BIND_RECEIVER);
break;
case TRANSCEIVER:
if (this.interfaceVersion.isOlder(SMPPVersion.V34)) {
throw new VersionException(
"Cannot bind as transceiver in "
+ interfaceVersion.toString());
}
bindReq = (Bind) newInstance(SMPPPacket.BIND_TRANSCEIVER);
break;
default:
throw new IllegalArgumentException("No such connection type.");
}
} catch (BadCommandIDException x) {
LOGGER.error("Internal error in the smppapi. Please inform the maintainer.", x);
}
connectionType = type;
LOGGER.info("Binding to the SMSC as type " + type);
bindReq.setVersion(interfaceVersion);
bindReq.setSystemId(systemID);
bindReq.setPassword(password);
bindReq.setSystemType(systemType);
bindReq.setAddressTon(typeOfNum);
bindReq.setAddressNpi(numberPlan);
bindReq.setAddressRange(addrRange);
return (BindResp) sendRequestInternal(bindReq);
}