// $Id: msg.h,v 1.1 2004/07/06 01:39:09 alpha Exp $
//
// Copyright (c) 1999-2004 Darius Rad
//
// This file is part of the OpenOtto project.
//
// OpenOtto is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//

/// \file
/// \brief Message definitions for three byte header


#ifndef _OTTO_MSG_H
#define _OTTO_MSG_H


/// Functional message table entry
struct otto_funcadr_message_entry
{
  enum otto_funcadr_address id;  ///< Target address, command ID
  unsigned char sec_id;  ///< Secondary ID
  char *name;  ///< Secondary ID name

  /// Message op: one or more of load, report, modify
  enum
  {
    OTTO_FUNCADR_OP_LOAD = 1,
    OTTO_FUNCADR_OP_REPORT = 2,
    OTTO_FUNCADR_OP_MODIFY = 4,
  }
  op;

  /// Functional message Q field usage
  enum
  {
    OTTO_FUNCADR_Q_UNUSED_0,  ///< Unused, default to logic 0
    OTTO_FUNCADR_Q_UNUSED_1,  ///< Unused, default to logic 1
    OTTO_FUNCADR_Q_SET,  ///< Must be logic 1, which means set
    OTTO_FUNCADR_Q_ENABLE,  ///< Enable(d) / disable(d)
    OTTO_FUNCADR_Q_INC,  ///< Increment / decrement
    OTTO_FUNCADR_Q_OPEN,  ///< Open(ed) / close(d)
    OTTO_FUNCADR_Q_LOCK,  ///< Lock(ed) / unlock(ed)
    OTTO_FUNCADR_Q_ON,  ///< On / off
    OTTO_FUNCADR_Q_RESET,  ///< Reset / not reset
    OTTO_FUNCADR_Q_YES,  ///< Yes / no
  }
  q;  ///< Q usage

  unsigned char ext_adr;  ///< Extended address usage (todo: make types for ext addr)
  struct otto_prn prn;  ///< PRN for data
};


#endif
