From 41eee5797766bb1828a9f246642e2d59e5eb3b3c Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Thu, 5 Jul 2018 21:29:56 -0400 Subject: [PATCH] Support for DNS-SD cast discovery --- .../google/android/gms/cast/CastDevice.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/play-services-cast-api/src/main/java/com/google/android/gms/cast/CastDevice.java b/play-services-cast-api/src/main/java/com/google/android/gms/cast/CastDevice.java index 9655a2c0..f185c8a5 100644 --- a/play-services-cast-api/src/main/java/com/google/android/gms/cast/CastDevice.java +++ b/play-services-cast-api/src/main/java/com/google/android/gms/cast/CastDevice.java @@ -17,6 +17,7 @@ package com.google.android.gms.cast; import android.os.Bundle; +import android.net.Uri; import android.text.TextUtils; import com.google.android.gms.common.images.WebImage; @@ -25,6 +26,7 @@ import org.microg.gms.common.PublicApi; import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.SafeParceled; +import java.net.InetAddress; import java.net.Inet4Address; import java.util.ArrayList; import java.util.List; @@ -36,9 +38,19 @@ public class CastDevice extends AutoSafeParcelable { public CastDevice () { } - public CastDevice (String deviceId, String address) { - this.deviceId = deviceId; - this.address = address; + public CastDevice ( + String id, String name, InetAddress host, int port, String + deviceVersion, String friendlyName, String modelName, String + iconPath, int status, int capabilities) { + this.deviceId = id; + this.address = host.getHostAddress(); + this.servicePort = port; + this.deviceVersion = deviceVersion; + this.friendlyName = friendlyName; + this.icons = new ArrayList(); + this.icons.add(new WebImage(Uri.parse(String.format("http://%s:8008%s", this.address, iconPath)))); + this.modelName = modelName; + this.capabilities = capabilities; } /**