gmyth-upnp/src/gmyth_upnp.h
author melunko
Wed May 23 20:05:05 2007 +0100 (2007-05-23)
branchtrunk
changeset 702 4bdc21f0cfd0
parent 699 3710052a05c9
child 706 5cc97240e238
permissions -rw-r--r--
[svn r708] Fixed samples/Makefile.am to anable upnp-search only when requested in configure
melunko@250
     1
/**
melunko@250
     2
 * GMyth Library
melunko@250
     3
 *
melunko@250
     4
 * @file gmyth/gmyth_upnp.h
melunko@250
     5
 * 
melunko@250
     6
 * @brief <p> GMythUPnP allows that a MythTV frontend discovers a 
melunko@250
     7
 * MythTV backend, using the UPnP architecture.
melunko@250
     8
 *
melunko@250
     9
 * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
melunko@250
    10
 * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
melunko@250
    11
 *
melunko@250
    12
 *//*
melunko@250
    13
 * 
melunko@250
    14
 * This program is free software; you can redistribute it and/or modify
melunko@250
    15
 * it under the terms of the GNU Lesser General Public License as published by
melunko@250
    16
 * the Free Software Foundation; either version 2 of the License, or
melunko@250
    17
 * (at your option) any later version.
melunko@250
    18
 *
melunko@250
    19
 * This program is distributed in the hope that it will be useful,
melunko@250
    20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
melunko@250
    21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
melunko@250
    22
 * GNU General Public License for more details.
melunko@250
    23
 *
melunko@250
    24
 * You should have received a copy of the GNU Lesser General Public License
melunko@250
    25
 * along with this program; if not, write to the Free Software
melunko@250
    26
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
melunko@250
    27
 *   
melunko@250
    28
 */
melunko@250
    29
melunko@250
    30
#ifndef _GMYTH_UPNP_H_
melunko@250
    31
#define _GMYTH_UPNP_H_
melunko@250
    32
melunko@250
    33
#include <glib.h>
melunko@250
    34
#include <glib-object.h>
melunko@250
    35
melunko@250
    36
#include <stdlib.h>
melunko@250
    37
#include <stdio.h>
melunko@250
    38
#include <string.h>
melunko@250
    39
melunko@250
    40
#include <cybergarage/upnp/cupnp.h>
rosfran@260
    41
#include <gmyth/gmyth_backendinfo.h>
melunko@250
    42
melunko@250
    43
G_BEGIN_DECLS
melunko@250
    44
melunko@250
    45
#define GMYTH_UPNP_TYPE               (gmyth_upnp_get_type ())
melunko@250
    46
#define GMYTH_UPNP(obj)          		 	(G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_UPNP_TYPE, GMythUPnP))
melunko@250
    47
#define GMYTH_UPNP_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_UPNP_TYPE, GMythUPnPClass))
melunko@250
    48
#define IS_GMYTH_UPNP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_UPNP_TYPE))
melunko@250
    49
#define IS_GMYTH_UPNP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_UPNP_TYPE))
melunko@250
    50
#define GMYTH_UPNP_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_UPNP_TYPE, GMythUPnPClass))
melunko@250
    51
melunko@250
    52
typedef struct _GMythUPnP         GMythUPnP;
melunko@250
    53
typedef struct _GMythUPnPClass    GMythUPnPClass;
rosfran@696
    54
typedef struct _GMythUPnPPrivate  GMythUPnPPrivate;
melunko@250
    55
melunko@250
    56
/****************************************
melunko@250
    57
* Data Type
melunko@250
    58
****************************************/
melunko@250
    59
rosfran@696
    60
typedef enum upnp_device_list_status {
rosfran@696
    61
	GMYTH_UPNP_DEVICE_ADDED = 0,
rosfran@699
    62
	GMYTH_UPNP_DEVICE_UPDATED,
rosfran@699
    63
	GMYTH_UPNP_DEVICE_REMOVED
rosfran@696
    64
} GMythUPnPDeviceStatus;
rosfran@696
    65
rosfran@700
    66
typedef void (*GMythUPnPDeviceListener) ( GMythUPnP *gmyth_upnp, GMythUPnPDeviceStatus status, gchar *dev, gpointer obj );
rosfran@696
    67
melunko@250
    68
struct _GMythUPnPClass
melunko@250
    69
{
rosfran@696
    70
	GObjectClass parent_class;
melunko@250
    71
rosfran@696
    72
	/* callbacks */
rosfran@696
    73
	guint device_found_handler_signal_id;
rosfran@696
    74
rosfran@696
    75
	GMythUPnPDeviceListener device_found_handler;
rosfran@696
    76
rosfran@696
    77
	/* no one for now */
melunko@250
    78
};
melunko@250
    79
rosfran@696
    80
struct _GMythUPnPDevice {
rosfran@696
    81
	gchar *uri;
rosfran@696
    82
	gchar *host;
rosfran@696
    83
	gint port;
rosfran@696
    84
	gchar *protocol;
rosfran@696
    85
};
rosfran@696
    86
rosfran@696
    87
typedef struct _GMythUPnPDevice GMythUPnPDevice;
rosfran@696
    88
melunko@250
    89
struct _GMythUPnP {
melunko@250
    90
	
melunko@250
    91
	GObject parent;
rosfran@696
    92
	GMythUPnPPrivate *priv;
melunko@250
    93
	
rosfran@696
    94
melunko@250
    95
	CgUpnpControlPoint* control_point;
melunko@250
    96
	
melunko@250
    97
	gchar *udn;
melunko@250
    98
	
rosfran@696
    99
	GMythBackendInfo *backend_info;
rosfran@696
   100
melunko@250
   101
	gboolean upnp_dev_found;
melunko@250
   102
};
melunko@250
   103
melunko@250
   104
GType       			gmyth_upnp_get_type (void);
rosfran@696
   105
GMythUPnP *			gmyth_upnp_new ( GMythBackendInfo *gmyth_backend_info, 
rosfran@696
   106
						GMythUPnPDeviceListener handler );
rosfran@699
   107
rosfran@699
   108
GList *				gmyth_upnp_do_search_sync( GMythUPnP* gmyth_upnp );
rosfran@699
   109
rosfran@696
   110
GMythBackendInfo*		gmyth_upnp_get_backend_info ( GMythUPnP *gmyth_upnp );
melunko@250
   111
melunko@250
   112
G_END_DECLS
melunko@250
   113
melunko@250
   114
#endif /* _GMYTH_UPNP_H_ */