#ifndef __ROCCAT_RYOS_CONTROL_H__
#define __ROCCAT_RYOS_CONTROL_H__

/*
 * This file is part of roccat-tools.
 *
 * roccat-tools 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.
 *
 * roccat-tools 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 roccat-tools. If not, see <http://www.gnu.org/licenses/>.
 */

#include "ryos.h"

G_BEGIN_DECLS

typedef struct _RyosControl RyosControl;

struct _RyosControl {
	guint8 command; /* RYOS_COMMAND_CONTROL */
	guint8 value;
	guint8 request;
} __attribute__ ((packed));

/*
 * read: (after other write)
 *   value = RyosControlValue
 *   request = RYOS_CONTROL_REQUEST_CHECK
 * write selection: (before profile specific read)
 *   value = profile index 0-4
 *   request = RyosControlRequest or key index for macros
 */
typedef enum {
	RYOS_CONTROL_REQUEST_CHECK = 0x00,
	RYOS_CONTROL_REQUEST_KEYS_PRIMARY = 0xa0,
	RYOS_CONTROL_REQUEST_KEYS_FUNCTION = 0xa1,
	RYOS_CONTROL_REQUEST_KEYS_MACRO = 0xa2,
	RYOS_CONTROL_REQUEST_KEYS_THUMBSTER = 0xa3,
	// TODO 0xa4
	RYOS_CONTROL_REQUEST_KEYS_EASYZONE = 0xa5,
	RYOS_CONTROL_REQUEST_KEY_MASK = 0xb0,
	RYOS_CONTROL_REQUEST_LIGHT = 0xb1,
	RYOS_CONTROL_REQUEST_KEYS_EXTRA = 0xb2,
	RYOS_CONTROL_REQUEST_STORED_LIGHTS_AUTOMATIC = 0xc0,
	RYOS_CONTROL_REQUEST_STORED_LIGHTS_MANUAL = 0xd0,
	RYOS_CONTROL_REQUEST_LIGHT_MACRO = 0xe0,
	RYOS_CONTROL_REQUEST_12 = 0xf0, // TODO called only for index 0
} RyosControlRequest;

typedef enum {
	RYOS_CONTROL_VALUE_STATUS_OK = 1,
	RYOS_CONTROL_VALUE_STATUS_INVALID = 2,
	RYOS_CONTROL_VALUE_STATUS_BUSY = 3,
	RYOS_CONTROL_VALUE_STATUS_CRITICAL = 4,
} RyosControlValue;

gboolean ryos_select(RoccatDevice *ryos, guint profile_index, guint request, GError **error);

G_END_DECLS

#endif
