Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development'
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed May 23, 2024
2 parents 99bc51d + d56ca35 commit c2afcf8
Show file tree
Hide file tree
Showing 19 changed files with 449 additions and 37 deletions.
14 changes: 11 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# 5GMS Common Android Library

This repository holds the 5GMS Common Library implementation of the 5G-MAG Reference Tools.
<h1 align="center">5GMS Common Android Library</h1>
<p align="center">
<img src="https://img.shields.io/badge/Status-Under_Development-yellow" alt="Under Development">
<img src="https://img.shields.io/github/v/tag/5G-MAG/rt-5gms-common-android-library?label=version" alt="Version">
<img src="https://img.shields.io/badge/License-5G--MAG%20Public%20License%20(v1.0)-blue" alt="License">
</p>

## Introduction

The 5GMS Common Library is an Android library that includes models and helper classes used within
the different client-side Android applications such as the 5GMSd-Aware Application, 5GMSd Media Stream
Handler and the 5GMSd Media Session Handler.

Additional information can be found at: https://5g-mag.github.io/Getting-Started/pages/5g-media-streaming/

## Downloading

Release versions can be downloaded from
Expand Down Expand Up @@ -64,6 +69,9 @@ dependencyResolutionManagement {

#### 2. Include the 5GMS Common Library in your module gradle file

Replace the version number in the example below with the version number you are using,
e.g. `1.2.0` instead of `1.0.0`.

````
dependencies {
// 5GMAG
Expand Down
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
minSdk 29
targetSdk 32
versionCode 1
versionName "1.1.0"
versionName "1.2.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -38,7 +38,7 @@ publishing {
release(MavenPublication) {
groupId = 'com.fivegmag'
artifactId = 'a5gmscommonlibrary'
version = '1.1.0'
version = '1.2.0'

afterEvaluate {
from components.release
Expand All @@ -64,6 +64,8 @@ dependencies {
implementation 'com.google.android.material:material:1.8.0'
implementation "androidx.media3:media3-exoplayer:1.0.2"
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.fivegmag.a5gmscommonlibrary.consumptionReporting

import android.os.Parcelable
import kotlinx.parcelize.Parcelize

@Parcelize
data class ConsumptionRequest(
var accessReporting : Boolean? = false,
var locationReporting : Boolean? = false
) : Parcelable
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
License: 5G-MAG Public License (v1.0)
Author: Daniel Silhavy
Copyright: (C) 2023 Fraunhofer FOKUS
For full license terms please see the LICENSE file distributed with this
program. If this file is missing then the license can be retrieved from
https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view
*/

package com.fivegmag.a5gmscommonlibrary.eventbus

import android.telephony.CellInfo
Expand All @@ -20,6 +29,11 @@ class LoadStartedEvent(
val loadEventInfo: LoadEventInfo,
val mediaLoadData: MediaLoadData
)
class LoadCompletedEvent(
val eventTime: EventTime,
val loadEventInfo: LoadEventInfo,
val mediaLoadData: MediaLoadData
)

class CellInfoUpdatedEvent(
val cellInfoList: MutableList<CellInfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ object SessionHandlerMessageTypes {
const val SERVICE_ACCESS_INFORMATION_MESSAGE = 3
const val REGISTER_CLIENT = 4
const val UNREGISTER_CLIENT = 5
const val START_PLAYBACK_BY_MEDIA_PLAYER_ENTRY_MESSAGE = 6
const val SESSION_HANDLER_TRIGGERS_PLAYBACK = 6
const val METRIC_REPORTING_MESSAGE = 7
const val UPDATE_LOOKUP_TABLE = 8
const val SET_M5_ENDPOINT = 9
const val START_PLAYBACK_BY_SERVICE_LIST_ENTRY_MESSAGE = 10
const val GET_CONSUMPTION_REPORT = 11
const val CONSUMPTION_REPORT = 12
const val UPDATE_PLAYBACK_CONSUMPTION_REPORTING_CONFIGURATION = 13
const val TRIGGER_PLAYBACK = 6
const val UPDATE_LOOKUP_TABLE = 7
const val SET_M5_ENDPOINT = 8
const val START_PLAYBACK_BY_SERVICE_LIST_ENTRY_MESSAGE = 9
const val GET_CONSUMPTION_REPORT = 10
const val CONSUMPTION_REPORT = 11
const val UPDATE_PLAYBACK_CONSUMPTION_REPORTING_CONFIGURATION = 12
const val GET_QOE_METRICS_REPORT = 13
const val REPORT_QOE_METRICS = 14
}

object SessionHandlerEvents {
Expand All @@ -52,6 +52,8 @@ object SessionHandlerEvents {
object ContentTypes {
const val DASH = "application/dash+xml"
const val HLS = "application/vnd.apple.mpegurl"
const val JSON = "application/json"
const val XML = "application/xml"
}

object UserAgentTokens {
Expand All @@ -63,4 +65,25 @@ object HostInfoTypes {
const val IP_V4 = "ipv4"
const val IP_V6 = "ipv6"
const val DOMAIN_NAME = "domain_name"
}

object MetricReportingSchemes {
const val FIVE_G_MAG_EXOPLAYER_COMBINED_PLAYBACK_STATS = "urn:5gmag:exoplayer:combined"
const val THREE_GPP_DASH_METRIC_REPORTING = "urn:3GPP:ns:PSS:DASH:QM10"
}

object Metrics {
const val BUFFER_LEVEL = "urn:3GPP:ns:PSS:DASH:QM10#BufferLevel"
const val HTTP_LIST = "urn:3GPP:ns:PSS:DASH:QM10#HTTPList"
const val REP_SWITCH_LIST = "urn:3GPP:ns:PSS:DASH:QM10#RepSwitchList"
const val MPD_INFORMATION = "urn:3GPP:ns:PSS:DASH:QM10#MPDInformation"
}

object XmlSchemaStrings {
object THREE_GPP_METADATA_2011_HSD_RECEPTION_REPORT {
const val SCHEMA = "urn:3gpp:metadata:2011:HSD:receptionreport"
const val LOCATION = "DASH-QoE-Report.xsd"
const val XSI = "http://www.w3.org/2001/XMLSchema-instance"
const val SV = "urn:3gpp:metadata:2016:PSS:schemaVersion"
}
}
36 changes: 33 additions & 3 deletions app/src/main/java/com/fivegmag/a5gmscommonlibrary/helpers/Utils.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
/*
License: 5G-MAG Public License (v1.0)
Author: Daniel Silhavy
Copyright: (C) 2023 Fraunhofer FOKUS
For full license terms please see the LICENSE file distributed with this
program. If this file is missing then the license can be retrieved from
https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view
*/

package com.fivegmag.a5gmscommonlibrary.helpers

import android.content.res.AssetManager
import java.util.Properties
import com.fivegmag.a5gmscommonlibrary.models.EndpointAddress
import com.fivegmag.a5gmscommonlibrary.models.HostInfo
import java.text.SimpleDateFormat
Expand All @@ -8,6 +19,7 @@ import java.util.Date
import java.util.Random
import java.util.TimeZone
import okhttp3.Headers
import java.io.InputStream
import java.net.NetworkInterface
import java.net.URL
import java.time.Instant
Expand All @@ -17,7 +29,7 @@ import java.util.UUID
class Utils {

fun getCurrentTimestamp(): Long {
return System.currentTimeMillis();
return System.currentTimeMillis()
}

fun convertTimestampToXsDateTime(timestampInMillis: Long): String {
Expand All @@ -32,6 +44,11 @@ class Utils {
return dateFormat.format(date)
}

fun generateUuidToHexBinary(): String {
val uuid = this.generateUUID()
return uuid.replace("-", "")
}

fun generateUUID(): String {
val uuid = UUID.randomUUID()
return uuid.toString()
Expand All @@ -55,7 +72,7 @@ class Utils {
return convertTimestampToXsDateTime(currentTimestamp)
}

fun millisecondsToISO8601(milliseconds: Long): String? {
fun millisecondsToISO8601(milliseconds: Long): String {
// Create a Duration object from milliseconds
val duration: Duration = Duration.ofMillis(milliseconds)

Expand Down Expand Up @@ -116,7 +133,7 @@ class Utils {
if ((ipVer == 4 && address.hostAddress.contains(".")) ||
(ipVer == 6 && address.hostAddress.contains(":"))
) {
return address.hostAddress.toString()
return address.hostAddress?.toString()
}
}
}
Expand Down Expand Up @@ -190,4 +207,17 @@ class Utils {

}

fun loadConfiguration(assetManager: AssetManager, file: String): Properties {
val configProperties = Properties()
try {
val inputStream: InputStream = assetManager.open(file)
configProperties.loadFromXML(inputStream)
inputStream.close()
} catch (e: Exception) {
print("loadConfiguration Exception: $e")
}

return configProperties
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ data class ServiceAccessInformation(
val provisioningSessionId : String,
val provisioningSessionType: String?,
val streamingAccess: StreamingAccess,
var clientConsumptionReportingConfiguration: ClientConsumptionReportingConfiguration?
var clientConsumptionReportingConfiguration: ClientConsumptionReportingConfiguration?,
var clientMetricsReportingConfigurations: ArrayList<ClientMetricsReportingConfiguration>?
) : Parcelable

@Parcelize
Expand All @@ -32,4 +33,20 @@ data class ClientConsumptionReportingConfiguration(
val samplePercentage: Float,
val reportingInterval: Int? = null,
val accessReporting: Boolean
) : Parcelable

@Parcelize
data class ClientMetricsReportingConfiguration(
val metricsReportingConfigurationId: String,
val serverAddresses: ArrayList<String>,
val scheme: String,
val dataNetworkName: String?,
val reportingInterval: Long? = null,
val samplePercentage: Float? = null,
val urlFilters: ArrayList<String>?,
val samplingPeriod: Long,
val metrics: ArrayList<String>,

// These are additional fields that we need for processing. They are not included in the spec and are populated during runtime
var isSchemeSupported: Boolean? = false
) : Parcelable
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
License: 5G-MAG Public License (v1.0)
Author: Daniel Silhavy
Copyright: (C) 2023 Fraunhofer FOKUS
For full license terms please see the LICENSE file distributed with this
program. If this file is missing then the license can be retrieved from
https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view
*/

package com.fivegmag.a5gmscommonlibrary.qoeMetricsReporting

data class AvgThroughput(
val numbytes: Integer,
val activitytime: Integer,
val t : String,
val duration: Integer,
val accessbearer: String,
val inactivitytype: InactivityType
)

enum class InactivityType {
USER_REQUEST,
CLIENT_MEASURE,
ERROR
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
License: 5G-MAG Public License (v1.0)
Author: Daniel Silhavy
Copyright: (C) 2023 Fraunhofer FOKUS
For full license terms please see the LICENSE file distributed with this
program. If this file is missing then the license can be retrieved from
https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view
*/

package com.fivegmag.a5gmscommonlibrary.qoeMetricsReporting

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty

data class BufferLevel(
@field:JacksonXmlProperty(localName = "BufferLevelEntry")
@field:JacksonXmlElementWrapper(useWrapping = false)
val entries: ArrayList<BufferLevelEntry>
)

data class BufferLevelEntry(
@field:JacksonXmlProperty(isAttribute = true)
val t: String? = null,
@field:JacksonXmlProperty(isAttribute = true)
val level: Int = 0
)
Loading

0 comments on commit c2afcf8

Please sign in to comment.