Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mms-engine
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mer-core
mms-engine
Commits
265f911e
Commit
265f911e
authored
Oct 26, 2015
by
Slava Monich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[mms-engine] Move some functionality to libglibutil and libgofono
parent
01f165ad
Changes
55
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
798 additions
and
2746 deletions
+798
-2746
mms-engine/Makefile
mms-engine/Makefile
+3
-2
mms-engine/main.c
mms-engine/main.c
+1
-0
mms-engine/mms-engine.pro
mms-engine/mms-engine.pro
+2
-1
mms-handler-dbus/Makefile
mms-handler-dbus/Makefile
+1
-1
mms-handler-dbus/mms-handler-dbus.pro
mms-handler-dbus/mms-handler-dbus.pro
+1
-1
mms-lib/Makefile
mms-lib/Makefile
+2
-2
mms-lib/include/mms_connection.h
mms-lib/include/mms_connection.h
+29
-15
mms-lib/include/mms_lib_log.h
mms-lib/include/mms_lib_log.h
+3
-2
mms-lib/include/mms_lib_types.h
mms-lib/include/mms_lib_types.h
+5
-4
mms-lib/include/mms_log.h
mms-lib/include/mms_log.h
+64
-265
mms-lib/mms-lib.pro
mms-lib/mms-lib.pro
+1
-2
mms-lib/src/mms_connection.c
mms-lib/src/mms_connection.c
+67
-32
mms-lib/src/mms_dispatcher.c
mms-lib/src/mms_dispatcher.c
+48
-46
mms-lib/src/mms_log.c
mms-lib/src/mms_log.c
+0
-408
mms-lib/src/mms_task.c
mms-lib/src/mms_task.c
+3
-2
mms-lib/src/mms_task.h
mms-lib/src/mms_task.h
+3
-1
mms-lib/src/mms_task_decode.c
mms-lib/src/mms_task_decode.c
+1
-1
mms-lib/src/mms_task_encode.c
mms-lib/src/mms_task_encode.c
+1
-1
mms-lib/src/mms_task_http.c
mms-lib/src/mms_task_http.c
+2
-2
mms-lib/src/mms_task_http.h
mms-lib/src/mms_task_http.h
+1
-0
mms-lib/src/mms_task_notification.c
mms-lib/src/mms_task_notification.c
+1
-1
mms-lib/src/mms_task_publish.c
mms-lib/src/mms_task_publish.c
+3
-2
mms-lib/src/mms_task_retrieve.c
mms-lib/src/mms_task_retrieve.c
+3
-2
mms-lib/src/mms_task_send.c
mms-lib/src/mms_task_send.c
+1
-1
mms-lib/test/Makefile
mms-lib/test/Makefile
+0
-1
mms-lib/test/common/Makefile
mms-lib/test/common/Makefile
+1
-1
mms-lib/test/common/test_connection.c
mms-lib/test/common/test_connection.c
+3
-5
mms-lib/test/coverage/run
mms-lib/test/coverage/run
+1
-1
mms-lib/test/test_mms_log/Makefile
mms-lib/test/test_mms_log/Makefile
+0
-6
mms-lib/test/test_mms_log/test_mms_log.c
mms-lib/test/test_mms_log/test_mms_log.c
+0
-223
mms-ofono/Makefile
mms-ofono/Makefile
+4
-33
mms-ofono/include/mms_ofono_connman.h
mms-ofono/include/mms_ofono_connman.h
+2
-1
mms-ofono/include/mms_ofono_log.h
mms-ofono/include/mms_ofono_log.h
+4
-5
mms-ofono/mms-ofono.pro
mms-ofono/mms-ofono.pro
+3
-105
mms-ofono/spec/org.ofono.ConnectionContext.xml
mms-ofono/spec/org.ofono.ConnectionContext.xml
+0
-17
mms-ofono/spec/org.ofono.ConnectionManager.xml
mms-ofono/spec/org.ofono.ConnectionManager.xml
+0
-37
mms-ofono/spec/org.ofono.Manager.xml
mms-ofono/spec/org.ofono.Manager.xml
+0
-18
mms-ofono/spec/org.ofono.MessageManager.xml
mms-ofono/spec/org.ofono.MessageManager.xml
+0
-42
mms-ofono/spec/org.ofono.Modem.xml
mms-ofono/spec/org.ofono.Modem.xml
+0
-19
mms-ofono/spec/org.ofono.NetworkRegistration.xml
mms-ofono/spec/org.ofono.NetworkRegistration.xml
+0
-22
mms-ofono/spec/org.ofono.SimManager.xml
mms-ofono/spec/org.ofono.SimManager.xml
+0
-45
mms-ofono/src/mms_ofono_connection.c
mms-ofono/src/mms_ofono_connection.c
+235
-165
mms-ofono/src/mms_ofono_connection.h
mms-ofono/src/mms_ofono_connection.h
+6
-27
mms-ofono/src/mms_ofono_connman.c
mms-ofono/src/mms_ofono_connman.c
+289
-76
mms-ofono/src/mms_ofono_context.c
mms-ofono/src/mms_ofono_context.c
+0
-243
mms-ofono/src/mms_ofono_context.h
mms-ofono/src/mms_ofono_context.h
+0
-58
mms-ofono/src/mms_ofono_manager.c
mms-ofono/src/mms_ofono_manager.c
+0
-206
mms-ofono/src/mms_ofono_manager.h
mms-ofono/src/mms_ofono_manager.h
+0
-45
mms-ofono/src/mms_ofono_modem.c
mms-ofono/src/mms_ofono_modem.c
+0
-410
mms-ofono/src/mms_ofono_modem.h
mms-ofono/src/mms_ofono_modem.h
+0
-57
mms-ofono/src/mms_ofono_names.h
mms-ofono/src/mms_ofono_names.h
+0
-48
mms-ofono/src/mms_ofono_types.h
mms-ofono/src/mms_ofono_types.h
+0
-34
mms-settings-dconf/Makefile
mms-settings-dconf/Makefile
+1
-1
mms-settings-dconf/mms-settings-dconf.pro
mms-settings-dconf/mms-settings-dconf.pro
+1
-1
rpm/mms-engine.spec
rpm/mms-engine.spec
+2
-0
No files found.
mms-engine/Makefile
View file @
265f911e
...
...
@@ -16,8 +16,9 @@ include ../mms-lib/Config.mak
# Required packages
#
PKGS
=
gio-unix-2.0 gio-2.0
LIB_PKGS
=
libwspcodec gmime-2.6 libsoup-2.4 dconf
$(RESIZE_PKG)
$(PKGS)
PKGS
=
gio-unix-2.0 gio-2.0 libglibutil
LIB_PKGS
=
libwspcodec gmime-2.6 libgofono libsoup-2.4 dconf
LIB_PKGS
+=
$(RESIZE_PKG)
$(PKGS)
#
# Default target
...
...
mms-engine/main.c
View file @
265f911e
...
...
@@ -286,6 +286,7 @@ int main(int argc, char* argv[])
int
result
=
RET_ERR
;
MMSAppOptions
opt
=
{
0
};
mms_lib_init
(
argv
[
0
]);
gofono_log
.
name
=
"mms-ofono"
;
mms_log_default
.
name
=
MMS_APP_LOG_PREFIX
;
mms_lib_default_config
(
&
opt
.
config
);
mms_settings_sim_data_default
(
&
opt
.
settings
);
...
...
mms-engine/mms-engine.pro
View file @
265f911e
TEMPLATE
=
app
CONFIG
+=
link_pkgconfig
PKGCONFIG
+=
gmime
-
2.6
gio
-
unix
-
2.0
gio
-
2.0
glib
-
2.0
libsoup
-
2.4
dconf
libwspcodec
ImageMagick
PKGCONFIG
+=
gmime
-
2.6
gio
-
unix
-
2.0
gio
-
2.0
glib
-
2.0
libsoup
-
2.4
dconf
PKGCONFIG
+=
libwspcodec
libgofono
libglibutil
DBUS_INTERFACE_DIR
=
$$
_PRO_FILE_PWD_
MMS_LIB_DIR
=
$$
_PRO_FILE_PWD_
/../
mms
-
lib
MMS_OFONO_DIR
=
$$
_PRO_FILE_PWD_
/../
mms
-
ofono
...
...
mms-handler-dbus/Makefile
View file @
265f911e
...
...
@@ -3,7 +3,7 @@
.PHONY
:
clean all debug release
# Required packages
PKGS
=
glib-2.0 gio-2.0 gio-unix-2.0
PKGS
=
libglibutil
glib-2.0 gio-2.0 gio-unix-2.0
#
# Default target
...
...
mms-handler-dbus/mms-handler-dbus.pro
View file @
265f911e
...
...
@@ -2,7 +2,7 @@ TEMPLATE = lib
CONFIG
+=
staticlib
CONFIG
-=
qt
CONFIG
+=
link_pkgconfig
PKGCONFIG
+=
glib
-
2.0
gio
-
2.0
gio
-
unix
-
2.0
PKGCONFIG
+=
libglibutil
glib
-
2.0
gio
-
2.0
gio
-
unix
-
2.0
DBUS_SPEC_DIR
=
$$
_PRO_FILE_PWD_
/
spec
INCLUDEPATH
+=
include
INCLUDEPATH
+=
..
/
mms
-
lib
/
include
...
...
mms-lib/Makefile
View file @
265f911e
...
...
@@ -12,7 +12,7 @@ include Config.mak
# Required packages
#
PKGS
=
gmime-2.6 glib-2.0 libsoup-2.4 libwspcodec
PKGS
=
libglibutil libwspcodec gmime-2.6 libsoup-2.4 glib-2.0
#
# Default target
...
...
@@ -36,7 +36,7 @@ SRC = \
mms_handler.c
\
mms_lib_util.c
\
mms_file_util.c
\
mms_
log.c mms_
message.c
\
mms_message.c
\
mms_settings.c
\
mms_task.c
\
mms_task_ack.c
\
...
...
mms-lib/include/mms_connection.h
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -30,25 +31,21 @@ typedef enum _MMS_CONNECTION_STATE {
MMS_CONNECTION_STATE_CLOSED
/* Connection has been closed */
}
MMS_CONNECTION_STATE
;
/* Delegate (one per connection) */
typedef
struct
mms_connection_delegate
MMSConnectionDelegate
;
struct
mms_connection_delegate
{
void
(
*
fn_connection_state_changed
)(
MMSConnectionDelegate
*
delegate
,
MMSConnection
*
connection
);
};
typedef
void
(
*
MMSConnectionStateChangeFunc
)(
MMSConnection
*
connection
,
void
*
data
);
/* Connection data. The delegate field may be changed by the client at
* any time. */
/* Connection object */
struct
mms_connection
{
GObject
parent
;
char
*
imsi
;
char
*
mmsc
;
char
*
mmsproxy
;
char
*
netif
;
c
onst
c
har
*
imsi
;
c
onst
c
har
*
mmsc
;
c
onst
c
har
*
mmsproxy
;
c
onst
c
har
*
netif
;
gboolean
user_connection
;
MMS_CONNECTION_STATE
state
;
MMSConnectionDelegate
*
delegate
;
};
/* Connection class for implementation */
...
...
@@ -59,6 +56,8 @@ typedef struct mms_connection_class {
GType
mms_connection_get_type
(
void
);
#define MMS_TYPE_CONNECTION (mms_connection_get_type())
#define MMS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
MMS_TYPE_CONNECTION, MMSConnection))
MMSConnection
*
mms_connection_ref
(
...
...
@@ -76,6 +75,21 @@ MMS_CONNECTION_STATE
mms_connection_state
(
MMSConnection
*
connection
);
gulong
mms_connection_add_state_change_handler
(
MMSConnection
*
connection
,
MMSConnectionStateChangeFunc
fn
,
void
*
data
);
void
mms_connection_signal_state_change
(
MMSConnection
*
connection
);
void
mms_connection_remove_handler
(
MMSConnection
*
connection
,
gulong
id
);
void
mms_connection_close
(
MMSConnection
*
connection
);
...
...
mms-lib/include/mms_lib_log.h
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -35,7 +36,7 @@
log(mms_connman_log)\
log(mms_connection_log)
MMS_LIB_LOG_MODULES
(
MMS_
LOG_MODULE_DECL
)
MMS_LIB_LOG_MODULES
(
G
LOG_MODULE_DECL
)
#endif
/* JOLLA_MMS_LIB_LOG_H */
...
...
mms-lib/include/mms_lib_types.h
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -31,8 +32,9 @@
#include <fcntl.h>
#include <glib.h>
#include <glib-object.h>
#include <gutil_types.h>
typedef
GLogModule
MMSLogModule
;
#ifndef O_BINARY
# define O_BINARY (0)
...
...
@@ -56,7 +58,6 @@ typedef struct mms_settings MMSSettings;
typedef
struct
mms_settings_sim_data
MMSSettingsSimData
;
typedef
struct
mms_handler
MMSHandler
;
typedef
struct
mms_connman
MMSConnMan
;
typedef
struct
mms_log_module
MMSLogModule
;
typedef
struct
mms_dispatcher
MMSDispatcher
;
typedef
struct
mms_connection
MMSConnection
;
typedef
struct
mms_message
MMSPdu
;
...
...
mms-lib/include/mms_log.h
View file @
265f911e
This diff is collapsed.
Click to expand it.
mms-lib/mms-lib.pro
View file @
265f911e
TEMPLATE
=
lib
CONFIG
+=
staticlib
CONFIG
+=
link_pkgconfig
PKGCONFIG
+=
gmime
-
2.6
glib
-
2.0
libsoup
-
2.4
libwspcodec
PKGCONFIG
+=
libglibutil
libwspcodec
gmime
-
2.6
glib
-
2.0
libsoup
-
2.4
INCLUDEPATH
+=
include
QMAKE_CFLAGS
+=
-
Wno
-
unused
-
parameter
...
...
@@ -38,7 +38,6 @@ SOURCES += \
src
/
mms_handler
.
c
\
src
/
mms_message
.
c
\
src
/
mms_lib_util
.
c
\
src
/
mms_log
.
c
\
src
/
mms_settings
.
c
\
src
/
mms_task
.
c
\
src
/
mms_task_ack
.
c
\
...
...
mms-lib/src/mms_connection.c
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -21,37 +22,75 @@
G_DEFINE_TYPE
(
MMSConnection
,
mms_connection
,
G_TYPE_OBJECT
);
#define MMS_CONNECTION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), MMS_TYPE_CONNECTION, MMSConnectionClass))
#define MMS_CONNECTION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), MMS_TYPE_CONNECTION, MMSConnection))
enum
mms_connection_signal
{
SIGNAL_STATE_CHANGED
,
SIGNAL_COUNT
};
#define SIGNAL_STATE_CHANGED_NAME "state-changed"
static
guint
mms_connection_signals
[
SIGNAL_COUNT
]
=
{
0
};
MMSConnection
*
mms_connection_ref
(
MMSConnection
*
conn
)
MMSConnection
*
self
)
{
if
(
conn
)
g_object_ref
(
MMS_CONNECTION
(
conn
));
return
conn
;
if
(
self
)
g_object_ref
(
MMS_CONNECTION
(
self
));
return
self
;
}
void
mms_connection_unref
(
MMSConnection
*
conn
)
MMSConnection
*
self
)
{
if
(
conn
)
g_object_unref
(
MMS_CONNECTION
(
conn
));
if
(
self
)
g_object_unref
(
MMS_CONNECTION
(
self
));
}
const
char
*
mms_connection_state_name
(
MMSConnection
*
conn
)
MMSConnection
*
self
)
{
static
const
char
*
names
[]
=
{
"????"
,
"OPENING"
,
"FAILED"
,
"OPEN"
,
"CLOSED"
};
return
names
[
mms_connection_state
(
conn
)];
return
names
[
mms_connection_state
(
self
)];
}
MMS_CONNECTION_STATE
mms_connection_state
(
MMSConnection
*
conn
)
MMSConnection
*
self
)
{
return
self
?
self
->
state
:
MMS_CONNECTION_STATE_INVALID
;
}
gulong
mms_connection_add_state_change_handler
(
MMSConnection
*
self
,
MMSConnectionStateChangeFunc
fn
,
void
*
data
)
{
return
conn
?
conn
->
state
:
MMS_CONNECTION_STATE_INVALID
;
return
(
self
&&
fn
)
?
g_signal_connect
(
self
,
SIGNAL_STATE_CHANGED_NAME
,
G_CALLBACK
(
fn
),
data
)
:
0
;
}
void
mms_connection_signal_state_change
(
MMSConnection
*
self
)
{
if
(
self
)
{
mms_connection_ref
(
self
);
g_signal_emit
(
self
,
mms_connection_signals
[
SIGNAL_STATE_CHANGED
],
0
);
mms_connection_unref
(
self
);
}
}
void
mms_connection_remove_handler
(
MMSConnection
*
self
,
gulong
id
)
{
if
(
self
&&
id
)
{
g_signal_handler_disconnect
(
self
,
id
);
}
}
void
...
...
@@ -62,44 +101,40 @@ mms_connection_close(
}
/**
*
Final stage of deinitialization
*
Per instance initializer
*/
static
void
mms_connection_
finalize
(
GObject
*
object
)
mms_connection_
init
(
MMSConnection
*
self
)
{
MMSConnection
*
conn
=
MMS_CONNECTION
(
object
);
MMS_VERBOSE_
(
"%p"
,
conn
);
MMS_ASSERT
(
!
conn
->
delegate
);
g_free
(
conn
->
imsi
);
g_free
(
conn
->
mmsc
);
g_free
(
conn
->
mmsproxy
);
g_free
(
conn
->
netif
);
G_OBJECT_CLASS
(
mms_connection_parent_class
)
->
finalize
(
object
);
MMS_VERBOSE_
(
"%p"
,
self
);
}
/**
*
Per class initializer
*
Final stage of deinitialization
*/
static
void
mms_connection_
class_init
(
MMSConnectionClass
*
klass
)
mms_connection_
finalize
(
GObject
*
object
)
{
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
klass
);
object_class
->
finalize
=
mms_connection_finalize
;
MMS_VERBOSE_
(
"%p"
,
object
);
G_OBJECT_CLASS
(
mms_connection_parent_class
)
->
finalize
(
object
)
;
}
/**
* Per
instance
initializer
* Per
class
initializer
*/
static
void
mms_connection_init
(
MMSConnection
*
conn
)
mms_connection_
class_
init
(
MMSConnection
Class
*
klass
)
{
MMS_VERBOSE_
(
"%p"
,
conn
);
G_OBJECT_CLASS
(
klass
)
->
finalize
=
mms_connection_finalize
;
mms_connection_signals
[
SIGNAL_STATE_CHANGED
]
=
g_signal_new
(
SIGNAL_STATE_CHANGED_NAME
,
G_OBJECT_CLASS_TYPE
(
klass
),
G_SIGNAL_RUN_FIRST
,
0
,
NULL
,
NULL
,
NULL
,
G_TYPE_NONE
,
0
);
}
/*
...
...
mms-lib/src/mms_dispatcher.c
View file @
265f911e
...
...
@@ -39,12 +39,12 @@ struct mms_dispatcher {
MMSHandler
*
handler
;
MMSConnMan
*
cm
;
MMSConnection
*
connection
;
MMSConnectionDelegate
connection_delegate
;
MMSDispatcherDelegate
*
delegate
;
GQueue
*
tasks
;
guint
next_run_id
;
guint
network_idle_id
;
gulong
handler_done_id
;
gulong
connection_changed_id
;
gboolean
started
;
};
...
...
@@ -57,9 +57,6 @@ typedef struct mms_dispatcher_idle_callback {
inline
static
MMSDispatcher
*
mms_dispatcher_from_task_delegate
(
MMSTaskDelegate
*
delegate
)
{
return
MMS_CAST
(
delegate
,
MMSDispatcher
,
task_delegate
);
}
inline
static
MMSDispatcher
*
mms_dispatcher_from_connection_delegate
(
MMSConnectionDelegate
*
delegate
)
{
return
MMS_CAST
(
delegate
,
MMSDispatcher
,
connection_delegate
);
}
static
void
...
...
@@ -98,8 +95,10 @@ mms_dispatcher_drop_connection(
{
if
(
disp
->
connection
)
{
MMS_ASSERT
(
!
mms_connection_is_active
(
disp
->
connection
));
mms_connection_remove_handler
(
disp
->
connection
,
disp
->
connection_changed_id
);
disp
->
connection_changed_id
=
0
;
mms_connection_unref
(
disp
->
connection
);
disp
->
connection
->
delegate
=
NULL
;
disp
->
connection
=
NULL
;
if
(
disp
->
network_idle_id
)
{
g_source_remove
(
disp
->
network_idle_id
);
...
...
@@ -242,9 +241,49 @@ mms_dispatcher_next_run_schedule(
mms_dispatcher_next_run
);
}
/**
* Connection state callback
*/
static
void
mms_dispatcher_connection_state_changed
(
MMSConnection
*
conn
,
void
*
data
)
{
MMSDispatcher
*
disp
=
data
;
MMS_CONNECTION_STATE
state
=
mms_connection_state
(
conn
);
MMS_DEBUG
(
"%s %s"
,
conn
->
imsi
,
mms_connection_state_name
(
conn
));
MMS_ASSERT
(
conn
==
disp
->
connection
);
if
(
state
==
MMS_CONNECTION_STATE_FAILED
||
state
==
MMS_CONNECTION_STATE_CLOSED
)
{
GList
*
entry
;
mms_dispatcher_close_connection
(
disp
);
for
(
entry
=
disp
->
tasks
->
head
;
entry
;
entry
=
entry
->
next
)
{
MMSTask
*
task
=
entry
->
data
;
switch
(
task
->
state
)
{
case
MMS_TASK_STATE_NEED_CONNECTION
:
case
MMS_TASK_STATE_NEED_USER_CONNECTION
:
case
MMS_TASK_STATE_TRANSMITTING
:
if
(
!
strcmp
(
conn
->
imsi
,
task
->
imsi
))
{
mms_task_network_unavailable
(
task
,
TRUE
);
}
default:
break
;
}
}
mms_dispatcher_drop_connection
(
disp
);
mms_dispatcher_check_if_done
(
disp
);
}
if
(
!
disp
->
active_task
)
{
mms_dispatcher_next_run_schedule
(
disp
);
}
}
/**
* Set the delegate that receives dispatcher notifications.
* One delegate per dispatcher.
*
* TODO: Replace this delegate stuff wuth glib signals
*/
void
mms_dispatcher_set_delegate
(
...
...
@@ -325,7 +364,10 @@ mms_dispatcher_pick_next_task(
disp
->
connection
=
mms_connman_open_connection
(
disp
->
cm
,
task
->
imsi
,
FALSE
);
if
(
disp
->
connection
)
{
disp
->
connection
->
delegate
=
&
disp
->
connection_delegate
;
MMS_ASSERT
(
!
disp
->
connection_changed_id
);
disp
->
connection_changed_id
=
mms_connection_add_state_change_handler
(
disp
->
connection
,
mms_dispatcher_connection_state_changed
,
disp
);
g_queue_delete_link
(
disp
->
tasks
,
entry
);
return
task
;
}
else
{
...
...
@@ -583,44 +625,6 @@ mms_dispatcher_cancel(
}
}
/**
* Connection delegate callbacks
*/
static
void
mms_dispatcher_delegate_connection_state_changed
(
MMSConnectionDelegate
*
delegate
,
MMSConnection
*
conn
)
{
MMSDispatcher
*
disp
=
mms_dispatcher_from_connection_delegate
(
delegate
);
MMS_CONNECTION_STATE
state
=
mms_connection_state
(
conn
);
MMS_DEBUG
(
"%s %s"
,
conn
->
imsi
,
mms_connection_state_name
(
conn
));
MMS_ASSERT
(
conn
==
disp
->
connection
);
if
(
state
==
MMS_CONNECTION_STATE_FAILED
||
state
==
MMS_CONNECTION_STATE_CLOSED
)
{
GList
*
entry
;
mms_dispatcher_close_connection
(
disp
);
for
(
entry
=
disp
->
tasks
->
head
;
entry
;
entry
=
entry
->
next
)
{
MMSTask
*
task
=
entry
->
data
;
switch
(
task
->
state
)
{
case
MMS_TASK_STATE_NEED_CONNECTION
:
case
MMS_TASK_STATE_NEED_USER_CONNECTION
:
case
MMS_TASK_STATE_TRANSMITTING
:
if
(
!
strcmp
(
conn
->
imsi
,
task
->
imsi
))
{
mms_task_network_unavailable
(
task
,
TRUE
);
}
default:
break
;
}
}
mms_dispatcher_drop_connection
(
disp
);
mms_dispatcher_check_if_done
(
disp
);
}
if
(
!
disp
->
active_task
)
{
mms_dispatcher_next_run_schedule
(
disp
);
}
}
/**
* Task delegate callbacks
*/
...
...
@@ -683,8 +687,6 @@ mms_dispatcher_new(
mms_dispatcher_delegate_task_queue
;
disp
->
task_delegate
.
fn_task_state_changed
=
mms_dispatcher_delegate_task_state_changed
;
disp
->
connection_delegate
.
fn_connection_state_changed
=
mms_dispatcher_delegate_connection_state_changed
;
disp
->
handler_done_id
=
mms_handler_add_done_callback
(
handler
,
mms_dispatcher_handler_done
,
disp
);
return
disp
;
...
...
mms-lib/src/mms_log.c
deleted
100644 → 0
View file @
01f165ad
This diff is collapsed.
Click to expand it.
mms-lib/src/mms_task.c
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -21,7 +22,7 @@
#endif
/* Logging */
#define MMS_LOG_MODULE_NAME
mms_task_log
#define MMS_LOG_MODULE_NAME
MMS_TASK_LOG
#include "mms_lib_log.h"
MMS_LOG_MODULE_DEFINE
(
"mms-task"
);
...
...
mms-lib/src/mms_task.h
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -84,6 +85,7 @@ typedef struct mms_task_class {
}
MMSTaskClass
;
GType
mms_task_get_type
(
void
);
#define MMS_TASK_LOG mms_task_log
#define MMS_TYPE_TASK (mms_task_get_type())
#define MMS_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
MMS_TYPE_TASK, MMSTaskClass))
...
...
mms-lib/src/mms_task_decode.c
View file @
265f911e
...
...
@@ -23,7 +23,7 @@
/* Logging */
#define MMS_LOG_MODULE_NAME mms_task_decode_log
#include "mms_lib_log.h"
MMS_LOG_MODULE_DEFINE
(
"mms-task-decode"
);
MMS_LOG_MODULE_DEFINE
2
(
"mms-task-decode"
,
MMS_TASK_LOG
);
/* Class definition */
typedef
MMSTaskClass
MMSTaskDecodeClass
;
...
...
mms-lib/src/mms_task_encode.c
View file @
265f911e
...
...
@@ -28,7 +28,7 @@
#define MMS_LOG_MODULE_NAME mms_task_encode_log
#include "mms_lib_log.h"
#include "mms_error.h"
MMS_LOG_MODULE_DEFINE
(
"mms-task-encode"
);
MMS_LOG_MODULE_DEFINE
2
(
"mms-task-encode"
,
MMS_TASK_LOG
);
/* Class definition */
typedef
MMSTaskClass
MMSTaskEncodeClass
;
...
...
mms-lib/src/mms_task_http.c
View file @
265f911e
...
...
@@ -30,9 +30,9 @@
#endif
/* Logging */
#define MMS_LOG_MODULE_NAME
mms_task_http_log
#define MMS_LOG_MODULE_NAME
MMS_TASK_HTTP_LOG
#include "mms_lib_log.h"
MMS_LOG_MODULE_DEFINE
(
"mms-task-http"
);
MMS_LOG_MODULE_DEFINE
2
(
"mms-task-http"
,
MMS_TASK_LOG
);
/* HTTP task state */
typedef
enum
_mms_http_state
{
...
...
mms-lib/src/mms_task_http.h
View file @
265f911e
...
...
@@ -45,6 +45,7 @@ typedef struct mms_task_http_class {
}
MMSTaskHttpClass
;
GType
mms_task_http_get_type
(
void
);
#define MMS_TASK_HTTP_LOG mms_task_http_log
#define MMS_TYPE_TASK_HTTP (mms_task_http_get_type())
#define MMS_TASK_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \
MMS_TYPE_TASK_HTTP, MMSTaskHttpClass))
...
...
mms-lib/src/mms_task_notification.c
View file @
265f911e
...
...
@@ -23,7 +23,7 @@
#define MMS_LOG_MODULE_NAME mms_task_notification_log
#include "mms_lib_log.h"
#include "mms_error.h"
MMS_LOG_MODULE_DEFINE
(
"mms-task-notification"
);
MMS_LOG_MODULE_DEFINE
2
(
"mms-task-notification"
,
MMS_TASK_LOG
);
/* Class definition */
typedef
MMSTaskClass
MMSTaskNotificationClass
;
...
...
mms-lib/src/mms_task_publish.c
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -18,7 +19,7 @@
/* Logging */
#define MMS_LOG_MODULE_NAME mms_task_publish_log
#include "mms_lib_log.h"
MMS_LOG_MODULE_DEFINE
(
"mms-task-publish"
);
MMS_LOG_MODULE_DEFINE
2
(
"mms-task-publish"
,
MMS_TASK_LOG
);
/* Class definition */
typedef
MMSTaskClass
MMSTaskPublishClass
;
...
...
mms-lib/src/mms_task_retrieve.c
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -22,7 +23,7 @@
#define MMS_LOG_MODULE_NAME mms_task_retrieve_log
#include "mms_lib_log.h"
#include "mms_error.h"
MMS_LOG_MODULE_DEFINE
(
"mms-task-retrieve"
);
MMS_LOG_MODULE_DEFINE
2
(
"mms-task-retrieve"
,
MMS_TASK_HTTP_LOG
);
/* Class definition */
typedef
MMSTaskHttpClass
MMSTaskRetrieveClass
;
...
...
mms-lib/src/mms_task_send.c
View file @
265f911e
...
...
@@ -23,7 +23,7 @@
#define MMS_LOG_MODULE_NAME mms_task_send_log
#include "mms_lib_log.h"
#include "mms_error.h"
MMS_LOG_MODULE_DEFINE
(
"mms-task-send"
);
MMS_LOG_MODULE_DEFINE
2
(
"mms-task-send"
,
MMS_TASK_HTTP_LOG
);
/* Class definition */
typedef
MMSTaskHttpClass
MMSTaskSendClass
;
...
...
mms-lib/test/Makefile
View file @
265f911e
...
...
@@ -4,7 +4,6 @@ all:
%
:
@
$(MAKE)
-C
test_media_type
$*
@
$(MAKE)
-C
test_mms_codec
$*
@
$(MAKE)
-C
test_mms_log
$*
@
$(MAKE)
-C
test_delivery_ind
$*
@
$(MAKE)
-C
test_read_ind
$*
@
$(MAKE)
-C
test_read_report
$*
...
...
mms-lib/test/common/Makefile
View file @
265f911e
...
...
@@ -25,7 +25,7 @@ include ../../Config.mak
# Required packages
#
PKGS
+=
gmime-2.6 glib-2.0 libsoup-2.4
PKGS
+=
gmime-2.6 glib-2.0 libsoup-2.4
libglibutil
LIB_PKGS
+=
$(PKGS)
libwspcodec
$(RESIZE_PKG)
#
...
...
mms-lib/test/common/test_connection.c
View file @
265f911e
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -43,10 +44,7 @@ test_connection_test_state_change_cb(
test
->
state
!=
MMS_CONNECTION_STATE_FAILED
&&
test
->
state
!=
change
->
state
)
{
test
->
state
=
change
->
state
;
if
(
test
->
delegate
&&
test
->
delegate
->
fn_connection_state_changed
)
{
test
->
delegate
->
fn_connection_state_changed
(
test
->
delegate
,
test
);
}
mms_connection_signal_state_change
(
test
);
}
mms_connection_unref
(
change
->
test
);
g_free
(
change
);
...
...
mms-lib/test/coverage/run
View file @
265f911e
...
...
@@ -3,7 +3,7 @@
# This script requires lcov to be installed
#
TESTS
=
"test_media_type test_mms_codec test_
mms_log test_
delivery_ind
\
TESTS
=
"test_media_type test_mms_codec test_delivery_ind
\
test_read_ind test_read_report test_resize test_retrieve
\
test_retrieve_cancel test_retrieve_no_proxy test_send"
FLAVOR
=
"release"
...
...
mms-lib/test/test_mms_log/Makefile
deleted
100644 → 0
View file @
01f165ad
# -*- Mode: makefile-gmake -*-
EXE
=
test_mms_log
SRC
=
$(EXE)
.c
include
../common/Makefile
mms-lib/test/test_mms_log/test_mms_log.c
deleted
100644 → 0
View file @
01f165ad
/*
* Copyright (C) 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_log.h"
#define RET_OK (0)
#define RET_ERR (1)
typedef
struct
test_desc
{
const
char
*
name
;
MMSLogModule
**
mods
;
int
nmods
;
const
int
*
results
;
/* nmods elements */
int
default_level
;
char
**
opts
;
int
nopts
;
gboolean
test_success
;
}
TestDesc
;
const
MMS_LOG_MODULE_DEFINE_
(
log_defaults
,
NULL
);
/* Test1: default level + 2 modules */
MMS_LOG_MODULE_DEFINE_
(
mod1a
,
"test-a"
);
MMS_LOG_MODULE_DEFINE_
(
mod1b
,
"test-b"
);
static
MMSLogModule
*
mods1
[]
=
{
&
mod1a
,
&
mod1b
};