gmyth-upnp/tests/main.c
author renatofilho
Mon Mar 03 13:50:41 2008 +0000 (2008-03-03)
branchtrunk
changeset 938 d2bfa2e06cfa
parent 923 337aef39e86a
permissions -rw-r--r--
[svn r947] fixed bugs
     1 /**
     2  * GMyth Library
     3  *
     4  * @file test/main.c
     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  * @authon Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
    12  *
    13  * This library is free software; you can redistribute it and/or
    14  * modify it under the terms of the GNU Library General Public
    15  * License as published by the Free Software Foundation; either
    16  * version 2 of the License, or (at your option) any later version.
    17  *
    18  * This library is distributed in the hope that it will be useful,
    19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    21  * Library General Public License for more details.
    22  *
    23  * You should have received a copy of the GNU Library General Public
    24  * License along with this library; if not, write to the
    25  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    26  * Boston, MA 02111-1307, USA.
    27  */
    28 
    29 
    30 #include <glib.h>
    31 #include <gmyth/gmyth.h>
    32 #include "gmyth_upnp.h"
    33 
    34 static void
    35 _device_found_cb (GMythUPnP *upnp,
    36                   GMythBackendInfo *info,
    37                   gpointer data)
    38 {
    39     g_debug ("BACKEND FOUND: %s", info->hostname);
    40 }
    41 
    42 static void
    43 _device_lost_cb (GMythUPnP *upnp,
    44                   GMythBackendInfo *info,
    45                   gpointer data)
    46 {
    47     g_debug ("BACKEND LOST: %s", info->hostname);
    48 }
    49 
    50 
    51 
    52 int main (int argc, char** argv)
    53 {
    54     GMythUPnP *o;
    55     GMainLoop *loop;
    56 
    57     g_type_init ();
    58     g_thread_init (NULL);
    59 
    60     o = gmyth_upnp_get_instance ();
    61     g_signal_connect (o,
    62                       "device-found",
    63                        G_CALLBACK (_device_found_cb),
    64                        NULL);
    65     g_signal_connect (o,
    66                       "device-lost",
    67                        G_CALLBACK (_device_lost_cb),
    68                        NULL);
    69 
    70 
    71     gmyth_upnp_search (o);
    72 
    73     loop = g_main_loop_new (NULL, FALSE);
    74     g_main_loop_run (loop);
    75     g_object_unref (o);
    76 
    77     return 0;
    78 }