All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hivemq.spi.message.SUBACK Maven / Gradle / Ivy

There is a newer version: 3.4.4
Show newest version
/*
 * Copyright 2014 dc-square GmbH
 *
 * 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 com.hivemq.spi.message;

import com.google.common.base.Preconditions;

import java.util.Arrays;
import java.util.List;

/**
 * The MQTT SUBACK message
 *
 * @author Dominik Obermaier
 * @since 1.4
 */
public class SUBACK extends MessageWithID {

    public static final byte QoS_0 = 0x00;
    public static final byte QoS_1 = 0x01;
    public static final byte QoS_2 = 0x02;
    public static final byte FAILURE = (byte) 0x80;


    private List grantedQos;


    public SUBACK(final int messageId, final Byte... entries) {
        this(messageId, Arrays.asList(entries));
    }

    public SUBACK(final int messageId, final List grantedQos) {
        super(messageId);
        Preconditions.checkArgument(messageId > 0 && messageId <= 65535);
        this.grantedQos = grantedQos;
    }

    public List getGrantedQos() {
        return grantedQos;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy