gmyth-upnp/test/main.c
author renatofilho
Thu Feb 14 16:13:51 2008 +0000 (2008-02-14)
branchtrunk
changeset 914 ef147f779302
child 922 04cd5e61dca3
permissions -rw-r--r--
[svn r923] updated daemon script
     1 #include <glib.h>
     2 
     3 #include "gmyth_upnp.h"
     4 
     5 static void
     6 _device_found_cb (GMythUPnP *upnp,
     7                   GMythBackendInfo *info,
     8                   gpointer data)
     9 {
    10     g_debug ("BACKEND FOUND: %s", info->hostname);
    11 }
    12 
    13 static void
    14 _device_lost_cb (GMythUPnP *upnp,
    15                   GMythBackendInfo *info,
    16                   gpointer data)
    17 {
    18     g_debug ("BACKEND LOST: %s", info->hostname);
    19 }
    20 
    21 
    22 
    23 int main (int argc, char** argv)
    24 {
    25     GMythUPnP *o;
    26     GMainLoop *loop;
    27 
    28     g_type_init ();
    29     g_thread_init (NULL);
    30 
    31     o = gmyth_upnp_get_instance ();
    32     g_signal_connect (o,
    33                       "device-found",
    34                        G_CALLBACK (_device_found_cb),
    35                        NULL);
    36     g_signal_connect (o,
    37                       "device-lost",
    38                        G_CALLBACK (_device_lost_cb),
    39                        NULL);
    40 
    41 
    42     gmyth_upnp_search (o);
    43 
    44     loop = g_main_loop_new (NULL, FALSE);
    45     g_main_loop_run (loop);
    46     g_object_unref (o);
    47 
    48     return 0;
    49 }