base-bearer: allow reporting uplink/downlink speeds via indications
This commit is contained in:
@@ -473,6 +473,21 @@ bearer_stats_start (MMBaseBearer *self,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
mm_base_bearer_report_speeds (MMBaseBearer *self,
|
||||||
|
guint64 uplink_speed,
|
||||||
|
guint64 downlink_speed)
|
||||||
|
{
|
||||||
|
/* Ignore speeds update if we're not connected */
|
||||||
|
if (self->priv->status != MM_BEARER_STATUS_CONNECTED)
|
||||||
|
return;
|
||||||
|
mm_bearer_stats_set_uplink_speed (self->priv->stats, uplink_speed);
|
||||||
|
mm_bearer_stats_set_downlink_speed (self->priv->stats, downlink_speed);
|
||||||
|
bearer_update_interface_stats (self);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
bearer_reset_interface_status (MMBaseBearer *self)
|
bearer_reset_interface_status (MMBaseBearer *self)
|
||||||
{
|
{
|
||||||
|
@@ -221,6 +221,10 @@ void mm_base_bearer_report_connection_status_detailed (MMBaseBearer
|
|||||||
/* When unknown, just pass NULL */
|
/* When unknown, just pass NULL */
|
||||||
#define mm_base_bearer_report_connection_status(self, status) mm_base_bearer_report_connection_status_detailed (self, status, NULL)
|
#define mm_base_bearer_report_connection_status(self, status) mm_base_bearer_report_connection_status_detailed (self, status, NULL)
|
||||||
|
|
||||||
|
void mm_base_bearer_report_speeds (MMBaseBearer *self,
|
||||||
|
guint64 uplink_speed,
|
||||||
|
guint64 downlink_speed);
|
||||||
|
|
||||||
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
#if defined WITH_SYSTEMD_SUSPEND_RESUME
|
||||||
|
|
||||||
/* Sync Broadband Bearer (async) */
|
/* Sync Broadband Bearer (async) */
|
||||||
|
@@ -3863,6 +3863,24 @@ basic_connect_notification_subscriber_ready_status (MMBroadbandModemMbim *self,
|
|||||||
g_strfreev (telephone_numbers);
|
g_strfreev (telephone_numbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
MMBroadbandModemMbim *self;
|
||||||
|
guint64 uplink_speed;
|
||||||
|
guint64 downlink_speed;
|
||||||
|
} ReportSpeedsContext;
|
||||||
|
|
||||||
|
static void
|
||||||
|
bearer_list_report_speeds (MMBaseBearer *bearer,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
ReportSpeedsContext *ctx = user_data;
|
||||||
|
|
||||||
|
if (MM_IS_BEARER_MBIM (bearer)) {
|
||||||
|
mm_obj_dbg (ctx->self, "bearer '%s' speeds updated", mm_base_bearer_get_path (bearer));
|
||||||
|
mm_base_bearer_report_speeds (bearer, ctx->uplink_speed, ctx->downlink_speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
basic_connect_notification_packet_service (MMBroadbandModemMbim *self,
|
basic_connect_notification_packet_service (MMBroadbandModemMbim *self,
|
||||||
MbimDevice *device,
|
MbimDevice *device,
|
||||||
@@ -3878,6 +3896,7 @@ basic_connect_notification_packet_service (MMBroadbandModemMbim *self,
|
|||||||
g_autofree gchar *frequency_range_str = NULL;
|
g_autofree gchar *frequency_range_str = NULL;
|
||||||
const gchar *nw_error_str;
|
const gchar *nw_error_str;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
g_autoptr(MMBearerList) bearer_list = NULL;
|
||||||
|
|
||||||
if (mbim_device_check_ms_mbimex_version (device, 2, 0)) {
|
if (mbim_device_check_ms_mbimex_version (device, 2, 0)) {
|
||||||
if (!mbim_message_ms_basic_connect_v2_packet_service_notification_parse (
|
if (!mbim_message_ms_basic_connect_v2_packet_service_notification_parse (
|
||||||
@@ -3938,6 +3957,20 @@ basic_connect_notification_packet_service (MMBroadbandModemMbim *self,
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_get (self,
|
||||||
|
MM_IFACE_MODEM_BEARER_LIST, &bearer_list,
|
||||||
|
NULL);
|
||||||
|
if (bearer_list) {
|
||||||
|
ReportSpeedsContext ctx = {
|
||||||
|
.uplink_speed = uplink_speed,
|
||||||
|
.downlink_speed = downlink_speed,
|
||||||
|
};
|
||||||
|
|
||||||
|
mm_bearer_list_foreach (bearer_list,
|
||||||
|
(MMBearerListForeachFunc)bearer_list_report_speeds,
|
||||||
|
&ctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user