~awe/phablet-extras/ofono-lp1188404

« back to all changes in this revision

Viewing changes to gril/gril.h

  • Committer: Tarmac
  • Author(s): Tony Espy
  • Date: 2013-04-11 01:00:53 UTC
  • mfrom: (27.1.8 ofono-raring)
  • Revision ID: tarmac-20130411010053-u5x1792w0e3r62l4
Re-based ofono/RILD code on new upstream version ofono-1.12-0ubuntu2b1 from Raring.
.

Approved by Ricardo Salveti, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 *  RIL library with GLib integration
 
4
 *
 
5
 *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
 
6
 *  Copyright (C) 2012 Canonical Ltd.
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License version 2 as
 
10
 *  published by the Free Software Foundation.
 
11
 *
 
12
 *  This program is distributed in the hope that it will be useful,
 
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 *  GNU General Public License for more details.
 
16
 *
 
17
 *  You should have received a copy of the GNU General Public License
 
18
 *  along with this program; if not, write to the Free Software
 
19
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
20
 *
 
21
 */
 
22
 
 
23
#ifndef __GRIL_H
 
24
#define __GRIL_H
 
25
 
 
26
#ifdef __cplusplus
 
27
extern "C" {
 
28
#endif
 
29
 
 
30
#include "grilresponse.h"
 
31
#include "grilutil.h"
 
32
#include "grilio.h"
 
33
#include "ril_constants.h"
 
34
 
 
35
struct _GRil;
 
36
 
 
37
typedef struct _GRil GRil;
 
38
 
 
39
/*
 
40
 * This struct represents an entire RIL message read
 
41
 * from the command socket.  It can hold responses or
 
42
 * unsolicited requests from RILD.
 
43
 */
 
44
struct ril_msg {
 
45
        gchar *buf;
 
46
        gsize buf_len;
 
47
        gboolean unsolicited;
 
48
        int req;
 
49
        int serial_no;
 
50
        int error;
 
51
};
 
52
 
 
53
typedef void (*GRilResponseFunc)(struct ril_msg *message, gpointer user_data);
 
54
 
 
55
typedef void (*GRilNotifyFunc)(struct ril_msg *message, gpointer user_data);
 
56
 
 
57
GRil *g_ril_new();
 
58
 
 
59
GIOChannel *g_ril_get_channel(GRil *ril);
 
60
GRilIO *g_ril_get_io(GRil *ril);
 
61
 
 
62
GRil *g_ril_ref(GRil *ril);
 
63
void g_ril_unref(GRil *ril);
 
64
 
 
65
GRil *g_ril_clone(GRil *ril);
 
66
 
 
67
void g_ril_suspend(GRil *ril);
 
68
void g_ril_resume(GRil *ril);
 
69
 
 
70
gboolean g_ril_set_disconnect_function(GRil *ril, GRilDisconnectFunc disconnect,
 
71
                                        gpointer user_data);
 
72
 
 
73
/*!
 
74
 * If the function is not NULL, then on every read/write from the GIOChannel
 
75
 * provided to GRil the logging function will be called with the
 
76
 * input/output string and user data
 
77
 */
 
78
gboolean g_ril_set_debug(GRil *ril, GRilDebugFunc func, gpointer user_data);
 
79
 
 
80
/*!
 
81
 * Queue an RIL request for execution.  The request contents are given
 
82
 * in data.  Once the command executes, the callback function given by
 
83
 * func is called with user provided data in user_data.
 
84
 *
 
85
 * Returns an id of the queued command which can be canceled using
 
86
 * g_ril_cancel.  If an error occurred, an id of 0 is returned.
 
87
 *
 
88
 */
 
89
guint g_ril_send(GRil *ril, const guint req, const char *data, const gsize data_len,
 
90
                GRilResponseFunc func, gpointer user_data, GDestroyNotify notify);
 
91
 
 
92
guint g_ril_register(GRil *ril, const int req,
 
93
                        GRilNotifyFunc func, gpointer user_data);
 
94
 
 
95
gboolean g_ril_unregister(GRil *ril, guint id);
 
96
gboolean g_ril_unregister_all(GRil *ril);
 
97
 
 
98
#ifdef __cplusplus
 
99
}
 
100
#endif
 
101
 
 
102
#endif /* __GRIL_H */