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