1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/gmyth-upnp/tests/main.c Mon Feb 25 14:14:29 2008 +0000
1.3 @@ -0,0 +1,78 @@
1.4 +/**
1.5 + * GMyth Library
1.6 + *
1.7 + * @file test/main.c
1.8 + *
1.9 + * @brief <p> GMythUPnP allows that a MythTV frontend discovers a
1.10 + * MythTV backend, using the UPnP architecture.
1.11 + *
1.12 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
1.13 + * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
1.14 + * @authon Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
1.15 + *
1.16 + * This library is free software; you can redistribute it and/or
1.17 + * modify it under the terms of the GNU Library General Public
1.18 + * License as published by the Free Software Foundation; either
1.19 + * version 2 of the License, or (at your option) any later version.
1.20 + *
1.21 + * This library is distributed in the hope that it will be useful,
1.22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.24 + * Library General Public License for more details.
1.25 + *
1.26 + * You should have received a copy of the GNU Library General Public
1.27 + * License along with this library; if not, write to the
1.28 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.29 + * Boston, MA 02111-1307, USA.
1.30 + */
1.31 +
1.32 +
1.33 +#include <glib.h>
1.34 +
1.35 +#include "gmyth_upnp.h"
1.36 +
1.37 +static void
1.38 +_device_found_cb (GMythUPnP *upnp,
1.39 + GMythBackendInfo *info,
1.40 + gpointer data)
1.41 +{
1.42 + g_debug ("BACKEND FOUND: %s", info->hostname);
1.43 +}
1.44 +
1.45 +static void
1.46 +_device_lost_cb (GMythUPnP *upnp,
1.47 + GMythBackendInfo *info,
1.48 + gpointer data)
1.49 +{
1.50 + g_debug ("BACKEND LOST: %s", info->hostname);
1.51 +}
1.52 +
1.53 +
1.54 +
1.55 +int main (int argc, char** argv)
1.56 +{
1.57 + GMythUPnP *o;
1.58 + GMainLoop *loop;
1.59 +
1.60 + g_type_init ();
1.61 + g_thread_init (NULL);
1.62 +
1.63 + o = gmyth_upnp_get_instance ();
1.64 + g_signal_connect (o,
1.65 + "device-found",
1.66 + G_CALLBACK (_device_found_cb),
1.67 + NULL);
1.68 + g_signal_connect (o,
1.69 + "device-lost",
1.70 + G_CALLBACK (_device_lost_cb),
1.71 + NULL);
1.72 +
1.73 +
1.74 + gmyth_upnp_search (o);
1.75 +
1.76 + loop = g_main_loop_new (NULL, FALSE);
1.77 + g_main_loop_run (loop);
1.78 + g_object_unref (o);
1.79 +
1.80 + return 0;
1.81 +}