public void onEventDirItemCreated(int objectHandle, int storageId, int objectFormat, String filename) {
- onEventObjectAdded(objectHandle, objectFormat);
+ onEventObjectAdded(objectHandle);
}
@Override
@@ -24,6 +24,7 @@ import com.remoteyourcam.usb.ptp.PtpConstants.Operation; |
||
24 | 24 |
import com.remoteyourcam.usb.ptp.commands.GetDevicePropDescCommand; |
25 | 25 |
import com.remoteyourcam.usb.ptp.commands.InitiateCaptureCommand; |
26 | 26 |
import com.remoteyourcam.usb.ptp.commands.RetrieveAddedObjectInfoAction; |
27 |
+import com.remoteyourcam.usb.ptp.commands.RetrievePictureAction; |
|
27 | 28 |
import com.remoteyourcam.usb.ptp.commands.SimpleCommand; |
28 | 29 |
import com.remoteyourcam.usb.ptp.commands.nikon.NikonAfDriveCommand; |
29 | 30 |
import com.remoteyourcam.usb.ptp.commands.nikon.NikonCloseSessionAction; |
@@ -168,6 +169,12 @@ public class NikonCamera extends PtpCamera { |
||
168 | 169 |
this.vendorPropCodes = vendorPropCodes; |
169 | 170 |
} |
170 | 171 |
|
172 |
+ @Override |
|
173 |
+ public void retrievePicture(int objectHandle) { |
|
174 |
+ queue.add(new RetrievePictureAction(this, objectHandle, pictureSampleSize)); |
|
175 |
+ queue.add(new SimpleCommand(this, PtpConstants.Operation.NikonDeleteImagesInSdram, objectHandle)); |
|
176 |
+ } |
|
177 |
+ |
|
171 | 178 |
public void onEventObjectAdded(int objectHandle) { |
172 | 179 |
queue.add(new RetrieveAddedObjectInfoAction(this, objectHandle)); |
173 | 180 |
} |
@@ -34,6 +34,7 @@ import com.remoteyourcam.usb.ptp.commands.RetrieveImageAction; |
||
34 | 34 |
import com.remoteyourcam.usb.ptp.commands.RetrieveImageInfoAction; |
35 | 35 |
import com.remoteyourcam.usb.ptp.commands.RetrievePictureAction; |
36 | 36 |
import com.remoteyourcam.usb.ptp.commands.SetDevicePropValueCommand; |
37 |
+import com.remoteyourcam.usb.ptp.commands.SimpleCommand; |
|
37 | 38 |
import com.remoteyourcam.usb.ptp.model.DeviceInfo; |
38 | 39 |
import com.remoteyourcam.usb.ptp.model.DevicePropDesc; |
39 | 40 |
import com.remoteyourcam.usb.ptp.model.LiveViewData; |
@@ -110,7 +111,7 @@ public abstract class PtpCamera implements Camera { |
||
110 | 111 |
protected final int productId; |
111 | 112 |
|
112 | 113 |
private WorkerListener workerListener; |
113 |
- private int pictureSampleSize; |
|
114 |
+ protected int pictureSampleSize; |
|
114 | 115 |
|
115 | 116 |
public PtpCamera(PtpUsbConnection connection, CameraListener listener, WorkerListener workerListener) { |
116 | 117 |
this.connection = connection; |
@@ -376,12 +377,12 @@ public abstract class PtpCamera implements Camera { |
||
376 | 377 |
} |
377 | 378 |
} |
378 | 379 |
|
379 |
- public void onEventObjectAdded(final int handle, final int format) { |
|
380 |
+ public void onEventObjectAdded(final int handle) { |
|
380 | 381 |
handler.post(new Runnable() { |
381 | 382 |
@Override |
382 | 383 |
public void run() { |
383 | 384 |
if (listener != null) { |
384 |
- listener.onObjectAdded(handle, format); |
|
385 |
+ listener.onObjectAdded(handle); |
|
385 | 386 |
} |
386 | 387 |
} |
387 | 388 |
}); |
@@ -883,5 +884,4 @@ public abstract class PtpCamera implements Camera { |
||
883 | 884 |
public void setCapturedPictureSampleSize(int sampleSize) { |
884 | 885 |
this.pictureSampleSize = sampleSize; |
885 | 886 |
} |
886 |
- |
|
887 | 887 |
} |
@@ -119,6 +119,11 @@ public class PtpConstants { |
||
119 | 119 |
public static final int NikonGetObjectPropDesc = 0x9802; |
120 | 120 |
public static final int NikonGetObjectPropValue = 0x9803; |
121 | 121 |
public static final int NikonGetObjectPropList = 0x9805; |
122 |
+ public static final int NikonGetVendorStorageIDs = 0x9209; |
|
123 |
+ public static final int NIKONStartMovieRecInCard = 0x920a; |
|
124 |
+ public static final int NIKONEndMovieRec = 0x920b; |
|
125 |
+ public static final int NIKONTerminateCapture = 0x920c; |
|
126 |
+ public static final int NIKONGetPartialObjectHiSpeed = 0x920b; |
|
122 | 127 |
|
123 | 128 |
// Canon EOS |
124 | 129 |
public static final int EosTakePicture = 0x910F; |
@@ -156,9 +161,9 @@ public class PtpConstants { |
||
156 | 161 |
public static final int CaptureComplete = 0x400D; |
157 | 162 |
|
158 | 163 |
// Nikon |
159 |
- public static final int NikonObjectAddedInSdram = 0xC101; |
|
164 |
+ public static final int NikonObjectAddedInSdram = 0xffffC101; |
|
160 | 165 |
public static final int NikonCaptureCompleteRecInSdram = 0xC102; |
161 |
- public static final int NikonPreviewImageAdded = 0xC104; |
|
166 |
+ public static final int NikonPreviewImageAdded = 0xffffC104; |
|
162 | 167 |
|
163 | 168 |
// Canon EOS |
164 | 169 |
public static final int EosObjectAdded = 0xC181; // ? dir item request transfer or dir item created |
@@ -42,7 +42,7 @@ public class RetrieveAddedObjectInfoAction implements PtpAction { |
||
42 | 42 |
return; |
43 | 43 |
} |
44 | 44 |
|
45 |
- camera.onEventObjectAdded(objectHandle, getInfo.getObjectInfo().objectFormat); |
|
45 |
+ camera.onEventObjectAdded(objectHandle); |
|
46 | 46 |
} |
47 | 47 |
|
48 | 48 |
@Override |
@@ -70,6 +70,11 @@ public class NikonEventCheckCommand extends NikonCommand { |
||
70 | 70 |
case Event.CaptureComplete: |
71 | 71 |
camera.onEventCaptureComplete(); |
72 | 72 |
break; |
73 |
+ case Event.NikonObjectAddedInSdram: |
|
74 |
+ //libgphoto2 相关处理 |
|
75 |
+ if (eventParam == 0) { eventParam = 0xffff001; } |
|
76 |
+ camera.onEventObjectAdded(eventParam); |
|
77 |
+ break; |
|
73 | 78 |
} |
74 | 79 |
} |
75 | 80 |
} |
@@ -1,7 +1,10 @@ |
||
1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
2 | 2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
3 |
+ xmlns:app="http://schemas.android.com/apk/res-auto" |
|
4 |
+ xmlns:tools="http://schemas.android.com/tools" |
|
3 | 5 |
android:layout_width="match_parent" |
4 | 6 |
android:layout_height="match_parent" |
7 |
+ android:background="#fff" |
|
5 | 8 |
android:orientation="vertical"> |
6 | 9 |
|
7 | 10 |
<Button |
@@ -53,15 +56,22 @@ |
||
53 | 56 |
android:horizontalSpacing="4dp" |
54 | 57 |
android:listSelector="@android:color/transparent" |
55 | 58 |
android:numColumns="3" |
56 |
- android:verticalSpacing="4dp" |
|
57 |
- /> |
|
59 |
+ android:verticalSpacing="4dp" /> |
|
58 | 60 |
|
59 | 61 |
<ImageView |
60 | 62 |
android:id="@+id/iv_latest_photo" |
61 | 63 |
android:layout_width="match_parent" |
62 | 64 |
android:layout_height="match_parent" |
63 |
- android:visibility="gone" |
|
64 |
- android:scaleType="fitCenter" /> |
|
65 |
+ android:scaleType="fitCenter" |
|
66 |
+ android:visibility="gone" /> |
|
67 |
+ |
|
68 |
+ <ImageView |
|
69 |
+ android:id="@+id/photo_detail" |
|
70 |
+ android:layout_width="wrap_content" |
|
71 |
+ android:layout_height="wrap_content" |
|
72 |
+ android:visibility="invisible" |
|
73 |
+ tools:src="@tools:sample/backgrounds/scenic" /> |
|
74 |
+ |
|
65 | 75 |
</RelativeLayout> |
66 | 76 |
|
67 | 77 |
</LinearLayout> |