/*
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package org.jsmpp.bean;

import org.jsmpp.SMPPConstant;

/**
 * Enum represent bind type of SMPP. There are 3 bind types provided by SMPP:
 *
 * <ul>
 * <li>receiver (BIND_RX) - receive only</li>
 * <li>transmitter (BIND_TX) - transmit only</li>
 * <li>transceiver (BIND_TRX) - receive and transmit</li>
 * </ul>
 * 
 * @author uudashr
 * @version 1.0
 * @since 1.0
 */
public enum BindType {

    /**
     * Bind transmitter.
     */
    BIND_TX(SMPPConstant.CID_BIND_TRANSMITTER),

    /**
     * Bind receiver.
     */
    BIND_RX(SMPPConstant.CID_BIND_RECEIVER),

    /**
     * Bind transceiver.
     */
    BIND_TRX(SMPPConstant.CID_BIND_TRANSCEIVER);

    private int bindCommandId;

    private BindType(int bindCommandId) {
        this.bindCommandId = bindCommandId;
    }

    /**
     * Get the command_id of given bind type.
     * 
     * @return the bind command_id.
     */
    public int commandId() {
        return bindCommandId;
    }

    /**
     * Return the response command_id that should given by this bind type.
     * 
     * @return the bind response command_id.
     */
    public int responseCommandId() {
        return bindCommandId | SMPPConstant.MASK_CID_RESP;
    }

    /**
     * Inform whether the bind type is transmittable.
     * 
     * @return {@code true} if the bind type is transmittable, otherwise {@code false}.
     */
    public boolean isTransmittable() {
        return this == BIND_TX || this == BIND_TRX;
    }

    /**
     * Inform whether the bind type is receivable.
     * 
     * @return {@code true} if the bind type is receivable, otherwise {@code false}.
     */
    public boolean isReceivable() {
        return this == BIND_RX || this == BIND_TRX;
    }

    /**
     * Get the {@code BindType} by specified command_id.
     * 
     * @param bindCommandId is the command_id.
     * @return the enum const associated with the specified
     *         {@code bindCommandId}
     * @throws IllegalArgumentException if there is no {@code BindType}
     *         associated with specified {@code bindCommandId} found.
     */
    public static final BindType valueOf(int bindCommandId)
            throws IllegalArgumentException {
        for (BindType bindType : values()) {
            if (bindType.bindCommandId == bindCommandId) {
                return bindType;
            }
        }
        throw new IllegalArgumentException(
                "No enum const BindType with command id " + bindCommandId);
    }
}

@@ -62,17 +62,16 @@
 cense%22);
- 
 %0A * you 
@@ -177,17 +177,16 @@
 se at%0A *
- 
 %0A *    h
@@ -229,17 +229,16 @@
 E-2.0%0A *
- 
 %0A * Unle
@@ -553,17 +553,16 @@
 ense.%0A *
- 
 %0A */%0Apac
@@ -695,16 +695,20 @@
  by SMPP
+ 3.4
 :%0A *%0A * 
@@ -875,16 +875,74 @@
 * %3C/ul%3E%0A
+ *%0A * For SMPP 3.3, only BIND_TX and BIND_RX are defined.%0A
  * %0A * @
@@ -1291,16 +1291,22 @@
 private 
+final 
 int bind
@@ -1321,24 +1321,16 @@
 d;%0A%0A    
-private 
 BindType
@@ -1632,16 +1632,19 @@
  should 
+be 
 given by
@@ -2728,22 +2728,16 @@
  static 
-final 
 BindType

Add SMPP 3.3 clearification.