Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mms-engine] Proper support for multiple SIMs. Fixes JB#33702
We need to use org.nemomobile.ofono.ModemManager API to notify ofono
that we need to download MMS so that it enables mobile data for the
appropriate SIM. If it's different from the currently selected data SIM,
then connman will be prevented from using mobile data while MMS download
is taking place.
  • Loading branch information
monich committed Feb 2, 2016
1 parent 9ed9450 commit 85d3c47
Show file tree
Hide file tree
Showing 17 changed files with 1,264 additions and 33 deletions.
112 changes: 112 additions & 0 deletions mms-connman-nemo/Makefile
@@ -0,0 +1,112 @@
# -*- Mode: makefile-gmake -*-

.PHONY: clean all debug release

# Required packages
PKGS = libgofono libgofonoext libglibutil glib-2.0 gio-2.0 gio-unix-2.0

#
# Default target
#

all: debug release

#
# Sources
#

SRC = \
mms_connection_nemo.c \
mms_connman_nemo.c

#
# Directories
#

SRC_DIR = src
INCLUDE_DIR = include
BUILD_DIR = build
SPEC_DIR = spec
MMS_LIB_INCLUDE = ../mms-lib/include
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
RELEASE_BUILD_DIR = $(BUILD_DIR)/release

#
# Tools and flags
#

CC = $(CROSS_COMPILE)gcc
LD = $(CC)
ARFLAGS = rc
DEBUG_FLAGS = -g
RELEASE_FLAGS = -O2
DEBUG_DEFS = -DDEBUG
RELEASE_DEFS =
WARNINGS = -Wall
INCLUDES = -I$(SRC_DIR) -I$(INCLUDE_DIR) -I$(MMS_LIB_INCLUDE) -I.
CFLAGS += $(WARNINGS) $(INCLUDES) $(shell pkg-config --cflags $(PKGS)) \
-fPIC -MMD

ifndef KEEP_SYMBOLS
KEEP_SYMBOLS = 0
endif

ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif

DEBUG_CFLAGS = $(DEBUG_FLAGS) $(DEBUG_DEFS) $(CFLAGS)
RELEASE_CFLAGS = $(RELEASE_FLAGS) $(RELEASE_DEFS) $(CFLAGS)

#
# Files
#

DEBUG_OBJS = $(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
RELEASE_OBJS = $(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)

#
# Dependencies
#

DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
endif
endif

$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)

#
# Rules
#
LIB = libmms-connman-nemo.a
DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)

debug: $(DEBUG_LIB)

release: $(RELEASE_LIB)

clean:
rm -fr $(BUILD_DIR) *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~

$(DEBUG_BUILD_DIR):
mkdir -p $@

$(RELEASE_BUILD_DIR):
mkdir -p $@

$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(WARN) $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@

$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(WARN) $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@

$(DEBUG_LIB): $(DEBUG_OBJS)
$(AR) $(ARFLAGS) $@ $^

$(RELEASE_LIB): $(RELEASE_OBJS)
$(AR) $(ARFLAGS) $@ $^
32 changes: 32 additions & 0 deletions mms-connman-nemo/include/mms_connman_nemo.h
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2013-2016 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
* 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.
*
*/

#ifndef JOLLA_MMS_CONNMAN_NEMO_H
#define JOLLA_MMS_CONNMAN_NEMO_H

#include "mms_connman.h"

MMSConnMan*
mms_connman_nemo_new(void);

#endif /* JOLLA_MMS_CONNMAN_NEMO_H */

/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
35 changes: 35 additions & 0 deletions mms-connman-nemo/include/mms_connman_nemo_log.h
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 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
* 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.
*
*/

#ifndef JOLLA_MMS_CONNMAN_NEMO_LOG_H
#define JOLLA_MMS_CONNMAN_NEMO_LOG_H

#include "mms_log.h"

#define MMS_CONNMAN_LOG_MODULES(log) \
log(gofonoext_log) \
log(gofono_log)

MMS_CONNMAN_LOG_MODULES(GLOG_MODULE_DECL)

#endif /* JOLLA_MMS_CONNMAN_NEMO_LOG_H */

/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
27 changes: 27 additions & 0 deletions mms-connman-nemo/mms-connman-nemo.pro
@@ -0,0 +1,27 @@
TEMPLATE = lib
CONFIG += staticlib
CONFIG -= qt
CONFIG += link_pkgconfig
PKGCONFIG += libgofono libgofonoext libglibutil glib-2.0 gio-2.0 gio-unix-2.0
DBUS_SPEC_DIR = $$_PRO_FILE_PWD_/spec
INCLUDEPATH += include
INCLUDEPATH += ../mms-lib/include
QMAKE_CFLAGS += -Wno-unused-parameter

CONFIG(debug, debug|release) {
DEFINES += DEBUG
DESTDIR = $$_PRO_FILE_PWD_/build/debug
} else {
DESTDIR = $$_PRO_FILE_PWD_/build/release
}

SOURCES += \
src/mms_connection_nemo.c \
src/mms_connman_nemo.c

HEADERS += \
src/mms_connection_nemo.h

HEADERS += \
include/mms_connman_nemo.h \
include/mms_connman_nemo_log.h

0 comments on commit 85d3c47

Please sign in to comment.