gmyth/src/gmyth_monitor_handler.h
author rosfran
Thu Dec 07 18:39:41 2006 +0000 (2006-12-07)
branchtrunk
changeset 212 49ba93ca4586
parent 203 a43fed947ec8
child 213 631f2cf13501
permissions -rwxr-xr-x
[svn r213] Include GObject signal connects/emmits to GMythMonitorHandler.
     1 /* vim: set sw=2: -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2; c-indent-level: 2-*- */
     2 /**
     3  * GMyth Library
     4  *
     5  * @file gmyth/gmyth_monitor_handler.h
     6  * 
     7  * @brief <p> GMythMonitorHandler deals with the streaming media events remote/local
     8  * that are sent to the MythTV frontend.
     9  *
    10  * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    11  * @author Rosfran Lins Borges <rosfran.borges@indt.org.br>
    12  *
    13  *//*
    14  * 
    15  * This program is free software; you can redistribute it and/or modify
    16  * it under the terms of the GNU Lesser General Public License as published by
    17  * the Free Software Foundation; either version 2 of the License, or
    18  * (at your option) any later version.
    19  *
    20  * This program is distributed in the hope that it will be useful,
    21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    23  * GNU General Public License for more details.
    24  *
    25  * You should have received a copy of the GNU Lesser General Public License
    26  * along with this program; if not, write to the Free Software
    27  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    28  */
    29  
    30 #ifndef __GMYTH_MONITOR_HANDLER_H__
    31 #define __GMYTH_MONITOR_HANDLER_H__
    32 
    33 #include <glib-object.h>
    34 #include <glib.h>
    35 
    36 #include "gmyth_socket.h"
    37 #include "gmyth_uri.h"
    38 #include "gmyth_livetv.h"
    39 
    40 #include <stdio.h>
    41 #include <stdlib.h>
    42 #include <string.h>
    43 #include <netdb.h>
    44 #include <sys/socket.h>
    45 #include <unistd.h>
    46 
    47 #define G_BEGIN_DECLS
    48 
    49 #define GMYTH_MONITOR_HANDLER_TYPE               (gmyth_monitor_handler_get_type ())
    50 #define GMYTH_MONITOR_HANDLER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandler))
    51 #define GMYTH_MONITOR_HANDLER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandlerClass))
    52 #define IS_GMYTH_MONITOR_HANDLER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_MONITOR_HANDLER_TYPE))
    53 #define IS_GMYTH_MONITOR_HANDLER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_MONITOR_HANDLER_TYPE))
    54 #define GMYTH_MONITOR_HANDLER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_MONITOR_HANDLER_TYPE, GMythMonitorHandlerClass))
    55 
    56 #define GMYTHTV_MONITOR_HANDLER_READ_ERROR	-314
    57 
    58 typedef struct _GMythMonitorHandler         GMythMonitorHandler;
    59 typedef struct _GMythMonitorHandlerClass    GMythMonitorHandlerClass;
    60 
    61 struct _GMythMonitorHandlerClass
    62 {
    63 	GObjectClass parent_class;
    64 
    65 	/* callbacks */	
    66 	guint backend_events_handler_signal_id;
    67 
    68   /* signal default handlers */
    69   void (*backend_events_handler) (GMythMonitorHandler *monitor, gint msg_code, gchar* message );
    70 };
    71 
    72 struct _GMythMonitorHandler
    73 {
    74 	GObject parent;
    75 
    76 	/* MythTV version number */	
    77 	gint mythtv_version;
    78 
    79 	/* socket descriptors */
    80 	GMythSocket *event_sock;
    81 
    82 	gchar *hostname;
    83 	gint port;
    84 	
    85 	gint64 actual_index;
    86 	
    87 	/* stores the messages coming from the backend */
    88 	GHashTable *backend_msgs;
    89 };
    90 
    91 GType          gmyth_monitor_handler_get_type        (void);
    92 
    93 GMythMonitorHandler* gmyth_monitor_handler_new (void);
    94 
    95 gboolean gmyth_monitor_handler_open (GMythMonitorHandler *monitor, gchar *hostname, gint port);
    96 
    97 gboolean gmyth_monitor_handler_start (GMythMonitorHandler *monitor);
    98 
    99 void gmyth_monitor_handler_close (GMythMonitorHandler *monitor);
   100 
   101 #define G_END_DECLS
   102 
   103 #endif /* __GMYTH_MONITOR_HANDLER_H__ */