gmyth-upnp/src/gmyth_upnp.h
author renatofilho
Thu Jun 14 20:40:47 2007 +0100 (2007-06-14)
branchtrunk
changeset 754 cb885ee44618
parent 706 5cc97240e238
child 909 847da7267234
permissions -rw-r--r--
[svn r760] changed code style to Kernel Normal Form style with tabsize=4
     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  * This program is free software; you can redistribute it and/or modify
    13  * it under the terms of the GNU Lesser General Public License as published by
    14  * the Free Software Foundation; either version 2 of the License, or
    15  * (at your option) any later version.
    16  *
    17  * This program is distributed in the hope that it will be useful,
    18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    20  * GNU General Public License for more details.
    21  *
    22  * You should have received a copy of the GNU Lesser General Public License
    23  * along with this program; if not, write to the Free Software
    24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    25  *   
    26  */
    27 
    28 #ifndef _GMYTH_UPNP_H_
    29 #define _GMYTH_UPNP_H_
    30 
    31 #include <glib.h>
    32 #include <glib-object.h>
    33 
    34 #include <stdlib.h>
    35 #include <stdio.h>
    36 #include <string.h>
    37 
    38 #include <cybergarage/upnp/cupnp.h>
    39 #include <gmyth/gmyth_backendinfo.h>
    40 
    41 G_BEGIN_DECLS
    42 #define GMYTH_UPNP_TYPE               (gmyth_upnp_get_type ())
    43 #define GMYTH_UPNP(obj)          		 	(G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_UPNP_TYPE, GMythUPnP))
    44 #define GMYTH_UPNP_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_UPNP_TYPE, GMythUPnPClass))
    45 #define IS_GMYTH_UPNP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_UPNP_TYPE))
    46 #define IS_GMYTH_UPNP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_UPNP_TYPE))
    47 #define GMYTH_UPNP_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_UPNP_TYPE, GMythUPnPClass))
    48 typedef struct _GMythUPnP GMythUPnP;
    49 typedef struct _GMythUPnPClass GMythUPnPClass;
    50 typedef struct _GMythUPnPPrivate GMythUPnPPrivate;
    51 
    52 /****************************************
    53 * Data Type
    54 ****************************************/
    55 
    56 typedef enum upnp_device_list_status {
    57     GMYTH_UPNP_DEVICE_ADDED = 0,
    58     GMYTH_UPNP_DEVICE_UPDATED,
    59     GMYTH_UPNP_DEVICE_REMOVED
    60 } GMythUPnPDeviceStatus;
    61 
    62 typedef void    (*GMythUPnPDeviceListener) (GMythUPnP * gmyth_upnp,
    63                                             GMythUPnPDeviceStatus status,
    64                                             gchar * dev);
    65 
    66 struct _GMythUPnPClass {
    67     GObjectClass    parent_class;
    68 
    69     /*
    70      * callbacks 
    71      */
    72     guint           device_found_handler_signal_id;
    73 
    74     GMythUPnPDeviceListener device_found_handler;
    75 
    76     /*
    77      * no one for now 
    78      */
    79 };
    80 
    81 struct _GMythUPnPDevice {
    82     gchar          *uri;
    83     gchar          *host;
    84     gint            port;
    85     gchar          *protocol;
    86 };
    87 
    88 typedef struct _GMythUPnPDevice GMythUPnPDevice;
    89 
    90 struct _GMythUPnP {
    91 
    92     GObject         parent;
    93     GMythUPnPPrivate *priv;
    94 
    95 
    96     CgUpnpControlPoint *control_point;
    97 
    98     gchar          *udn;
    99 
   100     GMythBackendInfo *backend_info;
   101 
   102     gboolean        upnp_dev_found;
   103 };
   104 
   105 GType           gmyth_upnp_get_type(void);
   106 GMythUPnP      *gmyth_upnp_new(GMythBackendInfo * gmyth_backend_info,
   107                                GMythUPnPDeviceListener handler);
   108 
   109 GList          *gmyth_upnp_do_search_sync(GMythUPnP * gmyth_upnp);
   110 
   111 GMythBackendInfo *gmyth_upnp_get_backend_info(GMythUPnP * gmyth_upnp);
   112 
   113 gchar          *gmyth_upnp_device_status_to_string(GMythUPnPDeviceStatus
   114                                                    status);
   115 
   116 G_END_DECLS
   117 #endif                          /* _GMYTH_UPNP_H_ */