/* guid-helpers.c generated by valac 0.56.18, the Vala compiler
 * generated from guid-helpers.vala, do not modify */

/*
 * Copyright 2016 Megh Parikh
 *
 * This file is part of LibGamepad.
 *
 * LibGamepad is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * LibGamepad 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib-object.h>
#include <libevdev/libevdev.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define LIB_GAMEPAD_TYPE_LINUX_GUID_HELPERS (lib_gamepad_linux_guid_helpers_get_type ())
#define LIB_GAMEPAD_LINUX_GUID_HELPERS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIB_GAMEPAD_TYPE_LINUX_GUID_HELPERS, LibGamepadLinuxGuidHelpers))
#define LIB_GAMEPAD_LINUX_GUID_HELPERS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LIB_GAMEPAD_TYPE_LINUX_GUID_HELPERS, LibGamepadLinuxGuidHelpersClass))
#define LIB_GAMEPAD_IS_LINUX_GUID_HELPERS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIB_GAMEPAD_TYPE_LINUX_GUID_HELPERS))
#define LIB_GAMEPAD_IS_LINUX_GUID_HELPERS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LIB_GAMEPAD_TYPE_LINUX_GUID_HELPERS))
#define LIB_GAMEPAD_LINUX_GUID_HELPERS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LIB_GAMEPAD_TYPE_LINUX_GUID_HELPERS, LibGamepadLinuxGuidHelpersClass))

typedef struct _LibGamepadLinuxGuidHelpers LibGamepadLinuxGuidHelpers;
typedef struct _LibGamepadLinuxGuidHelpersClass LibGamepadLinuxGuidHelpersClass;
typedef struct _LibGamepadLinuxGuidHelpersPrivate LibGamepadLinuxGuidHelpersPrivate;
enum  {
	LIB_GAMEPAD_LINUX_GUID_HELPERS_0_PROPERTY,
	LIB_GAMEPAD_LINUX_GUID_HELPERS_NUM_PROPERTIES
};
static GParamSpec* lib_gamepad_linux_guid_helpers_properties[LIB_GAMEPAD_LINUX_GUID_HELPERS_NUM_PROPERTIES];

struct _LibGamepadLinuxGuidHelpers {
	GObject parent_instance;
	LibGamepadLinuxGuidHelpersPrivate * priv;
};

struct _LibGamepadLinuxGuidHelpersClass {
	GObjectClass parent_class;
};

static gpointer lib_gamepad_linux_guid_helpers_parent_class = NULL;

VALA_EXTERN GType lib_gamepad_linux_guid_helpers_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (LibGamepadLinuxGuidHelpers, g_object_unref)
VALA_EXTERN gchar* lib_gamepad_linux_guid_helpers_from_dev (struct libevdev* dev);
VALA_EXTERN gchar* lib_gamepad_uint16s_to_hex_string (guint16* data,
                                          gint data_length1);
VALA_EXTERN LibGamepadLinuxGuidHelpers* lib_gamepad_linux_guid_helpers_new (void);
VALA_EXTERN LibGamepadLinuxGuidHelpers* lib_gamepad_linux_guid_helpers_construct (GType object_type);
static GType lib_gamepad_linux_guid_helpers_get_type_once (void);

gchar*
lib_gamepad_linux_guid_helpers_from_dev (struct libevdev* dev)
{
	guint16 guid[8] = {0};
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gchar* _tmp8_;
	gchar* result;
#line 21 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	g_return_val_if_fail (dev != NULL, NULL);
#line 23 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp0_ = libevdev_get_id_bustype (dev);
#line 23 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp1_ = _tmp0_;
#line 23 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	guid[0] = (guint16) GINT_TO_LE (_tmp1_);
#line 24 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	guid[1] = (guint16) 0;
#line 25 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp2_ = libevdev_get_id_vendor (dev);
#line 25 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp3_ = _tmp2_;
#line 25 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	guid[2] = (guint16) GINT_TO_LE (_tmp3_);
#line 26 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	guid[3] = (guint16) 0;
#line 27 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp4_ = libevdev_get_id_product (dev);
#line 27 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp5_ = _tmp4_;
#line 27 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	guid[4] = (guint16) GINT_TO_LE (_tmp5_);
#line 28 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	guid[5] = (guint16) 0;
#line 29 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp6_ = libevdev_get_id_version (dev);
#line 29 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp7_ = _tmp6_;
#line 29 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	guid[6] = (guint16) GINT_TO_LE (_tmp7_);
#line 30 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	guid[7] = (guint16) 0;
#line 31 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	_tmp8_ = lib_gamepad_uint16s_to_hex_string (guid, (gint) 8);
#line 31 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	result = _tmp8_;
#line 31 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	return result;
#line 138 "guid-helpers.c"
}

LibGamepadLinuxGuidHelpers*
lib_gamepad_linux_guid_helpers_construct (GType object_type)
{
	LibGamepadLinuxGuidHelpers * self = NULL;
#line 20 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	self = (LibGamepadLinuxGuidHelpers*) g_object_new (object_type, NULL);
#line 20 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	return self;
#line 149 "guid-helpers.c"
}

LibGamepadLinuxGuidHelpers*
lib_gamepad_linux_guid_helpers_new (void)
{
#line 20 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	return lib_gamepad_linux_guid_helpers_construct (LIB_GAMEPAD_TYPE_LINUX_GUID_HELPERS);
#line 157 "guid-helpers.c"
}

static void
lib_gamepad_linux_guid_helpers_class_init (LibGamepadLinuxGuidHelpersClass * klass,
                                           gpointer klass_data)
{
#line 20 "../Spice-up-1.9.1/src/Services/libgamepad/drivers/linux/guid-helpers.vala"
	lib_gamepad_linux_guid_helpers_parent_class = g_type_class_peek_parent (klass);
#line 166 "guid-helpers.c"
}

static void
lib_gamepad_linux_guid_helpers_instance_init (LibGamepadLinuxGuidHelpers * self,
                                              gpointer klass)
{
}

static GType
lib_gamepad_linux_guid_helpers_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LibGamepadLinuxGuidHelpersClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) lib_gamepad_linux_guid_helpers_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LibGamepadLinuxGuidHelpers), 0, (GInstanceInitFunc) lib_gamepad_linux_guid_helpers_instance_init, NULL };
	GType lib_gamepad_linux_guid_helpers_type_id;
	lib_gamepad_linux_guid_helpers_type_id = g_type_register_static (G_TYPE_OBJECT, "LibGamepadLinuxGuidHelpers", &g_define_type_info, 0);
	return lib_gamepad_linux_guid_helpers_type_id;
}

GType
lib_gamepad_linux_guid_helpers_get_type (void)
{
	static volatile gsize lib_gamepad_linux_guid_helpers_type_id__once = 0;
	if (g_once_init_enter (&lib_gamepad_linux_guid_helpers_type_id__once)) {
		GType lib_gamepad_linux_guid_helpers_type_id;
		lib_gamepad_linux_guid_helpers_type_id = lib_gamepad_linux_guid_helpers_get_type_once ();
		g_once_init_leave (&lib_gamepad_linux_guid_helpers_type_id__once, lib_gamepad_linux_guid_helpers_type_id);
	}
	return lib_gamepad_linux_guid_helpers_type_id__once;
}

