<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: packet.proto

namespace OS\PB;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * Generated from protobuf message <code>OS.PB.Packet</code>
 */
class Packet extends \Google\Protobuf\Internal\Message
{
    /**
     * Used if the there is no transport layer for ACKing or NACKing. QoS1 is used for all packets, so ACK is expected in order for packets to be removed from queues.
     *
     * Generated from protobuf field <code>.OS.PB.Packet.PacketTypes PacketType = 1;</code>
     */
    protected $PacketType = 0;
    /**
     * Who the receiver of this packet is for using OneSpace hardware serial number. 0 is notset or not used. Used where L2 MAC layer not available.
     *
     * Generated from protobuf field <code>uint32 DestinationSerial = 2;</code>
     */
    protected $DestinationSerial = 0;
    /**
     * Who is sending this packet using their OneSpace hardware serial number of the device. 0 is notset, cannot be 0xFFFFFFFF. 
     *
     * Generated from protobuf field <code>uint32 SourceSerial = 3;</code>
     */
    protected $SourceSerial = 0;
    /**
     * Who this packet is intended for, refer to Packet Routing section above. Logical Device Id generated by OneDevice.
     *
     * Generated from protobuf field <code>uint64 DestinationDeviceId = 6;</code>
     */
    protected $DestinationDeviceId = 0;
    /**
     * Who is sending this packet using their OneSpace Logically assigned address. 0 means no id has been set yet for the device. Logical Device Id generated by 1Device.
     *
     * Generated from protobuf field <code>uint64 SourceDeviceId = 7;</code>
     */
    protected $SourceDeviceId = 0;
    /**
     * Packet Appended Information for server
     *
     * Generated from protobuf field <code>.OS.PB.DeviceInterface SourceInterface = 8;</code>
     */
    protected $SourceInterface = 0;
    /**
     * The index of the receiving interface, 0 being the first interface of the SourceInterface type, 1 is second and so on
     *
     * Generated from protobuf field <code>uint32 SourceInterfaceIndex = 9;</code>
     */
    protected $SourceInterfaceIndex = 0;
    /**
     * For wireless interfaces, what was the RSSI on the receiver for this packet. This is appended to the packet on receipt. GSM interface appends this before sending.
     *
     * Generated from protobuf field <code>sint32 SourceRSSI = 10;</code>
     */
    protected $SourceRSSI = 0;
    /**
     * Additional Transport Layer Information - Used if transport layer does not supply the following information
     *
     * Generated from protobuf field <code>uint32 SequenceNumber = 11;</code>
     */
    protected $SequenceNumber = 0;
    /**
     * 0 for first time delivery, anything else is how many times this packet has been resent with the same sequence number. This occurs if no response was received for QoS1, or packet was corrupted and timesout.
     *
     * Generated from protobuf field <code>uint32 RedeliveryCounter = 12;</code>
     */
    protected $RedeliveryCounter = 0;
    /**
     * In milliseconds, UTC/GMT (TZ+0) since Unix Epoch, of when this packet was sent. Generated on packet send. If 0, the current time is unknown.
     *
     * Generated from protobuf field <code>int64 TimeStampMs = 13;</code>
     */
    protected $TimeStampMs = 0;
    /**
     * Normally 0 for direct comms, if the routed count exceeds 16 (configurable), then for safety, it is discarded by the receiving device. 
     *
     * Generated from protobuf field <code>uint32 RoutedCount = 14;</code>
     */
    protected $RoutedCount = 0;
    /**
     * DeviceRoutedCountExceeded event is generated when this occurs.
     * Messages
     *
     * Generated from protobuf field <code>repeated .OS.PB.Message Messages = 15 [packed = false];</code>
     */
    private $Messages;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $PacketType
     *           Used if the there is no transport layer for ACKing or NACKing. QoS1 is used for all packets, so ACK is expected in order for packets to be removed from queues.
     *     @type int $DestinationSerial
     *           Who the receiver of this packet is for using OneSpace hardware serial number. 0 is notset or not used. Used where L2 MAC layer not available.
     *     @type int $SourceSerial
     *           Who is sending this packet using their OneSpace hardware serial number of the device. 0 is notset, cannot be 0xFFFFFFFF. 
     *     @type int|string $DestinationDeviceId
     *           Who this packet is intended for, refer to Packet Routing section above. Logical Device Id generated by OneDevice.
     *     @type int|string $SourceDeviceId
     *           Who is sending this packet using their OneSpace Logically assigned address. 0 means no id has been set yet for the device. Logical Device Id generated by 1Device.
     *     @type int $SourceInterface
     *           Packet Appended Information for server
     *     @type int $SourceInterfaceIndex
     *           The index of the receiving interface, 0 being the first interface of the SourceInterface type, 1 is second and so on
     *     @type int $SourceRSSI
     *           For wireless interfaces, what was the RSSI on the receiver for this packet. This is appended to the packet on receipt. GSM interface appends this before sending.
     *     @type int $SequenceNumber
     *           Additional Transport Layer Information - Used if transport layer does not supply the following information
     *     @type int $RedeliveryCounter
     *           0 for first time delivery, anything else is how many times this packet has been resent with the same sequence number. This occurs if no response was received for QoS1, or packet was corrupted and timesout.
     *     @type int|string $TimeStampMs
     *           In milliseconds, UTC/GMT (TZ+0) since Unix Epoch, of when this packet was sent. Generated on packet send. If 0, the current time is unknown.
     *     @type int $RoutedCount
     *           Normally 0 for direct comms, if the routed count exceeds 16 (configurable), then for safety, it is discarded by the receiving device. 
     *     @type \OS\PB\Message[] $Messages
     *           DeviceRoutedCountExceeded event is generated when this occurs.
     *           Messages
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Packet::initOnce();
        parent::__construct($data);
    }

    /**
     * Used if the there is no transport layer for ACKing or NACKing. QoS1 is used for all packets, so ACK is expected in order for packets to be removed from queues.
     *
     * Generated from protobuf field <code>.OS.PB.Packet.PacketTypes PacketType = 1;</code>
     * @return int
     */
    public function getPacketType()
    {
        return $this->PacketType;
    }

    /**
     * Used if the there is no transport layer for ACKing or NACKing. QoS1 is used for all packets, so ACK is expected in order for packets to be removed from queues.
     *
     * Generated from protobuf field <code>.OS.PB.Packet.PacketTypes PacketType = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setPacketType($var)
    {
        GPBUtil::checkEnum($var, \OS\PB\Packet\PacketTypes::class);
        $this->PacketType = $var;

        return $this;
    }

    /**
     * Who the receiver of this packet is for using OneSpace hardware serial number. 0 is notset or not used. Used where L2 MAC layer not available.
     *
     * Generated from protobuf field <code>uint32 DestinationSerial = 2;</code>
     * @return int
     */
    public function getDestinationSerial()
    {
        return $this->DestinationSerial;
    }

    /**
     * Who the receiver of this packet is for using OneSpace hardware serial number. 0 is notset or not used. Used where L2 MAC layer not available.
     *
     * Generated from protobuf field <code>uint32 DestinationSerial = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setDestinationSerial($var)
    {
        GPBUtil::checkUint32($var);
        $this->DestinationSerial = $var;

        return $this;
    }

    /**
     * Who is sending this packet using their OneSpace hardware serial number of the device. 0 is notset, cannot be 0xFFFFFFFF. 
     *
     * Generated from protobuf field <code>uint32 SourceSerial = 3;</code>
     * @return int
     */
    public function getSourceSerial()
    {
        return $this->SourceSerial;
    }

    /**
     * Who is sending this packet using their OneSpace hardware serial number of the device. 0 is notset, cannot be 0xFFFFFFFF. 
     *
     * Generated from protobuf field <code>uint32 SourceSerial = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setSourceSerial($var)
    {
        GPBUtil::checkUint32($var);
        $this->SourceSerial = $var;

        return $this;
    }

    /**
     * Who this packet is intended for, refer to Packet Routing section above. Logical Device Id generated by OneDevice.
     *
     * Generated from protobuf field <code>uint64 DestinationDeviceId = 6;</code>
     * @return int|string
     */
    public function getDestinationDeviceId()
    {
        return $this->DestinationDeviceId;
    }

    /**
     * Who this packet is intended for, refer to Packet Routing section above. Logical Device Id generated by OneDevice.
     *
     * Generated from protobuf field <code>uint64 DestinationDeviceId = 6;</code>
     * @param int|string $var
     * @return $this
     */
    public function setDestinationDeviceId($var)
    {
        GPBUtil::checkUint64($var);
        $this->DestinationDeviceId = $var;

        return $this;
    }

    /**
     * Who is sending this packet using their OneSpace Logically assigned address. 0 means no id has been set yet for the device. Logical Device Id generated by 1Device.
     *
     * Generated from protobuf field <code>uint64 SourceDeviceId = 7;</code>
     * @return int|string
     */
    public function getSourceDeviceId()
    {
        return $this->SourceDeviceId;
    }

    /**
     * Who is sending this packet using their OneSpace Logically assigned address. 0 means no id has been set yet for the device. Logical Device Id generated by 1Device.
     *
     * Generated from protobuf field <code>uint64 SourceDeviceId = 7;</code>
     * @param int|string $var
     * @return $this
     */
    public function setSourceDeviceId($var)
    {
        GPBUtil::checkUint64($var);
        $this->SourceDeviceId = $var;

        return $this;
    }

    /**
     * Packet Appended Information for server
     *
     * Generated from protobuf field <code>.OS.PB.DeviceInterface SourceInterface = 8;</code>
     * @return int
     */
    public function getSourceInterface()
    {
        return $this->SourceInterface;
    }

    /**
     * Packet Appended Information for server
     *
     * Generated from protobuf field <code>.OS.PB.DeviceInterface SourceInterface = 8;</code>
     * @param int $var
     * @return $this
     */
    public function setSourceInterface($var)
    {
        GPBUtil::checkEnum($var, \OS\PB\DeviceInterface::class);
        $this->SourceInterface = $var;

        return $this;
    }

    /**
     * The index of the receiving interface, 0 being the first interface of the SourceInterface type, 1 is second and so on
     *
     * Generated from protobuf field <code>uint32 SourceInterfaceIndex = 9;</code>
     * @return int
     */
    public function getSourceInterfaceIndex()
    {
        return $this->SourceInterfaceIndex;
    }

    /**
     * The index of the receiving interface, 0 being the first interface of the SourceInterface type, 1 is second and so on
     *
     * Generated from protobuf field <code>uint32 SourceInterfaceIndex = 9;</code>
     * @param int $var
     * @return $this
     */
    public function setSourceInterfaceIndex($var)
    {
        GPBUtil::checkUint32($var);
        $this->SourceInterfaceIndex = $var;

        return $this;
    }

    /**
     * For wireless interfaces, what was the RSSI on the receiver for this packet. This is appended to the packet on receipt. GSM interface appends this before sending.
     *
     * Generated from protobuf field <code>sint32 SourceRSSI = 10;</code>
     * @return int
     */
    public function getSourceRSSI()
    {
        return $this->SourceRSSI;
    }

    /**
     * For wireless interfaces, what was the RSSI on the receiver for this packet. This is appended to the packet on receipt. GSM interface appends this before sending.
     *
     * Generated from protobuf field <code>sint32 SourceRSSI = 10;</code>
     * @param int $var
     * @return $this
     */
    public function setSourceRSSI($var)
    {
        GPBUtil::checkInt32($var);
        $this->SourceRSSI = $var;

        return $this;
    }

    /**
     * Additional Transport Layer Information - Used if transport layer does not supply the following information
     *
     * Generated from protobuf field <code>uint32 SequenceNumber = 11;</code>
     * @return int
     */
    public function getSequenceNumber()
    {
        return $this->SequenceNumber;
    }

    /**
     * Additional Transport Layer Information - Used if transport layer does not supply the following information
     *
     * Generated from protobuf field <code>uint32 SequenceNumber = 11;</code>
     * @param int $var
     * @return $this
     */
    public function setSequenceNumber($var)
    {
        GPBUtil::checkUint32($var);
        $this->SequenceNumber = $var;

        return $this;
    }

    /**
     * 0 for first time delivery, anything else is how many times this packet has been resent with the same sequence number. This occurs if no response was received for QoS1, or packet was corrupted and timesout.
     *
     * Generated from protobuf field <code>uint32 RedeliveryCounter = 12;</code>
     * @return int
     */
    public function getRedeliveryCounter()
    {
        return $this->RedeliveryCounter;
    }

    /**
     * 0 for first time delivery, anything else is how many times this packet has been resent with the same sequence number. This occurs if no response was received for QoS1, or packet was corrupted and timesout.
     *
     * Generated from protobuf field <code>uint32 RedeliveryCounter = 12;</code>
     * @param int $var
     * @return $this
     */
    public function setRedeliveryCounter($var)
    {
        GPBUtil::checkUint32($var);
        $this->RedeliveryCounter = $var;

        return $this;
    }

    /**
     * In milliseconds, UTC/GMT (TZ+0) since Unix Epoch, of when this packet was sent. Generated on packet send. If 0, the current time is unknown.
     *
     * Generated from protobuf field <code>int64 TimeStampMs = 13;</code>
     * @return int|string
     */
    public function getTimeStampMs()
    {
        return $this->TimeStampMs;
    }

    /**
     * In milliseconds, UTC/GMT (TZ+0) since Unix Epoch, of when this packet was sent. Generated on packet send. If 0, the current time is unknown.
     *
     * Generated from protobuf field <code>int64 TimeStampMs = 13;</code>
     * @param int|string $var
     * @return $this
     */
    public function setTimeStampMs($var)
    {
        GPBUtil::checkInt64($var);
        $this->TimeStampMs = $var;

        return $this;
    }

    /**
     * Normally 0 for direct comms, if the routed count exceeds 16 (configurable), then for safety, it is discarded by the receiving device. 
     *
     * Generated from protobuf field <code>uint32 RoutedCount = 14;</code>
     * @return int
     */
    public function getRoutedCount()
    {
        return $this->RoutedCount;
    }

    /**
     * Normally 0 for direct comms, if the routed count exceeds 16 (configurable), then for safety, it is discarded by the receiving device. 
     *
     * Generated from protobuf field <code>uint32 RoutedCount = 14;</code>
     * @param int $var
     * @return $this
     */
    public function setRoutedCount($var)
    {
        GPBUtil::checkUint32($var);
        $this->RoutedCount = $var;

        return $this;
    }

    /**
     * DeviceRoutedCountExceeded event is generated when this occurs.
     * Messages
     *
     * Generated from protobuf field <code>repeated .OS.PB.Message Messages = 15 [packed = false];</code>
     * @return RepeatedField<\OS\PB\Message>
     */
    public function getMessages()
    {
        return $this->Messages;
    }

    /**
     * DeviceRoutedCountExceeded event is generated when this occurs.
     * Messages
     *
     * Generated from protobuf field <code>repeated .OS.PB.Message Messages = 15 [packed = false];</code>
     * @param \OS\PB\Message[] $var
     * @return $this
     */
    public function setMessages($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \OS\PB\Message::class);
        $this->Messages = $arr;

        return $this;
    }

}

