/* rygel-ruih-server-plugin.c generated by valac 0.56.1, the Vala compiler
 * generated from rygel-ruih-server-plugin.vala, do not modify */

/*
 * Copyright (C) 2013  Cable Television Laboratories, Inc.
 *
 * Author: Neha Shanbhag <N.Shanbhag@cablelabs.com>
 * Contact: http://www.cablelabs.com/
 *
 * This file is part of Rygel.
 *
 * Rygel 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 2.1 of the License, or (at your option) any later version.
 *
 * Rygel 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 this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "rygel-ruih.h"
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "config.h"
#include "rygel-core.h"
#include <libgupnp/gupnp.h>

#define RYGEL_RUIH_SERVER_PLUGIN_RUIH_SERVER_DESC_PATH DATA_DIR "/xml/RuihServer2.xml"
#define RYGEL_RUIH_SERVER_PLUGIN_RUIH "urn:schemas-upnp-org:device:RemoteUIServer"
#define RYGEL_RUIH_SERVICE_UPNP_ID "urn:upnp-org:serviceId:RemoteUIServer"
#define RYGEL_RUIH_SERVICE_UPNP_TYPE "urn:schemas-upnp-org:service:RemoteUIServer:1"
#define RYGEL_RUIH_SERVICE_DESCRIPTION_PATH "xml/RemoteUIServerService.xml"

enum  {
	RYGEL_RUIH_SERVER_PLUGIN_0_PROPERTY,
	RYGEL_RUIH_SERVER_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* rygel_ruih_server_plugin_properties[RYGEL_RUIH_SERVER_PLUGIN_NUM_PROPERTIES];

#define RYGEL_TYPE_RUIH_SERVICE (rygel_ruih_service_get_type ())
#define RYGEL_RUIH_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_RUIH_SERVICE, RygelRuihService))
#define RYGEL_RUIH_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_RUIH_SERVICE, RygelRuihServiceClass))
#define RYGEL_IS_RUIH_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_RUIH_SERVICE))
#define RYGEL_IS_RUIH_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_RUIH_SERVICE))
#define RYGEL_RUIH_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_RUIH_SERVICE, RygelRuihServiceClass))

typedef struct _RygelRuihService RygelRuihService;
typedef struct _RygelRuihServiceClass RygelRuihServiceClass;
#define _rygel_resource_info_unref0(var) ((var == NULL) ? NULL : (var = (rygel_resource_info_unref (var), NULL)))

static gpointer rygel_ruih_server_plugin_parent_class = NULL;

static void rygel_ruih_server_plugin_real_constructed (GObject* base);
VALA_EXTERN GType rygel_ruih_service_get_type (void) G_GNUC_CONST ;
static GType rygel_ruih_server_plugin_get_type_once (void);

/**
     * Create an instance of the plugin.
     *
     * @param name The non-human-readable name for the plugin, used in UPnP
     * messages and in the Rygel configuration file.
     * @param title An optional human-readable name (friendlyName) of the UPnP
     * RUIH server provided by the plugin. If the title is empty then the name
     * will be used.
     * @param description An optional human-readable description
     * (modelDescription) of the UPnP RUIH server provided by the plugin.
     */
RygelRuihServerPlugin*
rygel_ruih_server_plugin_construct (GType object_type,
                                    const gchar* name,
                                    const gchar* title,
                                    const gchar* description,
                                    RygelPluginCapabilities capabilities)
{
	RygelRuihServerPlugin * self = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	self = (RygelRuihServerPlugin*) g_object_new (object_type, "desc-path", RYGEL_RUIH_SERVER_PLUGIN_RUIH_SERVER_DESC_PATH, "name", name, "title", title, "description", description, "capabilities", capabilities, NULL);
	return self;
}

RygelRuihServerPlugin*
rygel_ruih_server_plugin_new (const gchar* name,
                              const gchar* title,
                              const gchar* description,
                              RygelPluginCapabilities capabilities)
{
	return rygel_ruih_server_plugin_construct (RYGEL_TYPE_RUIH_SERVER_PLUGIN, name, title, description, capabilities);
}

static void
rygel_ruih_server_plugin_real_constructed (GObject* base)
{
	RygelRuihServerPlugin * self;
	RygelResourceInfo* resource = NULL;
	RygelResourceInfo* _tmp0_;
	self = (RygelRuihServerPlugin*) base;
	G_OBJECT_CLASS (rygel_ruih_server_plugin_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_TYPE_PLUGIN, RygelPlugin));
	_tmp0_ = rygel_resource_info_new (RYGEL_RUIH_SERVICE_UPNP_ID, RYGEL_RUIH_SERVICE_UPNP_TYPE, RYGEL_RUIH_SERVICE_DESCRIPTION_PATH, RYGEL_TYPE_RUIH_SERVICE);
	resource = _tmp0_;
	rygel_plugin_add_resource ((RygelPlugin*) self, resource);
	_rygel_resource_info_unref0 (resource);
}

static void
rygel_ruih_server_plugin_class_init (RygelRuihServerPluginClass * klass,
                                     gpointer klass_data)
{
	rygel_ruih_server_plugin_parent_class = g_type_class_peek_parent (klass);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) rygel_ruih_server_plugin_real_constructed;
}

static void
rygel_ruih_server_plugin_instance_init (RygelRuihServerPlugin * self,
                                        gpointer klass)
{
}

/**
 * This is the base class for every Rygel UPnP Ruih plugin.
 *
 * This class is useful when implementing Rygel Ruih Server plugins.
 *
 */
static GType
rygel_ruih_server_plugin_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelRuihServerPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_ruih_server_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelRuihServerPlugin), 0, (GInstanceInitFunc) rygel_ruih_server_plugin_instance_init, NULL };
	GType rygel_ruih_server_plugin_type_id;
	rygel_ruih_server_plugin_type_id = g_type_register_static (RYGEL_TYPE_PLUGIN, "RygelRuihServerPlugin", &g_define_type_info, 0);
	return rygel_ruih_server_plugin_type_id;
}

GType
rygel_ruih_server_plugin_get_type (void)
{
	static volatile gsize rygel_ruih_server_plugin_type_id__once = 0;
	if (g_once_init_enter (&rygel_ruih_server_plugin_type_id__once)) {
		GType rygel_ruih_server_plugin_type_id;
		rygel_ruih_server_plugin_type_id = rygel_ruih_server_plugin_get_type_once ();
		g_once_init_leave (&rygel_ruih_server_plugin_type_id__once, rygel_ruih_server_plugin_type_id);
	}
	return rygel_ruih_server_plugin_type_id__once;
}

