OSDN Git Service

d53890b8a694e5276b80e818d10695cc2880322f
[gokigen/A01d.git] / app / src / main / java / net / osdn / gokigen / a01d / camera / ptpip / wrapper / command / PtpIpResponseReceiver.java
1 package net.osdn.gokigen.a01d.camera.ptpip.wrapper.command;
2
3 import android.util.Log;
4
5 public class PtpIpResponseReceiver implements IPtpIpCommandCallback
6 {
7     private final String TAG = toString();
8
9     public PtpIpResponseReceiver()
10     {
11         //
12     }
13
14     @Override
15     public void receivedMessage(int id, byte[] rx_body)
16     {
17         if (rx_body != null)
18         {
19             try
20             {
21                 if (rx_body.length > 10)
22                 {
23                     int responseCode = (rx_body[9] & 0xff) + ((rx_body[10] & 0xff) * 256);
24                     Log.v(TAG, String.format(" ID : %d, RESPONSE CODE : 0x%x ", id, responseCode));
25                 }
26                 else
27                 {
28                     Log.v(TAG, " receivedMessage() " + id + " " + rx_body.length + " bytes.");
29                 }
30             }
31             catch (Exception e)
32             {
33                 e.printStackTrace();
34             }
35         }
36         else
37         {
38             Log.v(TAG, " receivedMessage() " + id);
39         }
40     }
41
42     @Override
43     public void onReceiveProgress(int currentBytes, int totalBytes, byte[] rx_body)
44     {
45         Log.v(TAG, " onReceiveProgress() " + currentBytes + "/" + totalBytes);
46     }
47
48     @Override
49     public boolean isReceiveMulti()
50     {
51         return (false);
52     }
53 }