#ifndef __ROCCAT_FIRMWARE_H__
#define __ROCCAT_FIRMWARE_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 "roccat_device.h"

G_BEGIN_DECLS

typedef struct _RoccatFirmwareState RoccatFirmwareState;

enum {
	ROCCAT_FIRMWARE_CHUNK_SIZE = 1024,
};

gboolean roccat_firmware_write_0(RoccatDevice *roccat_device, GError **error);
gboolean roccat_firmware_write_1(RoccatDevice *roccat_device, guint firmware_size, GError **error);
gboolean roccat_firmware_write_2(RoccatDevice *roccat_device, GError **error);
gboolean roccat_firmware_write_3(RoccatDevice *roccat_device, guint16 number, guint8 const *chunk, GError **error);
gboolean roccat_firmware_write_4(RoccatDevice *roccat_device, guint8 const *chunk, GError **error);
gboolean roccat_firmware_write_f(RoccatDevice *roccat_device, GError **error);

gchar *roccat_firmware_version_to_string(guint firmware_version);

guint roccat_firmware_fractions(RoccatFirmwareState const *state);
void roccat_firmware_state_reset(RoccatFirmwareState *state);
RoccatFirmwareState *roccat_firmware_state_new(RoccatDevice *device, guint firmware_size);
gboolean roccat_firmware_state_read_firmware(RoccatFirmwareState *state, gchar const *path, GError **error);
gboolean roccat_firmware_state_tick(RoccatFirmwareState *state, GError **error);
void roccat_firmware_state_free(RoccatFirmwareState *state);

G_END_DECLS

#endif
