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

namespace OS\PB;

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

/**
 * \@brief   Configure the RS485 interface
 * \@details Discovery on RS485 works by sending a broadcast out and seeing who responds to it, while 
 *
 * Generated from protobuf message <code>OS.PB.RS485Config</code>
 */
class RS485Config extends \Google\Protobuf\Internal\Message
{
    /**
     * Set the baudrate, other parameters such as stop bits, parity etc is decided by protocol selected
     *
     * Generated from protobuf field <code>.OS.PB.RS485BaudRateType BaudRate = 1;</code>
     */
    protected $BaudRate = 0;
    /**
     * Default: Enabled for InterfaceIndex0, Disabled for InterfaceIndex1 (Multi Reader Gateway).
     *
     * Generated from protobuf field <code>.OS.PB.Toggle State = 2;</code>
     */
    protected $State = 0;
    protected $Protocol;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $BaudRate
     *           Set the baudrate, other parameters such as stop bits, parity etc is decided by protocol selected
     *     @type int $State
     *           Default: Enabled for InterfaceIndex0, Disabled for InterfaceIndex1 (Multi Reader Gateway).
     *     @type \OS\PB\RS485LoopbackConfig $Loopback
     *           Only for testing purposes
     *     @type \OS\PB\DeviceNetworkConfig $OneSpace_Protobuf
     *           Default: OneSpace Protobuf Protocol on InterfaceIndex 0
     *     @type \OS\PB\OSDPConfig $SIA_OSDP
     *           Open Supervised Device Protocol by SIA
     *     @type \OS\PB\ANPRConfig $ANPR_Camera
     *           HIK or Tattile ANPR Camera
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Rs485::initOnce();
        parent::__construct($data);
    }

    /**
     * Set the baudrate, other parameters such as stop bits, parity etc is decided by protocol selected
     *
     * Generated from protobuf field <code>.OS.PB.RS485BaudRateType BaudRate = 1;</code>
     * @return int
     */
    public function getBaudRate()
    {
        return $this->BaudRate;
    }

    /**
     * Set the baudrate, other parameters such as stop bits, parity etc is decided by protocol selected
     *
     * Generated from protobuf field <code>.OS.PB.RS485BaudRateType BaudRate = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setBaudRate($var)
    {
        GPBUtil::checkEnum($var, \OS\PB\RS485BaudRateType::class);
        $this->BaudRate = $var;

        return $this;
    }

    /**
     * Default: Enabled for InterfaceIndex0, Disabled for InterfaceIndex1 (Multi Reader Gateway).
     *
     * Generated from protobuf field <code>.OS.PB.Toggle State = 2;</code>
     * @return int
     */
    public function getState()
    {
        return $this->State;
    }

    /**
     * Default: Enabled for InterfaceIndex0, Disabled for InterfaceIndex1 (Multi Reader Gateway).
     *
     * Generated from protobuf field <code>.OS.PB.Toggle State = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \OS\PB\Toggle::class);
        $this->State = $var;

        return $this;
    }

    /**
     * Only for testing purposes
     *
     * Generated from protobuf field <code>.OS.PB.RS485LoopbackConfig Loopback = 5;</code>
     * @return \OS\PB\RS485LoopbackConfig|null
     */
    public function getLoopback()
    {
        return $this->readOneof(5);
    }

    public function hasLoopback()
    {
        return $this->hasOneof(5);
    }

    /**
     * Only for testing purposes
     *
     * Generated from protobuf field <code>.OS.PB.RS485LoopbackConfig Loopback = 5;</code>
     * @param \OS\PB\RS485LoopbackConfig $var
     * @return $this
     */
    public function setLoopback($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\RS485LoopbackConfig::class);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Default: OneSpace Protobuf Protocol on InterfaceIndex 0
     *
     * Generated from protobuf field <code>.OS.PB.DeviceNetworkConfig OneSpace_Protobuf = 6;</code>
     * @return \OS\PB\DeviceNetworkConfig|null
     */
    public function getOneSpaceProtobuf()
    {
        return $this->readOneof(6);
    }

    public function hasOneSpaceProtobuf()
    {
        return $this->hasOneof(6);
    }

    /**
     * Default: OneSpace Protobuf Protocol on InterfaceIndex 0
     *
     * Generated from protobuf field <code>.OS.PB.DeviceNetworkConfig OneSpace_Protobuf = 6;</code>
     * @param \OS\PB\DeviceNetworkConfig $var
     * @return $this
     */
    public function setOneSpaceProtobuf($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\DeviceNetworkConfig::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Open Supervised Device Protocol by SIA
     *
     * Generated from protobuf field <code>.OS.PB.OSDPConfig SIA_OSDP = 8;</code>
     * @return \OS\PB\OSDPConfig|null
     */
    public function getSIAOSDP()
    {
        return $this->readOneof(8);
    }

    public function hasSIAOSDP()
    {
        return $this->hasOneof(8);
    }

    /**
     * Open Supervised Device Protocol by SIA
     *
     * Generated from protobuf field <code>.OS.PB.OSDPConfig SIA_OSDP = 8;</code>
     * @param \OS\PB\OSDPConfig $var
     * @return $this
     */
    public function setSIAOSDP($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\OSDPConfig::class);
        $this->writeOneof(8, $var);

        return $this;
    }

    /**
     * HIK or Tattile ANPR Camera
     *
     * Generated from protobuf field <code>.OS.PB.ANPRConfig ANPR_Camera = 9;</code>
     * @return \OS\PB\ANPRConfig|null
     */
    public function getANPRCamera()
    {
        return $this->readOneof(9);
    }

    public function hasANPRCamera()
    {
        return $this->hasOneof(9);
    }

    /**
     * HIK or Tattile ANPR Camera
     *
     * Generated from protobuf field <code>.OS.PB.ANPRConfig ANPR_Camera = 9;</code>
     * @param \OS\PB\ANPRConfig $var
     * @return $this
     */
    public function setANPRCamera($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\ANPRConfig::class);
        $this->writeOneof(9, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getProtocol()
    {
        return $this->whichOneof("Protocol");
    }

}

