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

namespace OS\PB;

use UnexpectedValueException;

/**
 * Protobuf type <code>OS.PB.RS485BaudRateType</code>
 */
class RS485BaudRateType
{
    /**
     * Generated from protobuf enum <code>BaudRate_NotSet = 0;</code>
     */
    const BaudRate_NotSet = 0;
    /**
     * Generated from protobuf enum <code>BaudRate_1200 = 1200;</code>
     */
    const BaudRate_1200 = 1200;
    /**
     * Generated from protobuf enum <code>BaudRate_2400 = 2400;</code>
     */
    const BaudRate_2400 = 2400;
    /**
     * Generated from protobuf enum <code>BaudRate_4800 = 4800;</code>
     */
    const BaudRate_4800 = 4800;
    /**
     * ANPR Protocol
     *
     * Generated from protobuf enum <code>BaudRate_9600 = 9600;</code>
     */
    const BaudRate_9600 = 9600;
    /**
     * Generated from protobuf enum <code>BaudRate_14400 = 14400;</code>
     */
    const BaudRate_14400 = 14400;
    /**
     * BeSecure Protocol
     *
     * Generated from protobuf enum <code>BaudRate_19200 = 19200;</code>
     */
    const BaudRate_19200 = 19200;
    /**
     * Generated from protobuf enum <code>BaudRate_28800 = 28800;</code>
     */
    const BaudRate_28800 = 28800;
    /**
     * Generated from protobuf enum <code>BaudRate_31250 = 31250;</code>
     */
    const BaudRate_31250 = 31250;
    /**
     * Open supervised device protocol
     *
     * Generated from protobuf enum <code>BaudRate_38400 = 38400;</code>
     */
    const BaudRate_38400 = 38400;
    /**
     * Generated from protobuf enum <code>BaudRate_56000 = 56000;</code>
     */
    const BaudRate_56000 = 56000;
    /**
     * Generated from protobuf enum <code>BaudRate_57600 = 57600;</code>
     */
    const BaudRate_57600 = 57600;
    /**
     * Generated from protobuf enum <code>BaudRate_76800 = 76800;</code>
     */
    const BaudRate_76800 = 76800;
    /**
     * Standard for OneSpace Protobuf Protocol
     *
     * Generated from protobuf enum <code>BaudRate_115200 = 115200;</code>
     */
    const BaudRate_115200 = 115200;
    /**
     * Can't go any higher due to ISO3082 limit of 200Kbps
     *
     * Generated from protobuf enum <code>BaudRate_250000 = 250000;</code>
     */
    const BaudRate_250000 = 250000;
    /**
     * Generated from protobuf enum <code>BaudRate_1000000 = 1000000;</code>
     */
    const BaudRate_1000000 = 1000000;

    private static $valueToName = [
        self::BaudRate_NotSet => 'BaudRate_NotSet',
        self::BaudRate_1200 => 'BaudRate_1200',
        self::BaudRate_2400 => 'BaudRate_2400',
        self::BaudRate_4800 => 'BaudRate_4800',
        self::BaudRate_9600 => 'BaudRate_9600',
        self::BaudRate_14400 => 'BaudRate_14400',
        self::BaudRate_19200 => 'BaudRate_19200',
        self::BaudRate_28800 => 'BaudRate_28800',
        self::BaudRate_31250 => 'BaudRate_31250',
        self::BaudRate_38400 => 'BaudRate_38400',
        self::BaudRate_56000 => 'BaudRate_56000',
        self::BaudRate_57600 => 'BaudRate_57600',
        self::BaudRate_76800 => 'BaudRate_76800',
        self::BaudRate_115200 => 'BaudRate_115200',
        self::BaudRate_250000 => 'BaudRate_250000',
        self::BaudRate_1000000 => 'BaudRate_1000000',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

