OSDN Git Service

G9との接続シーケンスを改善。
authorMRSa <mrsa@myad.jp>
Sat, 11 Jul 2020 13:33:54 +0000 (22:33 +0900)
committerMRSa <mrsa@myad.jp>
Sat, 11 Jul 2020 13:33:54 +0000 (22:33 +0900)
app/src/main/java/net/osdn/gokigen/a01d/camera/panasonic/wrapper/connection/PanasonicSsdpClient.java

index a4b55a5..dad986c 100644 (file)
@@ -127,8 +127,24 @@ class PanasonicSsdpClient
                                 cameraStatusReceiver.onStatusNotify(context.getString(R.string.camera_found) + " " + device.getFriendlyName());
 
                                 ///// カメラへの登録要求... /////
+                                int retryTimeout = 3;
                                 String registUrl = device.getCmdUrl() + "cam.cgi?mode=accctrl&type=req_acc&value=" + device.getClientDeviceUuId() + "&value2=GOKIGEN_a01Series";
                                 String reply = SimpleHttpClient.httpGet(registUrl, SSDP_RECEIVE_TIMEOUT);
+                                while ((retryTimeout > 0)&&(reply.contains("ok_under_research_no_msg")))
+                                {
+                                    try
+                                    {
+                                        // 1秒待って再送してみる
+                                        Thread.sleep(1000);
+                                    }
+                                    catch (Exception e)
+                                    {
+                                        e.printStackTrace();
+                                    }
+                                    reply = SimpleHttpClient.httpGet(registUrl, SSDP_RECEIVE_TIMEOUT);
+                                    retryTimeout--;
+
+                                }
                                 if (reply.contains("ok"))
                                 {
                                     callback.onDeviceFound(device);
@@ -150,6 +166,10 @@ class PanasonicSsdpClient
                         Log.v(TAG, "Already received. : " + ddUsn);
                     }
                 }
+                else
+                {
+                    Log.v(TAG, " SSDP REPLY MESSAGE (ignored) : " + ssdpReplyMessage);
+                }
                 currentTime = System.currentTimeMillis();
             }
         }