/
mms_connman.c
100 lines (91 loc) · 2.08 KB
/
mms_connman.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
* Copyright (C) 2013-2014 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "mms_connman.h"
G_DEFINE_TYPE(MMSConnMan, mms_connman, G_TYPE_OBJECT);
#define MMS_CONNMAN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
MMS_TYPE_CONNMAN, MMSConnMan))
#define MMS_CONNMAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
MMS_TYPE_CONNMAN, MMSConnManClass))
MMSConnMan*
mms_connman_ref(
MMSConnMan* cm)
{
if (cm) g_object_ref(MMS_CONNMAN(cm));
return cm;
}
void
mms_connman_unref(
MMSConnMan* cm)
{
if (cm) g_object_unref(MMS_CONNMAN(cm));
}
/**
* Per class initializer
*/
static
void
mms_connman_class_init(
MMSConnManClass* klass)
{
}
/**
* Per instance initializer
*/
static
void
mms_connman_init(
MMSConnMan* cm)
{
}
/**
* Returns default (first available) IMSI or NULL if SIM is not present
* or not configured. Caller must g_free() the returned string.
*/
char*
mms_connman_default_imsi(
MMSConnMan* cm)
{
if (cm) {
MMSConnManClass* klass = MMS_CONNMAN_GET_CLASS(cm);
if (klass->fn_default_imsi) {
return klass->fn_default_imsi(cm);
}
}
return NULL;
}
/**
* Creates a new connection or returns the reference to an aready active one.
* The caller must release the reference.
*/
MMSConnection*
mms_connman_open_connection(
MMSConnMan* cm,
const char* imsi,
gboolean user_request)
{
if (cm) {
MMSConnManClass* klass = MMS_CONNMAN_GET_CLASS(cm);
if (klass->fn_open_connection) {
return klass->fn_open_connection(cm, imsi, user_request);
}
}
return NULL;
}
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/