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