From 09ff9fbed6cd6d3adeafe8753b92b0bfb370f2bc Mon Sep 17 00:00:00 2001 From: MRSa Date: Wed, 11 Sep 2019 11:16:21 +0900 Subject: [PATCH] =?utf8?q?=E3=81=84=E3=81=A3=E3=81=9F=E3=82=93=E4=BF=9D?= =?utf8?q?=E7=AE=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../sony/wrapper/playback/SonyPlaybackControl.java | 66 +++++++++++++++++++--- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/sony/wrapper/playback/SonyPlaybackControl.java b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/sony/wrapper/playback/SonyPlaybackControl.java index c958787..78e9553 100644 --- a/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/sony/wrapper/playback/SonyPlaybackControl.java +++ b/app/src/main/java/net/osdn/gokigen/pkremote/camera/vendor/sony/wrapper/playback/SonyPlaybackControl.java @@ -336,10 +336,13 @@ public class SonyPlaybackControl implements IPlaybackControl { { // 呼んでおくか... String accessUrl = cameraApi.getDdUrl(); - String reply = SimpleHttpClient.httpGetWithHeader(accessUrl, null, "text/xml; charset=\"utf-8\"", timeoutMs); - Log.v(TAG, " dd.xml: " + reply); +/* + String reply = SimpleHttpClient.httpGetWithHeader(accessUrl, null, "text/xml; charset=\"utf-8\"", timeoutMs); accessUrl = accessUrl.substring(0, accessUrl.lastIndexOf("/")); + + // Log.v(TAG, " dd.xml: " + reply); + String url = accessUrl + "/DigitalImagingDesc.xml"; //String url = accessUrl + "/CdsDesc.xml"; reply = SimpleHttpClient.httpGet(url, timeoutMs); @@ -395,13 +398,19 @@ public class SonyPlaybackControl implements IPlaybackControl { reply = SimpleHttpClient.httpGet(getDeviceFileUrl, timeoutMs); Log.v(TAG, " " + getDeviceFileUrl + " : (" + reply.length() + " bytes) "); } + reply = getSortCapabilities(accessUrl); + Log.v(TAG, " getSortCapabilities: " + reply); +*/ + String reply = browseRootDirectory(accessUrl); + Log.v(TAG, " browseRootDirectory: " + reply); + } catch (Exception e) { e.printStackTrace(); } - +/* //////////// ある程度の数に区切って送られてくる... 何度か繰り返す必要があるようだ //////////// int sequenceNumber = 0; int totalCount = 100000; @@ -424,12 +433,12 @@ public class SonyPlaybackControl implements IPlaybackControl { //"" + "-dc:flat" + "" + "" + "-dc:date" + "" + ""; -/* +* String postData = "" + "" + "0BrowseDirectChildren*" + returnedCount + "3500" + "LumixLink2.0"; -*/ +* Map header = new HashMap<>(); header.clear(); header.put("SOAPACTION", "urn:schemas-upnp-org:service:ContentDirectory:" + sequenceNumber + "#Browse"); @@ -442,7 +451,7 @@ public class SonyPlaybackControl implements IPlaybackControl { } Log.v(TAG, " < REPLY > " + reply); break; -/* +* getObjectLists = getObjectLists.append(reply); String matches = reply.substring(reply.indexOf("") + 14, reply.indexOf("")); try @@ -466,7 +475,50 @@ public class SonyPlaybackControl implements IPlaybackControl { } Log.v(TAG, " REPLY DATA : (" + matches + "/" + totalCount + ") [" + returned + "/" + returnedCount + "] " + " " + reply.length() + "bytes"); informationReceiver.updateMessage(activity.getString(R.string.get_image_list) + " " + returnedCount + "/" + totalCount + " ", false, false, 0); -*/ +* } +*/ + } + + private String getSortCapabilities(String accessUrl) + { + String url = accessUrl + "/upnp/control/ContentDirectory"; + String postData = "" + + "" + + "" + + "" + + "" + + "" + + "\r\n\r\n"; + Map header = new HashMap<>(); + header.clear(); + header.put("SOAPACTION", "\"urn:schemas-upnp-org:service:ContentDirectory:1" + "#GetSortCapabilities\""); + return (SimpleHttpClient.httpPostWithHeader(url, postData, header, "text/xml; charset=\"utf-8\"", timeoutMs)); + } + + private String browseRootDirectory(String accessUrl) + { + String url = accessUrl + "/upnp/control/ContentDirectory"; + String postData = "" + + "" + + "" + + "" + + "0" + + "BrowseDirectChildren" + + "*" + + "0" + + "800" + + "" + + "" + + "" + + ""; + + Map header = new HashMap<>(); + header.clear(); + //header.put("X-AV-Client-Info", "av=5.0; hn=\"\"; cn=\"Sony Corp.\"; mn=\"PMlib\"; mv=\"2.8.1\";"); + //header.put("User-Agent","UPnP/1.0 DLNADOC/1.50"); + header.put("SOAPACTION", "\"urn:schemas-upnp-org:service:ContentDirectory:1" + "#Browse\""); + return (SimpleHttpClient.httpPostWithHeader(url, postData, header, "text/xml; charset=\"utf-8\"", timeoutMs)); + } } -- 2.11.0