xref: /aosp_15_r20/external/aws-crt-java/src/main/java/software/amazon/awssdk/crt/mqtt5/PublishReturn.java (revision 3c7ae9de214676c52d19f01067dc1a404272dc11)
1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 package software.amazon.awssdk.crt.mqtt5;
6 
7 import software.amazon.awssdk.crt.mqtt5.packets.PublishPacket;
8 
9 /**
10  * The data returned when a publish is made to a topic the MQTT5 client is subscribed to.
11  * The data contained within can be gotten using the <code>get</code> functions.
12  * For example, <code>getPublishPacket</code> will return the PublishPacket received from the server.
13  */
14 public class PublishReturn {
15     private PublishPacket publishPacket;
16 
17     /**
18      * Returns the PublishPacket returned from the server or Null if none was returned.
19      * @return The PublishPacket returned from the server.
20      */
getPublishPacket()21     public PublishPacket getPublishPacket() {
22         return publishPacket;
23     }
24 
25     /**
26      * This is only called in JNI to make a new PublishReturn with a PUBLISH packet.
27      * @param newPublishPacket The PubAckPacket data for QoS 1 packets. Can be null if result is non QoS 1.
28      * @return A newly created PublishResult
29      */
PublishReturn(PublishPacket newPublishPacket)30     private PublishReturn(PublishPacket newPublishPacket) {
31         this.publishPacket = newPublishPacket;
32     }
33 }
34