Skip to content

Commit

Permalink
Merge branch 'libgofono' into 'master'
Browse files Browse the repository at this point in the history
Move some functionality to libglibutil and libgofono



See merge request !1
  • Loading branch information
monich committed Nov 2, 2015
2 parents 01f165a + 265f911 commit a840a8d
Show file tree
Hide file tree
Showing 55 changed files with 798 additions and 2,746 deletions.
5 changes: 3 additions & 2 deletions mms-engine/Makefile
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions mms-engine/main.c
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion mms-engine/mms-engine.pro
@@ -1,6 +1,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion mms-handler-dbus/Makefile
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mms-handler-dbus/mms-handler-dbus.pro
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions mms-lib/Makefile
Expand Up @@ -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
Expand All @@ -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 \
Expand Down
44 changes: 29 additions & 15 deletions mms-lib/include/mms_connection.h
@@ -1,5 +1,6 @@
/*
* 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
Expand Down Expand Up @@ -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;
const char* imsi;
const char* mmsc;
const char* mmsproxy;
const char* netif;
gboolean user_connection;
MMS_CONNECTION_STATE state;
MMSConnectionDelegate* delegate;
};

/* Connection class for implementation */
Expand All @@ -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(
Expand All @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions mms-lib/include/mms_lib_log.h
@@ -1,5 +1,6 @@
/*
* 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
Expand Down Expand Up @@ -35,7 +36,7 @@
log(mms_connman_log)\
log(mms_connection_log)

MMS_LIB_LOG_MODULES(MMS_LOG_MODULE_DECL)
MMS_LIB_LOG_MODULES(GLOG_MODULE_DECL)

#endif /* JOLLA_MMS_LIB_LOG_H */

Expand Down
9 changes: 5 additions & 4 deletions mms-lib/include/mms_lib_types.h
@@ -1,5 +1,6 @@
/*
* 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
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit a840a8d

Please sign in to comment.