/*
M2Mqtt - MQTT Client Library for .Net
Copyright (c) 2014, Paolo Patierno, All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library.
*/
using System;
using System.Text;
namespace uPLibrary.Networking.M2Mqtt.Messages
{
///
/// Context for MQTT message
///
public class MqttMsgContext
{
///
/// MQTT message
///
public MqttMsgBase Message { get; set; }
///
/// MQTT message state
///
public MqttMsgState State { get; set; }
///
/// Flow of the message
///
public MqttMsgFlow Flow { get; set; }
///
/// Timestamp in ticks (for retry)
///
public int Timestamp { get; set; }
///
/// Attempt (for retry)
///
public int Attempt { get; set; }
}
///
/// Flow of the message
///
public enum MqttMsgFlow
{
///
/// To publish to subscribers
///
ToPublish,
///
/// To acknowledge to publisher
///
ToAcknowledge
}
///
/// MQTT message state
///
public enum MqttMsgState
{
///
/// QOS = 0, Message queued
///
QueuedQos0,
///
/// QOS = 1, Message queued
///
QueuedQos1,
///
/// QOS = 2, Message queued
///
QueuedQos2,
///
/// QOS = 1, PUBLISH sent, wait for PUBACK
///
WaitForPuback,
///
/// QOS = 2, PUBLISH sent, wait for PUBREC
///
WaitForPubrec,
///
/// QOS = 2, PUBREC sent, wait for PUBREL
///
WaitForPubrel,
///
/// QOS = 2, PUBREL sent, wait for PUBCOMP
///
WaitForPubcomp,
///
/// QOS = 2, start first phase handshake send PUBREC
///
SendPubrec,
///
/// QOS = 2, start second phase handshake send PUBREL
///
SendPubrel,
///
/// QOS = 2, end second phase handshake send PUBCOMP
///
SendPubcomp,
///
/// QOS = 1, PUBLISH received, send PUBACK
///
SendPuback,
///
/// (QOS = 1), SUBSCRIBE sent, wait for SUBACK
///
WaitForSuback,
///
/// (QOS = 1), UNSUBSCRIBE sent, wait for UNSUBACK
///
WaitForUnsuback
}
}