build: move plugins directory to src/plugins
We are going to allow including the plugin sources built within the ModemManager daemon binary; moving the sources within the daemon sources directory makes it easier.
This commit is contained in:
committed by
Aleksander Morgado
parent
072d7ac906
commit
e14b904cbd
@@ -0,0 +1,71 @@
|
||||
# do not edit this file, it will be overwritten on update
|
||||
|
||||
ACTION!="add|change|move|bind", GOTO="mm_cinterion_port_types_end"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e2d", GOTO="mm_cinterion_port_types"
|
||||
GOTO="mm_cinterion_port_types_end"
|
||||
|
||||
LABEL="mm_cinterion_port_types"
|
||||
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
|
||||
|
||||
# PHS8
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0053", ENV{.MM_USBIFNUM}=="01", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_GPS}="1"
|
||||
|
||||
# PLS8 port types
|
||||
# ttyACM0 (if #0): AT port
|
||||
# ttyACM1 (if #2): AT port
|
||||
# ttyACM2 (if #4): GPS data port
|
||||
# ttyACM3 (if #6): unknown
|
||||
# ttyACM4 (if #8): unknown
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0061", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0061", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0061", ENV{.MM_USBIFNUM}=="04", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_GPS}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0061", ENV{.MM_USBIFNUM}=="06", ENV{ID_MM_PORT_IGNORE}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0061", ENV{.MM_USBIFNUM}=="08", ENV{ID_MM_PORT_IGNORE}="1"
|
||||
|
||||
# PLS62 family non-mbim enumeration uses alternate settings for 2G band management
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005b", ENV{ID_MM_CINTERION_MODEM_FAMILY}="imt"
|
||||
# PLS62 family non-mbim enumeration
|
||||
# ttyACM0 (if #0): AT port
|
||||
# ttyACM1 (if #2): AT port
|
||||
# ttyACM2 (if #4): can be AT or GNSS in some models
|
||||
# ttyACM3 (if #6): AT port (but just ignore)
|
||||
# ttyACM4 (if #8): DIAG/QCDM
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005b", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005b", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005b", ENV{.MM_USBIFNUM}=="04", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_GPS}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005b", ENV{.MM_USBIFNUM}=="06", ENV{ID_MM_PORT_IGNORE}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005b", ENV{.MM_USBIFNUM}=="08", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_QCDM}="1"
|
||||
|
||||
# PLS62 family mbim enumeration
|
||||
# ttyACM0 (if #0): AT port
|
||||
# ttyACM1 (if #2): AT port
|
||||
# ttyACM2 (if #4): can be AT or GNSS in some models
|
||||
# ttyACM3 (if #6): AT port (but just ignore)
|
||||
# ttyACM4 (if #8): DIAG/QCDM
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005d", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005d", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005d", ENV{.MM_USBIFNUM}=="04", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_GPS}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005d", ENV{.MM_USBIFNUM}=="06", ENV{ID_MM_PORT_IGNORE}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="005d", ENV{.MM_USBIFNUM}=="08", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_QCDM}="1"
|
||||
|
||||
# PLS63
|
||||
# ttyACM0 (if #0): AT port
|
||||
# ttyACM1 (if #2): AT port
|
||||
# ttyACM2 (if #4): GPS data port
|
||||
# ttyACM3 (if #6): DIAG/QCDM
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0069", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0069", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0069", ENV{.MM_USBIFNUM}=="04", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_GPS}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0069", ENV{.MM_USBIFNUM}=="06", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_QCDM}="1"
|
||||
|
||||
# PLS83
|
||||
# ttyACM0 (if #0): AT port
|
||||
# ttyACM1 (if #2): AT port
|
||||
# ttyACM2 (if #4): GPS data port
|
||||
# ttyACM3 (if #6): DIAG/QCDM
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="006F", ENV{.MM_USBIFNUM}=="00", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="006F", ENV{.MM_USBIFNUM}=="02", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_AT_SECONDARY}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="006F", ENV{.MM_USBIFNUM}=="04", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_GPS}="1"
|
||||
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="006F", ENV{.MM_USBIFNUM}=="06", SUBSYSTEM=="tty", ENV{ID_MM_PORT_TYPE_QCDM}="1"
|
||||
|
||||
LABEL="mm_cinterion_port_types_end"
|
||||
@@ -0,0 +1,796 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2016 Trimble Navigation Limited
|
||||
* Author: Matthew Stanger <matthew_stanger@trimble.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <ModemManager.h>
|
||||
#include "mm-base-modem-at.h"
|
||||
#include "mm-broadband-bearer-cinterion.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-modem-helpers.h"
|
||||
#include "mm-modem-helpers-cinterion.h"
|
||||
#include "mm-daemon-enums-types.h"
|
||||
|
||||
G_DEFINE_TYPE (MMBroadbandBearerCinterion, mm_broadband_bearer_cinterion, MM_TYPE_BROADBAND_BEARER)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* WWAN interface mapping */
|
||||
|
||||
typedef struct {
|
||||
guint swwan_index;
|
||||
guint usb_iface_num;
|
||||
} UsbInterfaceConfig;
|
||||
|
||||
/* Map SWWAN index, USB interface number and preferred PDP context.
|
||||
*
|
||||
* The expected USB interface mapping is:
|
||||
* INTERFACE=usb0 -> ID_USB_INTERFACE_NUM=0a
|
||||
* INTERFACE=usb1 -> ID_USB_INTERFACE_NUM=0c
|
||||
* INTERFACE=usb0 -> ID_USB_INTERFACE_NUM=08 (PLSx3w)
|
||||
*/
|
||||
static const UsbInterfaceConfig usb_interface_configs[] = {
|
||||
{
|
||||
.swwan_index = 1,
|
||||
.usb_iface_num = 0x0a,
|
||||
},
|
||||
{
|
||||
.swwan_index = 2,
|
||||
.usb_iface_num = 0x0c,
|
||||
},
|
||||
{
|
||||
.swwan_index = 1,
|
||||
.usb_iface_num = 0x08,
|
||||
},
|
||||
};
|
||||
|
||||
static gint
|
||||
get_usb_interface_config_index (MMPort *data,
|
||||
GError **error)
|
||||
{
|
||||
guint usb_iface_num;
|
||||
guint i;
|
||||
|
||||
usb_iface_num = (guint) mm_kernel_device_get_interface_number (mm_port_peek_kernel_device (data));
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (usb_interface_configs); i++) {
|
||||
if (usb_interface_configs[i].usb_iface_num == usb_iface_num)
|
||||
return (gint) i;
|
||||
}
|
||||
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Unsupported WWAN interface: unexpected interface number: 0x%02x", usb_iface_num);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Connection status loading
|
||||
* NOTE: only CONNECTED or DISCONNECTED should be reported here.
|
||||
*/
|
||||
|
||||
static MMBearerConnectionStatus
|
||||
load_connection_status_finish (MMBaseBearer *bearer,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
GError *inner_error = NULL;
|
||||
gssize aux;
|
||||
|
||||
aux = g_task_propagate_int (G_TASK (res), &inner_error);
|
||||
if (inner_error) {
|
||||
g_propagate_error (error, inner_error);
|
||||
return MM_BEARER_CONNECTION_STATUS_UNKNOWN;
|
||||
}
|
||||
return (MMBearerConnectionStatus) aux;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
guint cid;
|
||||
guint retries;
|
||||
gboolean delay;
|
||||
gboolean retry;
|
||||
} LoadConnectionContext;
|
||||
|
||||
static void
|
||||
load_connection_context_free (LoadConnectionContext *ctx)
|
||||
{
|
||||
g_slice_free (LoadConnectionContext, ctx);
|
||||
}
|
||||
|
||||
static gboolean swwan_check_status (GTask *task);
|
||||
|
||||
static void
|
||||
swwan_check_status_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMBroadbandBearerCinterion *self;
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
MMBearerConnectionStatus status;
|
||||
LoadConnectionContext *ctx;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
response = mm_base_modem_at_command_finish (modem, res, &error);
|
||||
if (!response) {
|
||||
g_task_return_error (task, error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
status = mm_cinterion_parse_swwan_response (response, ctx->cid, self, &error);
|
||||
if (status == MM_BEARER_CONNECTION_STATUS_UNKNOWN) {
|
||||
g_task_return_error (task, error);
|
||||
goto out;
|
||||
} else if (ctx->retry && status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED) {
|
||||
mm_obj_dbg (self, "check status retry");
|
||||
if (ctx->retries == 0) {
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"CID %u status check retry exceeded", ctx->cid);
|
||||
goto out;
|
||||
} else {
|
||||
if (ctx->delay) {
|
||||
g_timeout_add_seconds (1, (GSourceFunc)swwan_check_status, task);
|
||||
} else {
|
||||
g_idle_add ((GSourceFunc)swwan_check_status, task);
|
||||
}
|
||||
ctx->retries--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_assert (status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED ||
|
||||
status == MM_BEARER_CONNECTION_STATUS_CONNECTED);
|
||||
g_task_return_int (task, (gssize) status);
|
||||
|
||||
out:
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
swwan_check_status (GTask *task)
|
||||
{
|
||||
MMBroadbandBearerCinterion *bearer;
|
||||
g_autoptr(MMBaseModem) modem = NULL;
|
||||
|
||||
bearer = g_task_get_source_object (task);
|
||||
g_object_get (bearer,
|
||||
MM_BASE_BEARER_MODEM, &modem,
|
||||
NULL);
|
||||
mm_base_modem_at_command (modem,
|
||||
"^SWWAN?",
|
||||
5,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) swwan_check_status_ready,
|
||||
task);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
load_connection_status_by_cid (MMBroadbandBearerCinterion *bearer,
|
||||
gint cid,
|
||||
gboolean delay,
|
||||
gboolean retry,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
LoadConnectionContext *ctx;
|
||||
|
||||
task = g_task_new (bearer, NULL, callback, user_data);
|
||||
if (cid == MM_3GPP_PROFILE_ID_UNKNOWN) {
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Unknown profile id to check connection status");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx = g_slice_new0 (LoadConnectionContext);
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify) load_connection_context_free);
|
||||
|
||||
/* Setup context */
|
||||
ctx->cid = cid;
|
||||
ctx->retries = 5;
|
||||
ctx->delay = delay;
|
||||
ctx->retry = retry;
|
||||
|
||||
/* Some modems require a delay before querying the SWWAN status
|
||||
* This is only needed for step DIAL_3GPP_CONTEXT_STEP_VALIDATE_CONNECTION
|
||||
* and DISCONNECT_3GPP_CONTEXT_STEP_CONNECTION_STATUS. */
|
||||
if (delay) {
|
||||
g_timeout_add_seconds (1, (GSourceFunc)swwan_check_status, task);
|
||||
} else {
|
||||
g_idle_add ((GSourceFunc)swwan_check_status, task);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
load_connection_status (MMBaseBearer *bearer,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
load_connection_status_by_cid (MM_BROADBAND_BEARER_CINTERION (bearer),
|
||||
mm_base_bearer_get_profile_id (bearer),
|
||||
FALSE,
|
||||
FALSE,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* Dial 3GPP */
|
||||
|
||||
typedef enum {
|
||||
DIAL_3GPP_CONTEXT_STEP_FIRST = 0,
|
||||
DIAL_3GPP_CONTEXT_STEP_AUTH,
|
||||
DIAL_3GPP_CONTEXT_STEP_START_SWWAN,
|
||||
DIAL_3GPP_CONTEXT_STEP_VALIDATE_CONNECTION,
|
||||
DIAL_3GPP_CONTEXT_STEP_LAST,
|
||||
} Dial3gppContextStep;
|
||||
|
||||
typedef struct {
|
||||
MMBroadbandBearerCinterion *self;
|
||||
MMBaseModem *modem;
|
||||
MMPortSerialAt *primary;
|
||||
guint cid;
|
||||
MMPort *data;
|
||||
gint usb_interface_config_index;
|
||||
Dial3gppContextStep step;
|
||||
} Dial3gppContext;
|
||||
|
||||
static void
|
||||
dial_3gpp_context_free (Dial3gppContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_object_unref (ctx->primary);
|
||||
g_clear_object (&ctx->data);
|
||||
g_slice_free (Dial3gppContext, ctx);
|
||||
}
|
||||
|
||||
static MMPort *
|
||||
dial_3gpp_finish (MMBroadbandBearer *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return MM_PORT (g_task_propagate_pointer (G_TASK (res), error));
|
||||
}
|
||||
|
||||
static void dial_3gpp_context_step (GTask *task);
|
||||
|
||||
static void
|
||||
dial_connection_status_ready (MMBroadbandBearerCinterion *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMBearerConnectionStatus status;
|
||||
Dial3gppContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = (Dial3gppContext *) g_task_get_task_data (task);
|
||||
|
||||
status = load_connection_status_finish (MM_BASE_BEARER (self), res, &error);
|
||||
if (status == MM_BEARER_CONNECTION_STATUS_UNKNOWN) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED) {
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"CID %u is reported disconnected", ctx->cid);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
g_assert (status == MM_BEARER_CONNECTION_STATUS_CONNECTED);
|
||||
|
||||
/* Go to next step */
|
||||
ctx->step++;
|
||||
dial_3gpp_context_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
common_dial_operation_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
Dial3gppContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = (Dial3gppContext *) g_task_get_task_data (task);
|
||||
|
||||
if (!mm_base_modem_at_command_full_finish (modem, res, &error)) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go to next step */
|
||||
ctx->step++;
|
||||
dial_3gpp_context_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
swwan_dial_operation_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
MMBroadbandBearerCinterion *self) /* full ref! */
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_at_command_full_finish (modem, res, &error)) {
|
||||
mm_obj_warn (self, "data connection attempt failed: %s", error->message);
|
||||
mm_base_bearer_report_connection_status (MM_BASE_BEARER (self),
|
||||
MM_BEARER_CONNECTION_STATUS_DISCONNECTED);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_object_unref (self);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_cancel_dial (GTask *task)
|
||||
{
|
||||
Dial3gppContext *ctx;
|
||||
gchar *command;
|
||||
|
||||
ctx = (Dial3gppContext *) g_task_get_task_data (task);
|
||||
|
||||
/* Disconnect, may not succeed. Will not check response on cancel */
|
||||
command = g_strdup_printf ("^SWWAN=0,%u,%u",
|
||||
ctx->cid, usb_interface_configs[ctx->usb_interface_config_index].swwan_index);
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
3,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
g_free (command);
|
||||
}
|
||||
|
||||
static void
|
||||
dial_3gpp_context_step (GTask *task)
|
||||
{
|
||||
MMBroadbandBearerCinterion *self;
|
||||
Dial3gppContext *ctx;
|
||||
MMCinterionModemFamily modem_family;
|
||||
gboolean default_swwan_behavior;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
/* Check for cancellation */
|
||||
if (g_task_return_error_if_cancelled (task)) {
|
||||
handle_cancel_dial (task);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
modem_family = mm_broadband_modem_cinterion_get_family (MM_BROADBAND_MODEM_CINTERION (ctx->modem));
|
||||
default_swwan_behavior = modem_family == MM_CINTERION_MODEM_FAMILY_DEFAULT;
|
||||
|
||||
switch (ctx->step) {
|
||||
case DIAL_3GPP_CONTEXT_STEP_FIRST:
|
||||
ctx->step++;
|
||||
/* fall through */
|
||||
|
||||
case DIAL_3GPP_CONTEXT_STEP_AUTH: {
|
||||
g_autofree gchar *command = NULL;
|
||||
|
||||
command = mm_cinterion_build_auth_string (self,
|
||||
modem_family,
|
||||
mm_base_bearer_peek_config (MM_BASE_BEARER (ctx->self)),
|
||||
ctx->cid);
|
||||
|
||||
if (command) {
|
||||
mm_obj_dbg (self, "dial step %u/%u: authenticating...", ctx->step, DIAL_3GPP_CONTEXT_STEP_LAST);
|
||||
/* Send SGAUTH write, if User & Pass are provided.
|
||||
* advance to next state by callback */
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
10,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) common_dial_operation_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
|
||||
mm_obj_dbg (self, "dial step %u/%u: authentication not required", ctx->step, DIAL_3GPP_CONTEXT_STEP_LAST);
|
||||
ctx->step++;
|
||||
} /* fall through */
|
||||
|
||||
case DIAL_3GPP_CONTEXT_STEP_START_SWWAN: {
|
||||
g_autofree gchar *command = NULL;
|
||||
|
||||
mm_obj_dbg (self, "dial step %u/%u: starting SWWAN interface %u connection...",
|
||||
ctx->step, DIAL_3GPP_CONTEXT_STEP_LAST, usb_interface_configs[ctx->usb_interface_config_index].swwan_index);
|
||||
command = g_strdup_printf ("^SWWAN=1,%u,%u",
|
||||
ctx->cid,
|
||||
usb_interface_configs[ctx->usb_interface_config_index].swwan_index);
|
||||
|
||||
if (default_swwan_behavior) {
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) common_dial_operation_ready,
|
||||
task);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We "jump" to the last step here here since the modem expects the
|
||||
* DHCP discover packet while ^SWWAN runs. If the command fails,
|
||||
* we'll mark the bearer disconnected later in the callback.
|
||||
*/
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
MM_BASE_BEARER_DEFAULT_CONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) swwan_dial_operation_ready,
|
||||
g_object_ref (self));
|
||||
ctx->step = DIAL_3GPP_CONTEXT_STEP_LAST;
|
||||
dial_3gpp_context_step (task);
|
||||
return;
|
||||
}
|
||||
|
||||
case DIAL_3GPP_CONTEXT_STEP_VALIDATE_CONNECTION:
|
||||
g_assert (default_swwan_behavior);
|
||||
mm_obj_dbg (self, "dial step %u/%u: checking SWWAN interface %u status...",
|
||||
ctx->step, DIAL_3GPP_CONTEXT_STEP_LAST, usb_interface_configs[ctx->usb_interface_config_index].swwan_index);
|
||||
load_connection_status_by_cid (ctx->self,
|
||||
(gint) ctx->cid,
|
||||
TRUE,
|
||||
TRUE,
|
||||
(GAsyncReadyCallback) dial_connection_status_ready,
|
||||
task);
|
||||
return;
|
||||
|
||||
case DIAL_3GPP_CONTEXT_STEP_LAST:
|
||||
mm_obj_dbg (self, "dial step %u/%u: finished", ctx->step, DIAL_3GPP_CONTEXT_STEP_LAST);
|
||||
g_task_return_pointer (task, g_object_ref (ctx->data), g_object_unref);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dial_3gpp (MMBroadbandBearer *self,
|
||||
MMBaseModem *modem,
|
||||
MMPortSerialAt *primary,
|
||||
guint cid,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
Dial3gppContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
g_assert (primary != NULL);
|
||||
|
||||
/* Setup task and create connection context */
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
ctx = g_slice_new0 (Dial3gppContext);
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify) dial_3gpp_context_free);
|
||||
|
||||
/* Setup context */
|
||||
ctx->self = MM_BROADBAND_BEARER_CINTERION (g_object_ref (self));
|
||||
ctx->modem = g_object_ref (modem);
|
||||
ctx->primary = g_object_ref (primary);
|
||||
ctx->cid = cid;
|
||||
ctx->step = DIAL_3GPP_CONTEXT_STEP_FIRST;
|
||||
|
||||
/* Get a net port to setup the connection on */
|
||||
ctx->data = mm_base_modem_peek_best_data_port (MM_BASE_MODEM (modem), MM_PORT_TYPE_NET);
|
||||
if (!ctx->data) {
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
|
||||
"No valid data port found to launch connection");
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
g_object_ref (ctx->data);
|
||||
|
||||
/* Validate configuration */
|
||||
ctx->usb_interface_config_index = get_usb_interface_config_index (ctx->data, &error);
|
||||
if (ctx->usb_interface_config_index < 0) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Run! */
|
||||
dial_3gpp_context_step (task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Disconnect 3GPP */
|
||||
|
||||
typedef enum {
|
||||
DISCONNECT_3GPP_CONTEXT_STEP_FIRST,
|
||||
DISCONNECT_3GPP_CONTEXT_STEP_STOP_SWWAN,
|
||||
DISCONNECT_3GPP_CONTEXT_STEP_CONNECTION_STATUS,
|
||||
DISCONNECT_3GPP_CONTEXT_STEP_LAST,
|
||||
} Disconnect3gppContextStep;
|
||||
|
||||
typedef struct {
|
||||
MMBroadbandBearerCinterion *self;
|
||||
MMBaseModem *modem;
|
||||
MMPortSerialAt *primary;
|
||||
MMPort *data;
|
||||
guint cid;
|
||||
gint usb_interface_config_index;
|
||||
Disconnect3gppContextStep step;
|
||||
} Disconnect3gppContext;
|
||||
|
||||
static void
|
||||
disconnect_3gpp_context_free (Disconnect3gppContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->data);
|
||||
g_object_unref (ctx->primary);
|
||||
g_object_unref (ctx->self);
|
||||
g_object_unref (ctx->modem);
|
||||
g_slice_free (Disconnect3gppContext, ctx);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
disconnect_3gpp_finish (MMBroadbandBearer *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return g_task_propagate_boolean (G_TASK (res), error);
|
||||
}
|
||||
|
||||
static void disconnect_3gpp_context_step (GTask *task);
|
||||
|
||||
static void
|
||||
disconnect_connection_status_ready (MMBroadbandBearerCinterion *self,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMBearerConnectionStatus status;
|
||||
Disconnect3gppContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = (Disconnect3gppContext *) g_task_get_task_data (task);
|
||||
|
||||
status = load_connection_status_finish (MM_BASE_BEARER (self), res, &error);
|
||||
switch (status) {
|
||||
case MM_BEARER_CONNECTION_STATUS_UNKNOWN:
|
||||
/* Assume disconnected */
|
||||
mm_obj_dbg (self, "couldn't get CID %u status, assume disconnected: %s", ctx->cid, error->message);
|
||||
g_clear_error (&error);
|
||||
break;
|
||||
case MM_BEARER_CONNECTION_STATUS_DISCONNECTED:
|
||||
break;
|
||||
case MM_BEARER_CONNECTION_STATUS_CONNECTED:
|
||||
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"CID %u is reported connected", ctx->cid);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
case MM_BEARER_CONNECTION_STATUS_DISCONNECTING:
|
||||
case MM_BEARER_CONNECTION_STATUS_CONNECTION_FAILED:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* Go on to next step */
|
||||
ctx->step++;
|
||||
disconnect_3gpp_context_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
swwan_disconnect_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
Disconnect3gppContext *ctx;
|
||||
|
||||
ctx = (Disconnect3gppContext *) g_task_get_task_data (task);
|
||||
|
||||
/* We don't bother to check error or response here since, ctx flow's
|
||||
* next step checks it */
|
||||
mm_base_modem_at_command_full_finish (modem, res, NULL);
|
||||
|
||||
/* Go on to next step */
|
||||
ctx->step++;
|
||||
disconnect_3gpp_context_step (task);
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_3gpp_context_step (GTask *task)
|
||||
{
|
||||
MMBroadbandBearerCinterion *self;
|
||||
Disconnect3gppContext *ctx;
|
||||
|
||||
self = g_task_get_source_object (task);
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
switch (ctx->step) {
|
||||
case DISCONNECT_3GPP_CONTEXT_STEP_FIRST:
|
||||
ctx->step++;
|
||||
/* fall through */
|
||||
|
||||
case DISCONNECT_3GPP_CONTEXT_STEP_STOP_SWWAN: {
|
||||
gchar *command;
|
||||
|
||||
command = g_strdup_printf ("^SWWAN=0,%u,%u",
|
||||
ctx->cid, usb_interface_configs[ctx->usb_interface_config_index].swwan_index);
|
||||
mm_obj_dbg (self, "disconnect step %u/%u: disconnecting PDP CID %u...",
|
||||
ctx->step, DISCONNECT_3GPP_CONTEXT_STEP_LAST, ctx->cid);
|
||||
mm_base_modem_at_command_full (ctx->modem,
|
||||
ctx->primary,
|
||||
command,
|
||||
MM_BASE_BEARER_DEFAULT_DISCONNECTION_TIMEOUT,
|
||||
FALSE,
|
||||
FALSE,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) swwan_disconnect_ready,
|
||||
task);
|
||||
g_free (command);
|
||||
return;
|
||||
}
|
||||
|
||||
case DISCONNECT_3GPP_CONTEXT_STEP_CONNECTION_STATUS:
|
||||
mm_obj_dbg (self, "disconnect step %u/%u: checking SWWAN interface %u status...",
|
||||
ctx->step, DISCONNECT_3GPP_CONTEXT_STEP_LAST,
|
||||
usb_interface_configs[ctx->usb_interface_config_index].swwan_index);
|
||||
load_connection_status_by_cid (MM_BROADBAND_BEARER_CINTERION (ctx->self),
|
||||
(gint) ctx->cid,
|
||||
TRUE,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback) disconnect_connection_status_ready,
|
||||
task);
|
||||
return;
|
||||
|
||||
case DISCONNECT_3GPP_CONTEXT_STEP_LAST:
|
||||
mm_obj_dbg (self, "disconnect step %u/%u: finished",
|
||||
ctx->step, DISCONNECT_3GPP_CONTEXT_STEP_LAST);
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_3gpp (MMBroadbandBearer *self,
|
||||
MMBroadbandModem *modem,
|
||||
MMPortSerialAt *primary,
|
||||
MMPortSerialAt *secondary,
|
||||
MMPort *data,
|
||||
guint cid,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
Disconnect3gppContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
g_assert (primary != NULL);
|
||||
g_assert (data != NULL);
|
||||
|
||||
/* Setup task and create connection context */
|
||||
task = g_task_new (self, NULL, callback, user_data);
|
||||
ctx = g_slice_new0 (Disconnect3gppContext);
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify) disconnect_3gpp_context_free);
|
||||
|
||||
/* Setup context */
|
||||
ctx->self = MM_BROADBAND_BEARER_CINTERION (g_object_ref (self));
|
||||
ctx->modem = MM_BASE_MODEM (g_object_ref (modem));
|
||||
ctx->primary = g_object_ref (primary);
|
||||
ctx->data = g_object_ref (data);
|
||||
ctx->cid = cid;
|
||||
ctx->step = DISCONNECT_3GPP_CONTEXT_STEP_FIRST;
|
||||
|
||||
/* Validate configuration */
|
||||
ctx->usb_interface_config_index = get_usb_interface_config_index (data, &error);
|
||||
if (ctx->usb_interface_config_index < 0) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Start */
|
||||
disconnect_3gpp_context_step (task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Setup and Init Bearers */
|
||||
|
||||
MMBaseBearer *
|
||||
mm_broadband_bearer_cinterion_new_finish (GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
GObject *bearer;
|
||||
GObject *source;
|
||||
|
||||
source = g_async_result_get_source_object (res);
|
||||
bearer = g_async_initable_new_finish (G_ASYNC_INITABLE (source), res, error);
|
||||
g_object_unref (source);
|
||||
|
||||
if (!bearer)
|
||||
return NULL;
|
||||
|
||||
/* Only export valid bearers */
|
||||
mm_base_bearer_export (MM_BASE_BEARER (bearer));
|
||||
|
||||
return MM_BASE_BEARER (bearer);
|
||||
}
|
||||
|
||||
void
|
||||
mm_broadband_bearer_cinterion_new (MMBroadbandModemCinterion *modem,
|
||||
MMBearerProperties *config,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_async_initable_new_async (
|
||||
MM_TYPE_BROADBAND_BEARER_CINTERION,
|
||||
G_PRIORITY_DEFAULT,
|
||||
cancellable,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_BEARER_MODEM, modem,
|
||||
MM_BASE_BEARER_CONFIG, config,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_bearer_cinterion_init (MMBroadbandBearerCinterion *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_bearer_cinterion_class_init (MMBroadbandBearerCinterionClass *klass)
|
||||
{
|
||||
MMBaseBearerClass *base_bearer_class = MM_BASE_BEARER_CLASS (klass);
|
||||
MMBroadbandBearerClass *broadband_bearer_class = MM_BROADBAND_BEARER_CLASS (klass);
|
||||
|
||||
base_bearer_class->load_connection_status = load_connection_status;
|
||||
base_bearer_class->load_connection_status_finish = load_connection_status_finish;
|
||||
#if defined WITH_SUSPEND_RESUME
|
||||
base_bearer_class->reload_connection_status = load_connection_status;
|
||||
base_bearer_class->reload_connection_status_finish = load_connection_status_finish;
|
||||
#endif
|
||||
|
||||
broadband_bearer_class->dial_3gpp = dial_3gpp;
|
||||
broadband_bearer_class->dial_3gpp_finish = dial_3gpp_finish;
|
||||
broadband_bearer_class->disconnect_3gpp = disconnect_3gpp;
|
||||
broadband_bearer_class->disconnect_3gpp_finish = disconnect_3gpp_finish;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2016 Trimble Navigation Limited
|
||||
* Author: Matthew Stanger <Matthew_Stanger@trimble.com>
|
||||
*/
|
||||
|
||||
#ifndef MM_BROADBAND_BEARER_CINTERION_H
|
||||
#define MM_BROADBAND_BEARER_CINTERION_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "mm-broadband-bearer.h"
|
||||
#include "mm-broadband-modem-cinterion.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_BEARER_CINTERION (mm_broadband_bearer_cinterion_get_type ())
|
||||
#define MM_BROADBAND_BEARER_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_BEARER_CINTERION, MMBroadbandBearerCinterion))
|
||||
#define MM_BROADBAND_BEARER_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_BEARER_CINTERION, MMBroadbandBearerCinterionClass))
|
||||
#define MM_IS_BROADBAND_BEARER_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_BEARER_CINTERION))
|
||||
#define MM_IS_BROADBAND_BEARER_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_BEARER_CINTERION))
|
||||
#define MM_BROADBAND_BEARER_CINTERION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_BEARER_CINTERION, MMBroadbandBearerCinterionClass))
|
||||
|
||||
typedef struct _MMBroadbandBearerCinterion MMBroadbandBearerCinterion;
|
||||
typedef struct _MMBroadbandBearerCinterionClass MMBroadbandBearerCinterionClass;
|
||||
|
||||
struct _MMBroadbandBearerCinterion {
|
||||
MMBroadbandBearer parent;
|
||||
};
|
||||
|
||||
struct _MMBroadbandBearerCinterionClass {
|
||||
MMBroadbandBearerClass parent;
|
||||
};
|
||||
|
||||
GType mm_broadband_bearer_cinterion_get_type (void);
|
||||
|
||||
void mm_broadband_bearer_cinterion_new (MMBroadbandModemCinterion *modem,
|
||||
MMBearerProperties *config,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
MMBaseBearer *mm_broadband_bearer_cinterion_new_finish (GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
#endif /* MM_BROADBAND_BEARER_CINTERION_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2011 Ammonit Measurement GmbH
|
||||
* Copyright (C) 2011 Google Inc.
|
||||
* Author: Aleksander Morgado <aleksander@lanedo.com>
|
||||
*/
|
||||
|
||||
#ifndef MM_BROADBAND_MODEM_CINTERION_H
|
||||
#define MM_BROADBAND_MODEM_CINTERION_H
|
||||
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-modem-helpers-cinterion.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_MODEM_CINTERION (mm_broadband_modem_cinterion_get_type ())
|
||||
#define MM_BROADBAND_MODEM_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_CINTERION, MMBroadbandModemCinterion))
|
||||
#define MM_BROADBAND_MODEM_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_CINTERION, MMBroadbandModemCinterionClass))
|
||||
#define MM_IS_BROADBAND_MODEM_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_CINTERION))
|
||||
#define MM_IS_BROADBAND_MODEM_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_CINTERION))
|
||||
#define MM_BROADBAND_MODEM_CINTERION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_CINTERION, MMBroadbandModemCinterionClass))
|
||||
|
||||
typedef struct _MMBroadbandModemCinterion MMBroadbandModemCinterion;
|
||||
typedef struct _MMBroadbandModemCinterionClass MMBroadbandModemCinterionClass;
|
||||
typedef struct _MMBroadbandModemCinterionPrivate MMBroadbandModemCinterionPrivate;
|
||||
|
||||
struct _MMBroadbandModemCinterion {
|
||||
MMBroadbandModem parent;
|
||||
MMBroadbandModemCinterionPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MMBroadbandModemCinterionClass{
|
||||
MMBroadbandModemClass parent;
|
||||
};
|
||||
|
||||
GType mm_broadband_modem_cinterion_get_type (void);
|
||||
|
||||
MMBroadbandModemCinterion *mm_broadband_modem_cinterion_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id);
|
||||
|
||||
MMCinterionModemFamily mm_broadband_modem_cinterion_get_family (MMBroadbandModemCinterion * modem);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_CINTERION_H */
|
||||
@@ -0,0 +1,167 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2021 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log.h"
|
||||
#include "mm-errors-types.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-location.h"
|
||||
#include "mm-iface-modem-voice.h"
|
||||
#include "mm-broadband-modem-mbim-cinterion.h"
|
||||
#include "mm-shared-cinterion.h"
|
||||
|
||||
static void iface_modem_init (MMIfaceModem *iface);
|
||||
static void iface_modem_location_init (MMIfaceModemLocation *iface);
|
||||
static void iface_modem_voice_init (MMIfaceModemVoice *iface);
|
||||
static void iface_modem_time_init (MMIfaceModemTime *iface);
|
||||
static void shared_cinterion_init (MMSharedCinterion *iface);
|
||||
|
||||
static MMIfaceModem *iface_modem_parent;
|
||||
static MMIfaceModemLocation *iface_modem_location_parent;
|
||||
static MMIfaceModemVoice *iface_modem_voice_parent;
|
||||
static MMIfaceModemTime *iface_modem_time_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbimCinterion, mm_broadband_modem_mbim_cinterion, MM_TYPE_BROADBAND_MODEM_MBIM, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_VOICE, iface_modem_voice_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_TIME, iface_modem_time_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_CINTERION, shared_cinterion_init))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMBroadbandModemMbimCinterion *
|
||||
mm_broadband_modem_mbim_cinterion_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id)
|
||||
{
|
||||
return g_object_new (MM_TYPE_BROADBAND_MODEM_MBIM_CINTERION,
|
||||
MM_BASE_MODEM_DEVICE, device,
|
||||
MM_BASE_MODEM_DRIVERS, drivers,
|
||||
MM_BASE_MODEM_PLUGIN, plugin,
|
||||
MM_BASE_MODEM_VENDOR_ID, vendor_id,
|
||||
MM_BASE_MODEM_PRODUCT_ID, product_id,
|
||||
/* MBIM bearer supports NET only */
|
||||
MM_BASE_MODEM_DATA_NET_SUPPORTED, TRUE,
|
||||
MM_BASE_MODEM_DATA_TTY_SUPPORTED, FALSE,
|
||||
MM_IFACE_MODEM_SIM_HOT_SWAP_SUPPORTED, TRUE,
|
||||
MM_BROADBAND_MODEM_MBIM_INTEL_FIRMWARE_UPDATE_UNSUPPORTED, TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_mbim_cinterion_init (MMBroadbandModemMbimCinterion *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_init (MMIfaceModem *iface)
|
||||
{
|
||||
iface_modem_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->reset = mm_shared_cinterion_modem_reset;
|
||||
iface->reset_finish = mm_shared_cinterion_modem_reset_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModem *
|
||||
peek_parent_interface (MMSharedCinterion *self)
|
||||
{
|
||||
return iface_modem_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_location_init (MMIfaceModemLocation *iface)
|
||||
{
|
||||
iface_modem_location_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->load_capabilities = mm_shared_cinterion_location_load_capabilities;
|
||||
iface->load_capabilities_finish = mm_shared_cinterion_location_load_capabilities_finish;
|
||||
iface->enable_location_gathering = mm_shared_cinterion_enable_location_gathering;
|
||||
iface->enable_location_gathering_finish = mm_shared_cinterion_enable_location_gathering_finish;
|
||||
iface->disable_location_gathering = mm_shared_cinterion_disable_location_gathering;
|
||||
iface->disable_location_gathering_finish = mm_shared_cinterion_disable_location_gathering_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModemLocation *
|
||||
peek_parent_location_interface (MMSharedCinterion *self)
|
||||
{
|
||||
return iface_modem_location_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_voice_init (MMIfaceModemVoice *iface)
|
||||
{
|
||||
iface_modem_voice_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->create_call = mm_shared_cinterion_create_call;
|
||||
|
||||
iface->check_support = mm_shared_cinterion_voice_check_support;
|
||||
iface->check_support_finish = mm_shared_cinterion_voice_check_support_finish;
|
||||
iface->enable_unsolicited_events = mm_shared_cinterion_voice_enable_unsolicited_events;
|
||||
iface->enable_unsolicited_events_finish = mm_shared_cinterion_voice_enable_unsolicited_events_finish;
|
||||
iface->disable_unsolicited_events = mm_shared_cinterion_voice_disable_unsolicited_events;
|
||||
iface->disable_unsolicited_events_finish = mm_shared_cinterion_voice_disable_unsolicited_events_finish;
|
||||
iface->setup_unsolicited_events = mm_shared_cinterion_voice_setup_unsolicited_events;
|
||||
iface->setup_unsolicited_events_finish = mm_shared_cinterion_voice_setup_unsolicited_events_finish;
|
||||
iface->cleanup_unsolicited_events = mm_shared_cinterion_voice_cleanup_unsolicited_events;
|
||||
iface->cleanup_unsolicited_events_finish = mm_shared_cinterion_voice_cleanup_unsolicited_events_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModemVoice *
|
||||
peek_parent_voice_interface (MMSharedCinterion *self)
|
||||
{
|
||||
return iface_modem_voice_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_time_init (MMIfaceModemTime *iface)
|
||||
{
|
||||
iface_modem_time_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->setup_unsolicited_events = mm_shared_cinterion_time_setup_unsolicited_events;
|
||||
iface->setup_unsolicited_events_finish = mm_shared_cinterion_time_setup_unsolicited_events_finish;
|
||||
iface->cleanup_unsolicited_events = mm_shared_cinterion_time_cleanup_unsolicited_events;
|
||||
iface->cleanup_unsolicited_events_finish = mm_shared_cinterion_time_cleanup_unsolicited_events_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModemTime *
|
||||
peek_parent_time_interface (MMSharedCinterion *self)
|
||||
{
|
||||
return iface_modem_time_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
shared_cinterion_init (MMSharedCinterion *iface)
|
||||
{
|
||||
iface->peek_parent_interface = peek_parent_interface;
|
||||
iface->peek_parent_location_interface = peek_parent_location_interface;
|
||||
iface->peek_parent_voice_interface = peek_parent_voice_interface;
|
||||
iface->peek_parent_time_interface = peek_parent_time_interface;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_mbim_cinterion_class_init (MMBroadbandModemMbimCinterionClass *klass)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2021 Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#ifndef MM_BROADBAND_MODEM_MBIM_CINTERION_MBIM_H
|
||||
#define MM_BROADBAND_MODEM_MBIM_CINTERION_MBIM_H
|
||||
|
||||
#include "mm-broadband-modem-mbim.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_MODEM_MBIM_CINTERION (mm_broadband_modem_mbim_cinterion_get_type ())
|
||||
#define MM_BROADBAND_MODEM_MBIM_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_CINTERION, MMBroadbandModemMbimCinterion))
|
||||
#define MM_BROADBAND_MODEM_MBIM_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_CINTERION, MMBroadbandModemMbimCinterionClass))
|
||||
#define MM_IS_BROADBAND_MODEM_MBIM_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_CINTERION))
|
||||
#define MM_IS_BROADBAND_MODEM_MBIM_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_MBIM_CINTERION))
|
||||
#define MM_BROADBAND_MODEM_MBIM_CINTERION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_MBIM_CINTERION, MMBroadbandModemMbimCinterionClass))
|
||||
|
||||
typedef struct _MMBroadbandModemMbimCinterion MMBroadbandModemMbimCinterion;
|
||||
typedef struct _MMBroadbandModemMbimCinterionClass MMBroadbandModemMbimCinterionClass;
|
||||
|
||||
struct _MMBroadbandModemMbimCinterion {
|
||||
MMBroadbandModemMbim parent;
|
||||
};
|
||||
|
||||
struct _MMBroadbandModemMbimCinterionClass{
|
||||
MMBroadbandModemMbimClass parent;
|
||||
};
|
||||
|
||||
GType mm_broadband_modem_mbim_cinterion_get_type (void);
|
||||
|
||||
MMBroadbandModemMbimCinterion *mm_broadband_modem_mbim_cinterion_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_MBIM_CINTERION_H */
|
||||
@@ -0,0 +1,167 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2014 Ammonit Measurement GmbH
|
||||
* Author: Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log.h"
|
||||
#include "mm-errors-types.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-location.h"
|
||||
#include "mm-iface-modem-voice.h"
|
||||
#include "mm-broadband-modem-qmi-cinterion.h"
|
||||
#include "mm-shared-cinterion.h"
|
||||
|
||||
static void iface_modem_init (MMIfaceModem *iface);
|
||||
static void iface_modem_location_init (MMIfaceModemLocation *iface);
|
||||
static void iface_modem_voice_init (MMIfaceModemVoice *iface);
|
||||
static void iface_modem_time_init (MMIfaceModemTime *iface);
|
||||
static void shared_cinterion_init (MMSharedCinterion *iface);
|
||||
|
||||
static MMIfaceModem *iface_modem_parent;
|
||||
static MMIfaceModemLocation *iface_modem_location_parent;
|
||||
static MMIfaceModemVoice *iface_modem_voice_parent;
|
||||
static MMIfaceModemTime *iface_modem_time_parent;
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (MMBroadbandModemQmiCinterion, mm_broadband_modem_qmi_cinterion, MM_TYPE_BROADBAND_MODEM_QMI, 0,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_VOICE, iface_modem_voice_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_TIME, iface_modem_time_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_CINTERION, shared_cinterion_init))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
MMBroadbandModemQmiCinterion *
|
||||
mm_broadband_modem_qmi_cinterion_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id)
|
||||
{
|
||||
return g_object_new (MM_TYPE_BROADBAND_MODEM_QMI_CINTERION,
|
||||
MM_BASE_MODEM_DEVICE, device,
|
||||
MM_BASE_MODEM_DRIVERS, drivers,
|
||||
MM_BASE_MODEM_PLUGIN, plugin,
|
||||
MM_BASE_MODEM_VENDOR_ID, vendor_id,
|
||||
MM_BASE_MODEM_PRODUCT_ID, product_id,
|
||||
/* QMI bearer supports NET only */
|
||||
MM_BASE_MODEM_DATA_NET_SUPPORTED, TRUE,
|
||||
MM_BASE_MODEM_DATA_TTY_SUPPORTED, FALSE,
|
||||
MM_IFACE_MODEM_SIM_HOT_SWAP_SUPPORTED, TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_qmi_cinterion_init (MMBroadbandModemQmiCinterion *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_init (MMIfaceModem *iface)
|
||||
{
|
||||
iface_modem_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->reset = mm_shared_cinterion_modem_reset;
|
||||
iface->reset_finish = mm_shared_cinterion_modem_reset_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModem *
|
||||
peek_parent_interface (MMSharedCinterion *self)
|
||||
{
|
||||
return iface_modem_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_location_init (MMIfaceModemLocation *iface)
|
||||
{
|
||||
iface_modem_location_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->load_capabilities = mm_shared_cinterion_location_load_capabilities;
|
||||
iface->load_capabilities_finish = mm_shared_cinterion_location_load_capabilities_finish;
|
||||
iface->enable_location_gathering = mm_shared_cinterion_enable_location_gathering;
|
||||
iface->enable_location_gathering_finish = mm_shared_cinterion_enable_location_gathering_finish;
|
||||
iface->disable_location_gathering = mm_shared_cinterion_disable_location_gathering;
|
||||
iface->disable_location_gathering_finish = mm_shared_cinterion_disable_location_gathering_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModemLocation *
|
||||
peek_parent_location_interface (MMSharedCinterion *self)
|
||||
{
|
||||
return iface_modem_location_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_voice_init (MMIfaceModemVoice *iface)
|
||||
{
|
||||
iface_modem_voice_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->create_call = mm_shared_cinterion_create_call;
|
||||
|
||||
iface->check_support = mm_shared_cinterion_voice_check_support;
|
||||
iface->check_support_finish = mm_shared_cinterion_voice_check_support_finish;
|
||||
iface->enable_unsolicited_events = mm_shared_cinterion_voice_enable_unsolicited_events;
|
||||
iface->enable_unsolicited_events_finish = mm_shared_cinterion_voice_enable_unsolicited_events_finish;
|
||||
iface->disable_unsolicited_events = mm_shared_cinterion_voice_disable_unsolicited_events;
|
||||
iface->disable_unsolicited_events_finish = mm_shared_cinterion_voice_disable_unsolicited_events_finish;
|
||||
iface->setup_unsolicited_events = mm_shared_cinterion_voice_setup_unsolicited_events;
|
||||
iface->setup_unsolicited_events_finish = mm_shared_cinterion_voice_setup_unsolicited_events_finish;
|
||||
iface->cleanup_unsolicited_events = mm_shared_cinterion_voice_cleanup_unsolicited_events;
|
||||
iface->cleanup_unsolicited_events_finish = mm_shared_cinterion_voice_cleanup_unsolicited_events_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModemVoice *
|
||||
peek_parent_voice_interface (MMSharedCinterion *self)
|
||||
{
|
||||
return iface_modem_voice_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
iface_modem_time_init (MMIfaceModemTime *iface)
|
||||
{
|
||||
iface_modem_time_parent = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->setup_unsolicited_events = mm_shared_cinterion_time_setup_unsolicited_events;
|
||||
iface->setup_unsolicited_events_finish = mm_shared_cinterion_time_setup_unsolicited_events_finish;
|
||||
iface->cleanup_unsolicited_events = mm_shared_cinterion_time_cleanup_unsolicited_events;
|
||||
iface->cleanup_unsolicited_events_finish = mm_shared_cinterion_time_cleanup_unsolicited_events_finish;
|
||||
}
|
||||
|
||||
static MMIfaceModemTime *
|
||||
peek_parent_time_interface (MMSharedCinterion *self)
|
||||
{
|
||||
return iface_modem_time_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
shared_cinterion_init (MMSharedCinterion *iface)
|
||||
{
|
||||
iface->peek_parent_interface = peek_parent_interface;
|
||||
iface->peek_parent_location_interface = peek_parent_location_interface;
|
||||
iface->peek_parent_voice_interface = peek_parent_voice_interface;
|
||||
iface->peek_parent_time_interface = peek_parent_time_interface;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_broadband_modem_qmi_cinterion_class_init (MMBroadbandModemQmiCinterionClass *klass)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2014 Ammonit Measurement GmbH
|
||||
* Author: Aleksander Morgado <aleksander@aleksander.es>
|
||||
*/
|
||||
|
||||
#ifndef MM_BROADBAND_MODEM_QMI_CINTERION_QMI_H
|
||||
#define MM_BROADBAND_MODEM_QMI_CINTERION_QMI_H
|
||||
|
||||
#include "mm-broadband-modem-qmi.h"
|
||||
|
||||
#define MM_TYPE_BROADBAND_MODEM_QMI_CINTERION (mm_broadband_modem_qmi_cinterion_get_type ())
|
||||
#define MM_BROADBAND_MODEM_QMI_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM_QMI_CINTERION, MMBroadbandModemQmiCinterion))
|
||||
#define MM_BROADBAND_MODEM_QMI_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BROADBAND_MODEM_QMI_CINTERION, MMBroadbandModemQmiCinterionClass))
|
||||
#define MM_IS_BROADBAND_MODEM_QMI_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BROADBAND_MODEM_QMI_CINTERION))
|
||||
#define MM_IS_BROADBAND_MODEM_QMI_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BROADBAND_MODEM_QMI_CINTERION))
|
||||
#define MM_BROADBAND_MODEM_QMI_CINTERION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BROADBAND_MODEM_QMI_CINTERION, MMBroadbandModemQmiCinterionClass))
|
||||
|
||||
typedef struct _MMBroadbandModemQmiCinterion MMBroadbandModemQmiCinterion;
|
||||
typedef struct _MMBroadbandModemQmiCinterionClass MMBroadbandModemQmiCinterionClass;
|
||||
|
||||
struct _MMBroadbandModemQmiCinterion {
|
||||
MMBroadbandModemQmi parent;
|
||||
};
|
||||
|
||||
struct _MMBroadbandModemQmiCinterionClass{
|
||||
MMBroadbandModemQmiClass parent;
|
||||
};
|
||||
|
||||
GType mm_broadband_modem_qmi_cinterion_get_type (void);
|
||||
|
||||
MMBroadbandModemQmiCinterion *mm_broadband_modem_qmi_cinterion_new (const gchar *device,
|
||||
const gchar **drivers,
|
||||
const gchar *plugin,
|
||||
guint16 vendor_id,
|
||||
guint16 product_id);
|
||||
|
||||
#endif /* MM_BROADBAND_MODEM_QMI_CINTERION_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,211 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2014 Aleksander Morgado <aleksander@aleksander.es>
|
||||
* Copyright (C) 2016 Trimble Navigation Limited
|
||||
* Copyright (C) 2016 Matthew Stanger <matthew_stanger@trimble.com>
|
||||
* Copyright (C) 2019 Purism SPC
|
||||
*/
|
||||
|
||||
#ifndef MM_MODEM_HELPERS_CINTERION_H
|
||||
#define MM_MODEM_HELPERS_CINTERION_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <ModemManager.h>
|
||||
#include <mm-base-bearer.h>
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
typedef enum {
|
||||
MM_CINTERION_MODEM_FAMILY_DEFAULT = 0,
|
||||
MM_CINTERION_MODEM_FAMILY_IMT = 1,
|
||||
} MMCinterionModemFamily;
|
||||
|
||||
typedef enum {
|
||||
MM_CINTERION_RADIO_BAND_FORMAT_SINGLE = 0,
|
||||
MM_CINTERION_RADIO_BAND_FORMAT_MULTIPLE = 1,
|
||||
} MMCinterionRadioBandFormat;
|
||||
|
||||
typedef enum {
|
||||
MM_CINTERION_RB_BLOCK_LEGACY = 0,
|
||||
MM_CINTERION_RB_BLOCK_GSM = 0,
|
||||
MM_CINTERION_RB_BLOCK_UMTS = 1,
|
||||
MM_CINTERION_RB_BLOCK_LTE_LOW = 2,
|
||||
MM_CINTERION_RB_BLOCK_LTE_HIGH = 3,
|
||||
MM_CINTERION_RB_BLOCK_N = 4
|
||||
} MMCinterionRbBlock;
|
||||
|
||||
typedef enum {
|
||||
MM_CINTERION_RADIO_GEN_NONE = 0,
|
||||
MM_CINTERION_RADIO_GEN_2G = 2,
|
||||
MM_CINTERION_RADIO_GEN_3G = 3,
|
||||
MM_CINTERION_RADIO_GEN_4G = 4,
|
||||
} MMCinterionRadioGen;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SCFG test parser */
|
||||
|
||||
gboolean mm_cinterion_parse_scfg_test (const gchar *response,
|
||||
MMCinterionModemFamily modem_family,
|
||||
MMModemCharset charset,
|
||||
GArray **supported_bands,
|
||||
MMCinterionRadioBandFormat *format,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SCFG response parser */
|
||||
|
||||
gboolean mm_cinterion_parse_scfg_response (const gchar *response,
|
||||
MMCinterionModemFamily modem_family,
|
||||
MMModemCharset charset,
|
||||
GArray **bands,
|
||||
MMCinterionRadioBandFormat format,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* +CNMI test parser */
|
||||
|
||||
gboolean mm_cinterion_parse_cnmi_test (const gchar *response,
|
||||
GArray **supported_mode,
|
||||
GArray **supported_mt,
|
||||
GArray **supported_bm,
|
||||
GArray **supported_ds,
|
||||
GArray **supported_bfr,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SXRAT test parser */
|
||||
|
||||
gboolean mm_cinterion_parse_sxrat_test (const gchar *response,
|
||||
GArray **supported_rat,
|
||||
GArray **supported_pref1,
|
||||
GArray **supported_pref2,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Build Cinterion-specific band value */
|
||||
|
||||
gboolean mm_cinterion_build_band (GArray *bands,
|
||||
guint *supported,
|
||||
gboolean only_2g,
|
||||
MMCinterionRadioBandFormat format,
|
||||
MMCinterionModemFamily modem_family,
|
||||
guint *out_band,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Single ^SIND response parser */
|
||||
|
||||
gboolean mm_cinterion_parse_sind_response (const gchar *response,
|
||||
gchar **description,
|
||||
guint *mode,
|
||||
guint *value,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SWWAN response parser */
|
||||
|
||||
MMBearerConnectionStatus mm_cinterion_parse_swwan_response (const gchar *response,
|
||||
guint swwan_index,
|
||||
gpointer log_object,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SGAUTH response parser */
|
||||
|
||||
gboolean mm_cinterion_parse_sgauth_response (const gchar *response,
|
||||
guint cid,
|
||||
MMBearerAllowedAuth *out_auth,
|
||||
gchar **out_username,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SMONG response parser */
|
||||
|
||||
gboolean mm_cinterion_parse_smong_response (const gchar *response,
|
||||
MMModemAccessTechnology *access_tech,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SIND psinfo helper */
|
||||
|
||||
MMModemAccessTechnology mm_cinterion_get_access_technology_from_sind_psinfo (guint val,
|
||||
gpointer log_object);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SLCC URC helpers */
|
||||
|
||||
GRegex *mm_cinterion_get_slcc_regex (void);
|
||||
|
||||
/* MMCallInfo list management */
|
||||
gboolean mm_cinterion_parse_slcc_list (const gchar *str,
|
||||
gpointer log_object,
|
||||
GList **out_list,
|
||||
GError **error);
|
||||
void mm_cinterion_call_info_list_free (GList *call_info_list);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* +CTZU URC helpers */
|
||||
|
||||
GRegex *mm_cinterion_get_ctzu_regex (void);
|
||||
gboolean mm_cinterion_parse_ctzu_urc (GMatchInfo *match_info,
|
||||
gchar **iso8601p,
|
||||
MMNetworkTimezone **tzp,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SMONI helper */
|
||||
|
||||
gboolean mm_cinterion_parse_smoni_query_response (const gchar *response,
|
||||
MMCinterionRadioGen *out_tech,
|
||||
gdouble *out_rssi,
|
||||
gdouble *out_ecn0,
|
||||
gdouble *out_rscp,
|
||||
gdouble *out_rsrp,
|
||||
gdouble *out_rsrq,
|
||||
GError **error);
|
||||
|
||||
gboolean mm_cinterion_smoni_response_to_signal_info (const gchar *response,
|
||||
MMSignal **out_gsm,
|
||||
MMSignal **out_umts,
|
||||
MMSignal **out_lte,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SCFG="MEopMode/Prov/Cfg" helper */
|
||||
|
||||
gboolean mm_cinterion_provcfg_response_to_cid (const gchar *response,
|
||||
MMCinterionModemFamily modem_family,
|
||||
MMModemCharset charset,
|
||||
gpointer log_object,
|
||||
gint *cid,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Auth related helpers */
|
||||
|
||||
MMBearerAllowedAuth mm_auth_type_from_cinterion_auth_type (guint cinterion_auth);
|
||||
|
||||
gchar *mm_cinterion_build_auth_string (gpointer log_object,
|
||||
MMCinterionModemFamily modem_family,
|
||||
MMBearerProperties *config,
|
||||
guint cid);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ^SXRAT set command helper */
|
||||
|
||||
gchar *mm_cinterion_build_sxrat_set_command (MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GError **error);
|
||||
|
||||
#endif /* MM_MODEM_HELPERS_CINTERION_H */
|
||||
@@ -0,0 +1,218 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (C) 2011 Ammonit Measurement GmbH
|
||||
* Copyright (C) 2011 - 2012 Google Inc.
|
||||
* Author: Aleksander Morgado <aleksander@lanedo.com>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-plugin-cinterion.h"
|
||||
#include "mm-broadband-modem-cinterion.h"
|
||||
#include "mm-log-object.h"
|
||||
|
||||
#if defined WITH_QMI
|
||||
#include "mm-broadband-modem-qmi-cinterion.h"
|
||||
#endif
|
||||
|
||||
#if defined WITH_MBIM
|
||||
#include "mm-broadband-modem-mbim-cinterion.h"
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE (MMPluginCinterion, mm_plugin_cinterion, MM_TYPE_PLUGIN)
|
||||
|
||||
MM_PLUGIN_DEFINE_MAJOR_VERSION
|
||||
MM_PLUGIN_DEFINE_MINOR_VERSION
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Custom init */
|
||||
|
||||
#define TAG_CINTERION_APP_PORT "cinterion-app-port"
|
||||
#define TAG_CINTERION_MODEM_PORT "cinterion-modem-port"
|
||||
|
||||
static gboolean
|
||||
cinterion_custom_init_finish (MMPortProbe *probe,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static void
|
||||
sqport_ready (MMPortSerialAt *port,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
MMPortProbe *probe;
|
||||
const gchar *response;
|
||||
|
||||
probe = g_task_get_source_object (task);
|
||||
|
||||
/* Ignore errors, just avoid tagging */
|
||||
response = mm_port_serial_at_command_finish (port, res, NULL);
|
||||
if (response) {
|
||||
/* A valid reply to AT^SQPORT tells us this is an AT port already */
|
||||
mm_port_probe_set_result_at (probe, TRUE);
|
||||
|
||||
if (strstr (response, "Application"))
|
||||
g_object_set_data (G_OBJECT (probe), TAG_CINTERION_APP_PORT, GUINT_TO_POINTER (TRUE));
|
||||
else if (strstr (response, "Modem"))
|
||||
g_object_set_data (G_OBJECT (probe), TAG_CINTERION_MODEM_PORT, GUINT_TO_POINTER (TRUE));
|
||||
}
|
||||
|
||||
g_task_return_boolean (task, TRUE);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
cinterion_custom_init (MMPortProbe *probe,
|
||||
MMPortSerialAt *port,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (probe, cancellable, callback, user_data);
|
||||
|
||||
mm_port_serial_at_command (
|
||||
port,
|
||||
"AT^SQPORT?",
|
||||
3,
|
||||
FALSE, /* raw */
|
||||
FALSE, /* allow cached */
|
||||
cancellable,
|
||||
(GAsyncReadyCallback) sqport_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static MMBaseModem *
|
||||
create_modem (MMPlugin *self,
|
||||
const gchar *uid,
|
||||
const gchar **drivers,
|
||||
guint16 vendor,
|
||||
guint16 product,
|
||||
guint16 subsystem_vendor,
|
||||
GList *probes,
|
||||
GError **error)
|
||||
{
|
||||
#if defined WITH_QMI
|
||||
if (mm_port_probe_list_has_qmi_port (probes)) {
|
||||
mm_obj_dbg (self, "QMI-powered Cinterion modem found...");
|
||||
return MM_BASE_MODEM (mm_broadband_modem_qmi_cinterion_new (uid,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined WITH_MBIM
|
||||
if (mm_port_probe_list_has_mbim_port (probes)) {
|
||||
mm_obj_dbg (self, "MBIM-powered Cinterion modem found...");
|
||||
return MM_BASE_MODEM (mm_broadband_modem_mbim_cinterion_new (uid,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
#endif
|
||||
|
||||
return MM_BASE_MODEM (mm_broadband_modem_cinterion_new (uid,
|
||||
drivers,
|
||||
mm_plugin_get_name (self),
|
||||
vendor,
|
||||
product));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
grab_port (MMPlugin *self,
|
||||
MMBaseModem *modem,
|
||||
MMPortProbe *probe,
|
||||
GError **error)
|
||||
{
|
||||
MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE;
|
||||
MMPortType ptype;
|
||||
|
||||
ptype = mm_port_probe_get_port_type (probe);
|
||||
|
||||
if (g_object_get_data (G_OBJECT (probe), TAG_CINTERION_APP_PORT)) {
|
||||
mm_obj_dbg (self, "port '%s/%s' flagged as primary",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
pflags = MM_PORT_SERIAL_AT_FLAG_PRIMARY;
|
||||
} else if (g_object_get_data (G_OBJECT (probe), TAG_CINTERION_MODEM_PORT)) {
|
||||
mm_obj_dbg (self, "port '%s/%s' flagged as PPP",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
pflags = MM_PORT_SERIAL_AT_FLAG_PPP;
|
||||
}
|
||||
|
||||
return mm_base_modem_grab_port (modem,
|
||||
mm_port_probe_peek_port (probe),
|
||||
ptype,
|
||||
pflags,
|
||||
error);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
G_MODULE_EXPORT MMPlugin *
|
||||
mm_plugin_create (void)
|
||||
{
|
||||
static const gchar *subsystems[] = { "tty", "net", "usbmisc", "wwan", NULL };
|
||||
static const gchar *vendor_strings[] = { "cinterion", "siemens", NULL };
|
||||
static const guint16 vendor_ids[] = { 0x1e2d, 0x0681, 0x1269, 0 };
|
||||
static const MMAsyncMethod custom_init = {
|
||||
.async = G_CALLBACK (cinterion_custom_init),
|
||||
.finish = G_CALLBACK (cinterion_custom_init_finish),
|
||||
};
|
||||
|
||||
return MM_PLUGIN (
|
||||
g_object_new (MM_TYPE_PLUGIN_CINTERION,
|
||||
MM_PLUGIN_NAME, MM_MODULE_NAME,
|
||||
MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
|
||||
MM_PLUGIN_ALLOWED_VENDOR_STRINGS, vendor_strings,
|
||||
MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
|
||||
MM_PLUGIN_ALLOWED_AT, TRUE,
|
||||
MM_PLUGIN_ALLOWED_QMI, TRUE,
|
||||
MM_PLUGIN_ALLOWED_MBIM, TRUE,
|
||||
MM_PLUGIN_CUSTOM_INIT, &custom_init,
|
||||
NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
mm_plugin_cinterion_init (MMPluginCinterion *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mm_plugin_cinterion_class_init (MMPluginCinterionClass *klass)
|
||||
{
|
||||
MMPluginClass *plugin_class = MM_PLUGIN_CLASS (klass);
|
||||
|
||||
plugin_class->create_modem = create_modem;
|
||||
plugin_class->grab_port = grab_port;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (C) 2011 Ammonit Measurement GmbH
|
||||
* Author: Aleksander Morgado <aleksander@lanedo.com>
|
||||
*/
|
||||
|
||||
#ifndef MM_PLUGIN_CINTERION_H
|
||||
#define MM_PLUGIN_CINTERION_H
|
||||
|
||||
#include "mm-plugin.h"
|
||||
|
||||
#define MM_TYPE_PLUGIN_CINTERION (mm_plugin_cinterion_get_type ())
|
||||
#define MM_PLUGIN_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_PLUGIN_CINTERION, MMPluginCinterion))
|
||||
#define MM_PLUGIN_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_PLUGIN_CINTERION, MMPluginCinterionClass))
|
||||
#define MM_IS_PLUGIN_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_PLUGIN_CINTERION))
|
||||
#define MM_IS_PLUGIN_CINTERION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_CINTERION))
|
||||
#define MM_PLUGIN_CINTERION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_CINTERION, MMPluginCinterionClass))
|
||||
|
||||
typedef struct {
|
||||
MMPlugin parent;
|
||||
} MMPluginCinterion;
|
||||
|
||||
typedef struct {
|
||||
MMPluginClass parent;
|
||||
} MMPluginCinterionClass;
|
||||
|
||||
GType mm_plugin_cinterion_get_type (void);
|
||||
|
||||
G_MODULE_EXPORT MMPlugin *mm_plugin_create (void);
|
||||
|
||||
#endif /* MM_PLUGIN_CINTERION_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,153 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* Copyright (C) 2014 Ammonit Measurement GmbH
|
||||
* Copyright (C) 2014 - 2018 Aleksander Morgado <aleksander@aleksander.es>
|
||||
* Copyright (C) 2019 Purism SPC
|
||||
*/
|
||||
|
||||
#ifndef MM_SHARED_CINTERION_H
|
||||
#define MM_SHARED_CINTERION_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-broadband-modem.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-location.h"
|
||||
#include "mm-iface-modem-voice.h"
|
||||
#include "mm-iface-modem-time.h"
|
||||
|
||||
#define MM_TYPE_SHARED_CINTERION (mm_shared_cinterion_get_type ())
|
||||
#define MM_SHARED_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SHARED_CINTERION, MMSharedCinterion))
|
||||
#define MM_IS_SHARED_CINTERION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SHARED_CINTERION))
|
||||
#define MM_SHARED_CINTERION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_SHARED_CINTERION, MMSharedCinterion))
|
||||
|
||||
typedef struct _MMSharedCinterion MMSharedCinterion;
|
||||
|
||||
struct _MMSharedCinterion {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* Peek modem interface of the parent class of the object */
|
||||
MMIfaceModem * (* peek_parent_interface) (MMSharedCinterion *self);
|
||||
|
||||
/* Peek location interface of the parent class of the object */
|
||||
MMIfaceModemLocation * (* peek_parent_location_interface) (MMSharedCinterion *self);
|
||||
|
||||
/* Peek voice interface of the parent class of the object */
|
||||
MMIfaceModemVoice * (* peek_parent_voice_interface) (MMSharedCinterion *self);
|
||||
|
||||
/* Peek time interface of the parent class of the object */
|
||||
MMIfaceModemTime * (* peek_parent_time_interface) (MMSharedCinterion *self);
|
||||
};
|
||||
|
||||
GType mm_shared_cinterion_get_type (void);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Modem interface */
|
||||
|
||||
void mm_shared_cinterion_modem_reset (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_modem_reset_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Location interface */
|
||||
|
||||
void mm_shared_cinterion_location_load_capabilities (MMIfaceModemLocation *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
MMModemLocationSource mm_shared_cinterion_location_load_capabilities_finish (MMIfaceModemLocation *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_shared_cinterion_enable_location_gathering (MMIfaceModemLocation *self,
|
||||
MMModemLocationSource source,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_enable_location_gathering_finish (MMIfaceModemLocation *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_shared_cinterion_disable_location_gathering (MMIfaceModemLocation *self,
|
||||
MMModemLocationSource source,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_disable_location_gathering_finish (MMIfaceModemLocation *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Voice interface */
|
||||
|
||||
MMBaseCall *mm_shared_cinterion_create_call (MMIfaceModemVoice *self,
|
||||
MMCallDirection direction,
|
||||
const gchar *number);
|
||||
|
||||
void mm_shared_cinterion_voice_check_support (MMIfaceModemVoice *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_voice_check_support_finish (MMIfaceModemVoice *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_shared_cinterion_voice_setup_unsolicited_events (MMIfaceModemVoice *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_voice_setup_unsolicited_events_finish (MMIfaceModemVoice *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_shared_cinterion_voice_cleanup_unsolicited_events (MMIfaceModemVoice *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_voice_cleanup_unsolicited_events_finish (MMIfaceModemVoice *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_shared_cinterion_voice_enable_unsolicited_events (MMIfaceModemVoice *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_voice_enable_unsolicited_events_finish (MMIfaceModemVoice *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_shared_cinterion_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_voice_disable_unsolicited_events_finish (MMIfaceModemVoice *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Time interface */
|
||||
|
||||
void mm_shared_cinterion_time_setup_unsolicited_events (MMIfaceModemTime *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_time_setup_unsolicited_events_finish (MMIfaceModemTime *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_shared_cinterion_time_cleanup_unsolicited_events (MMIfaceModemTime *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_shared_cinterion_time_cleanup_unsolicited_events_finish (MMIfaceModemTime *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
#endif /* MM_SHARED_CINTERION_H */
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user