# Copyright (c) 2017-2019 The University of Manchester
#
# This program is free software: you can redistribute it and/or modify
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import struct
from enum import Enum
from spinnman.exceptions import SpinnmanInvalidParameterException

_ONE_SHORT = struct.Struct("<H")

""" EIEIO header for command packets
"""
__slots__ = [
"_command"]

def __init__(self, command):
if isinstance(command, Enum):
command = command.value
if command < 0 or command >= 16384:
raise SpinnmanInvalidParameterException(
"command", command,
"parameter command is outside the allowed range (0 to 16383)")
self._command = command

@property
def command(self):
return self._command

[docs]    @staticmethod
def from_bytestring(data, offset):

:param data: The bytestring to read the data from
:type data: bytes or bytearray
:param int offset: The offset where the valid data starts
:raise SpinnmanIOException:
:raise SpinnmanInvalidParameterException:
If there is an error setting any of the values
"""