f98d24R91">91
+ b.append("VendorExtensionVersion: ").append(vendorExtensionVersion).append('\n');
+ b.append("VendorExtensionDesc: ").append(vendorExtensionDesc).append('\n');
+ b.append("FunctionalMode: ").append(functionalMode).append('\n');
+ appendU16Array(b, "OperationsSupported", PtpConstants.Operation.class, operationsSupported);
+ appendU16Array(b, "EventsSupported", PtpConstants.Event.class, eventsSupported);
+ appendU16Array(b, "DevicePropertiesSupported", PtpConstants.Property.class, devicePropertiesSupported);
+ appendU16Array(b, "CaptureFormats", PtpConstants.ObjectFormat.class, captureFormats);
+ appendU16Array(b, "ImageFormats", PtpConstants.ObjectFormat.class, imageFormats);
+ b.append("Manufacture: ").append(manufacture).append('\n');
+ b.append("Model: ").append(model).append('\n');
+ b.append("DeviceVersion: ").append(deviceVersion).append('\n');
+ b.append("SerialNumber: ").append(serialNumber).append('\n');
+ return b.toString();
+ }
+
+ private static void appendU16Array(StringBuilder b, String name, Class<?> cl, int[] a) {
+ Arrays.sort(a);
+ b.append(name).append(":\n");
+ for (int i = 0; i < a.length; ++i) {
+ b.append(" ").append(PtpConstants.constantToString(cl, a[i])).append('\n');
+ }
+ }
+}
@@ -0,0 +1,102 @@ |
||
| 1 |
+/** |
|
| 2 |
+ * Copyright 2013 Nils Assbeck, Guersel Ayaz and Michael Zoech |
|
| 3 |
+ * |
|
| 4 |
+ * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 |
+ * you may not use this file except in compliance with the License. |
|
| 6 |
+ * You may obtain a copy of the License at |
|
| 7 |
+ * |
|
| 8 |
+ * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 |
+ * |
|
| 10 |
+ * Unless required by applicable law or agreed to in writing, software |
|
| 11 |
+ * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 12 |
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 |
+ * See the License for the specific language governing permissions and |
|
| 14 |
+ * limitations under the License. |
|
| 15 |
+ */ |
|
| 16 |
+package com.remoteyourcam.usb.ptp.model; |
|
| 17 |
+ |
|
| 18 |
+import java.nio.ByteBuffer; |
|
| 19 |
+ |
|
| 20 |
+import com.remoteyourcam.usb.ptp.PacketUtil; |
|
| 21 |
+import com.remoteyourcam.usb.ptp.PtpConstants.Datatype; |
|
| 22 |
+ |
|
| 23 |
+public class DevicePropDesc {
|
|
| 24 |
+ |
|
| 25 |
+ public int code; |
|
| 26 |
+ public int datatype; |
|
| 27 |
+ public boolean readOnly; |
|
| 28 |
+ public int factoryDefault; |
|
| 29 |
+ public int currentValue; |
|
| 30 |
+ public int[] description; |
|
| 31 |
+ |
|
| 32 |
+ public DevicePropDesc() {
|
|
| 33 |
+ } |
|
| 34 |
+ |
|
| 35 |
+ public DevicePropDesc(ByteBuffer b, int length) {
|
|
| 36 |
+ decode(b, length); |
|
| 37 |
+ } |
|
| 38 |
+ |
|
| 39 |
+ public void decode(ByteBuffer b, int length) {
|
|
| 40 |
+ code = b.getShort() & 0xFFFF; |
|
| 41 |
+ datatype = b.getShort() & 0xFFFF; |
|
| 42 |
+ readOnly = b.get() == 0; |
|
| 43 |
+ |
|
| 44 |
+ if (datatype == Datatype.int8 || datatype == Datatype.uint8) {
|
|
| 45 |
+ factoryDefault = b.get() & 0xFF; |
|
| 46 |
+ currentValue = b.get() & 0xFF; |
|
| 47 |
+ int form = b.get(); |
|
| 48 |
+ if (form == 2) {
|
|
| 49 |
+ description = PacketUtil.readU8Enumeration(b); |
|
| 50 |
+ } else if (form == 1) {
|
|
| 51 |
+ int mini = b.get(); |
|
| 52 |
+ int maxi = b.get(); |
|
| 53 |
+ int step = b.get(); |
|
| 54 |
+ description = new int[(maxi - mini) / step + 1]; |
|
| 55 |
+ for (int i = 0; i < description.length; ++i) {
|
|
| 56 |
+ description[i] = mini + step * i; |
|
| 57 |
+ } |
|
| 58 |
+ } |
|
| 59 |
+ } else if (datatype == Datatype.uint16) {
|
|
| 60 |
+ factoryDefault = b.getShort() & 0xFFFF; |
|
| 61 |
+ currentValue = b.getShort() & 0xFFFF; |
|
| 62 |
+ int form = b.get(); |
|
| 63 |
+ if (form == 2) {
|
|
| 64 |
+ description = PacketUtil.readU16Enumeration(b); |
|
| 65 |
+ } else if (form == 1) {
|
|
| 66 |
+ int mini = b.getShort() & 0xFFFF; |
|
| 67 |
+ int maxi = b.getShort() & 0xFFFF; |
|
| 68 |
+ int step = b.getShort() & 0xFFFF; |
|
| 69 |
+ description = new int[(maxi - mini) / step + 1]; |
|
| 70 |
+ for (int i = 0; i < description.length; ++i) {
|
|
| 71 |
+ description[i] = mini + step * i; |
|
| 72 |
+ } |
|
| 73 |
+ } |
|
| 74 |
+ } else if (datatype == Datatype.int16) {
|
|
| 75 |
+ factoryDefault = b.getShort(); |
|
| 76 |
+ currentValue = b.getShort(); |
|
| 77 |
+ int form = b.get(); |
|
| 78 |
+ if (form == 2) {
|
|
| 79 |
+ description = PacketUtil.readS16Enumeration(b); |
|
| 80 |
+ } else if (form == 1) {
|
|
| 81 |
+ int mini = b.getShort(); |
|
| 82 |
+ int maxi = b.getShort(); |
|
| 83 |
+ int step = b.getShort(); |
|
| 84 |
+ description = new int[(maxi - mini) / step + 1]; |
|
| 85 |
+ for (int i = 0; i < description.length; ++i) {
|
|
| 86 |
+ description[i] = mini + step * i; |
|
| 87 |
+ } |
|
| 88 |
+ } |
|
| 89 |
+ } else if (datatype == Datatype.int32 || datatype == Datatype.uint32) {
|
|
| 90 |
+ factoryDefault = b.getInt(); |
|
| 91 |
+ currentValue = b.getInt(); |
|
| 92 |
+ int form = b.get(); |
|
| 93 |
+ if (form == 2) {
|
|
| 94 |
+ description = PacketUtil.readU32Enumeration(b); |
|
| 95 |
+ } |
|
| 96 |
+ } |
|
| 97 |
+ |
|
| 98 |
+ if (description == null) {
|
|
| 99 |
+ description = new int[0]; |
|
| 100 |
+ } |
|
| 101 |
+ } |
|
| 102 |
+} |
@@ -0,0 +1,44 @@ |
||
| 1 |
+/** |
|
| 2 |
+ * Copyright 2013 Nils Assbeck, Guersel Ayaz and Michael Zoech |
|
| 3 |
+ * |
|
| 4 |
+ * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 |
+ * you may not use this file except in compliance with the License. |
|
| 6 |
+ * You may obtain a copy of the License at |
|
| 7 |
+ * |
|
| 8 |
+ * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 |
+ * |
|
| 10 |
+ * Unless required by applicable law or agreed to in writing, software |
|
| 11 |
+ * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 12 |
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 |
+ * See the License for the specific language governing permissions and |
|
| 14 |
+ * limitations under the License. |
|
| 15 |
+ */ |
|
| 16 |
+package com.remoteyourcam.usb.ptp.model; |
|
| 17 |
+ |
|
| 18 |
+import java.nio.ByteBuffer; |
|
| 19 |
+ |
|
| 20 |
+import android.graphics.Bitmap; |
|
| 21 |
+ |
|
| 22 |
+public class LiveViewData {
|
|
| 23 |
+ |
|
| 24 |
+ public Bitmap bitmap; |
|
| 25 |
+ |
|
| 26 |
+ public int zoomFactor; |
|
| 27 |
+ public int zoomRectLeft; |
|
| 28 |
+ public int zoomRectTop; |
|
| 29 |
+ public int zoomRectRight; |
|
| 30 |
+ public int zoomRectBottom; |
|
| 31 |
+ |
|
| 32 |
+ public boolean hasHistogram; |
|
| 33 |
+ public ByteBuffer histogram; |
|
| 34 |
+ |
|
| 35 |
+ // dimensions are in bitmap size |
|
| 36 |
+ public boolean hasAfFrame; |
|
| 37 |
+ public int nikonAfFrameCenterX; |
|
| 38 |
+ public int nikonAfFrameCenterY; |
|
| 39 |
+ public int nikonAfFrameWidth; |
|
| 40 |
+ public int nikonAfFrameHeight; |
|
| 41 |
+ |
|
| 42 |
+ public int nikonWholeWidth; |
|
| 43 |
+ public int nikonWholeHeight; |
|
| 44 |
+} |
@@ -0,0 +1,101 @@ |
||
| 1 |
+/** |
|
| 2 |
+ * Copyright 2013 Nils Assbeck, Guersel Ayaz and Michael Zoech |
|
| 3 |
+ * |
|
| 4 |
+ * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 |
+ * you may not use this file except in compliance with the License. |
|
| 6 |
+ * You may obtain a copy of the License at |
|
| 7 |
+ * |
|
| 8 |
+ * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 |
+ * |
|
| 10 |
+ * Unless required by applicable law or agreed to in writing, software |
|
| 11 |
+ * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 12 |
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 |
+ * See the License for the specific language governing permissions and |
|
| 14 |
+ * limitations under the License. |
|
| 15 |
+ */ |
|
| 16 |
+package com.remoteyourcam.usb.ptp.model; |
|
| 17 |
+ |
|
| 18 |
+import java.nio.ByteBuffer; |
|
| 19 |
+ |
|
| 20 |
+import com.remoteyourcam.usb.ptp.PacketUtil; |
|
| 21 |
+import com.remoteyourcam.usb.ptp.PtpConstants; |
|
| 22 |
+ |
|
| 23 |
+/** |
|
| 24 |
+ * Object info data set as defined by the PTP standard. |
|
| 25 |
+ */ |
|
| 26 |
+public class ObjectInfo {
|
|
| 27 |
+ |
|
| 28 |
+ public int storageId; |
|
| 29 |
+ public int objectFormat; |
|
| 30 |
+ public int protectionStatus; |
|
| 31 |
+ public int objectCompressedSize; |
|
| 32 |
+ public int thumbFormat; |
|
| 33 |
+ public int thumbCompressedSize; |
|
| 34 |
+ public int thumbPixWidth; |
|
| 35 |
+ public int thumbPixHeight; |
|
| 36 |
+ public int imagePixWidth; |
|
| 37 |
+ public int imagePixHeight; |
|
| 38 |
+ public int imageBitDepth; |
|
| 39 |
+ public int parentObject; |
|
| 40 |
+ public int associationType; |
|
| 41 |
+ public int associationDesc; |
|
| 42 |
+ public int sequenceNumber; |
|
| 43 |
+ public String filename; |
|
| 44 |
+ public String captureDate; |
|
| 45 |
+ public String modificationDate; |
|
| 46 |
+ public int keywords; |
|
| 47 |
+ |
|
| 48 |
+ public ObjectInfo() {
|
|
| 49 |
+ } |
|
| 50 |
+ |
|
| 51 |
+ public ObjectInfo(ByteBuffer b, int length) {
|
|
| 52 |
+ decode(b, length); |
|
| 53 |
+ } |
|
| 54 |
+ |
|
| 55 |
+ public void decode(ByteBuffer b, int length) {
|
|
| 56 |
+ storageId = b.getInt(); |
|
| 57 |
+ objectFormat = b.getShort(); |
|
| 58 |
+ protectionStatus = b.getShort(); |
|
| 59 |
+ objectCompressedSize = b.getInt(); |
|
| 60 |
+ thumbFormat = b.getShort(); |
|
| 61 |
+ thumbCompressedSize = b.getInt(); |
|
| 62 |
+ thumbPixWidth = b.getInt(); |
|
| 63 |
+ thumbPixHeight = b.getInt(); |
|
| 64 |
+ imagePixWidth = b.getInt(); |
|
| 65 |
+ imagePixHeight = b.getInt(); |
|
| 66 |
+ imageBitDepth = b.getInt(); |
|
| 67 |
+ parentObject = b.getInt(); |
|
| 68 |
+ associationType = b.getShort(); |
|
| 69 |
+ associationDesc = b.getInt(); |
|
| 70 |
+ sequenceNumber = b.getInt(); |
|
| 71 |
+ filename = PacketUtil.readString(b); |
|
| 72 |
+ captureDate = PacketUtil.readString(b); |
|
| 73 |
+ modificationDate = PacketUtil.readString(b); |
|
| 74 |
+ keywords = b.get(); // string, not used on camera? |
|
| 75 |
+ } |
|
| 76 |
+ |
|
| 77 |
+ @Override |
|
| 78 |
+ public String toString() {
|
|
| 79 |
+ StringBuilder b = new StringBuilder(); |
|
| 80 |
+ b.append("ObjectInfo\n");
|
|
| 81 |
+ b.append("StorageId: ").append(String.format("0x%08x\n", storageId));
|
|
| 82 |
+ b.append("ObjectFormat: ").append(PtpConstants.objectFormatToString(objectFormat)).append('\n');
|
|
| 83 |
+ b.append("ProtectionStatus: ").append(protectionStatus).append('\n');
|
|
| 84 |
+ b.append("ObjectCompressedSize: ").append(objectCompressedSize).append('\n');
|
|
| 85 |
+ b.append("ThumbFormat: ").append(PtpConstants.objectFormatToString(thumbFormat)).append('\n');
|
|
| 86 |
+ b.append("ThumbCompressedSize: ").append(thumbCompressedSize).append('\n');
|
|
| 87 |
+ b.append("ThumbPixWdith: ").append(thumbPixWidth).append('\n');
|
|
| 88 |
+ b.append("ThumbPixHeight: ").append(thumbPixHeight).append('\n');
|
|
| 89 |
+ b.append("ImagePixWidth: ").append(imagePixWidth).append('\n');
|
|
| 90 |
+ b.append("ImagePixHeight: ").append(imagePixHeight).append('\n');
|
|
| 91 |
+ b.append("ImageBitDepth: ").append(imageBitDepth).append('\n');
|
|
| 92 |
+ b.append("ParentObject: ").append(String.format("0x%08x", parentObject)).append('\n');
|
|
| 93 |
+ b.append("AssociationType: ").append(associationType).append('\n');
|
|
| 94 |
+ b.append("AssociatonDesc: ").append(associationDesc).append('\n');
|
|
| 95 |
+ b.append("Filename: ").append(filename).append('\n');
|
|
| 96 |
+ b.append("CaptureDate: ").append(captureDate).append('\n');
|
|
| 97 |
+ b.append("ModificationDate: ").append(modificationDate).append('\n');
|
|
| 98 |
+ b.append("Keywords: ").append(keywords).append('\n');
|
|
| 99 |
+ return b.toString(); |
|
| 100 |
+ } |
|
| 101 |
+} |
@@ -0,0 +1,47 @@ |
||
| 1 |
+/** |
|
| 2 |
+ * Copyright 2013 Nils Assbeck, Guersel Ayaz and Michael Zoech |
|
| 3 |
+ * |
|
| 4 |
+ * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 |
+ * you may not use this file except in compliance with the License. |
|
| 6 |
+ * You may obtain a copy of the License at |
|
| 7 |
+ * |
|
| 8 |
+ * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 |
+ * |
|
| 10 |
+ * Unless required by applicable law or agreed to in writing, software |
|
| 11 |
+ * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 12 |
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 |
+ * See the License for the specific language governing permissions and |
|
| 14 |
+ * limitations under the License. |
|
| 15 |
+ */ |
|
| 16 |
+package com.remoteyourcam.usb.ptp.model; |
|
| 17 |
+ |
|
| 18 |
+import java.nio.ByteBuffer; |
|
| 19 |
+ |
|
| 20 |
+import com.remoteyourcam.usb.ptp.PacketUtil; |
|
| 21 |
+ |
|
| 22 |
+public class StorageInfo {
|
|
| 23 |
+ |
|
| 24 |
+ public int storageType; |
|
| 25 |
+ public int filesystemType; |
|
| 26 |
+ public int accessCapability; |
|
| 27 |
+ public long maxCapacity; |
|
| 28 |
+ public long freeSpaceInBytes; |
|
| 29 |
+ public int freeSpaceInImages; |
|
| 30 |
+ public String storageDescription; |
|
| 31 |
+ public String volumeLabel; |
|
| 32 |
+ |
|
| 33 |
+ public StorageInfo(ByteBuffer b, int length) {
|
|
| 34 |
+ decode(b, length); |
|
| 35 |
+ } |
|
| 36 |
+ |
|
| 37 |
+ private void decode(ByteBuffer b, int length) {
|
|
| 38 |
+ storageType = b.getShort() & 0xffff; |
|
| 39 |
+ filesystemType = b.getShort() & 0xffff; |
|
| 40 |
+ accessCapability = b.getShort() & 0xff; |
|
| 41 |
+ maxCapacity = b.getLong(); |
|
| 42 |
+ freeSpaceInBytes = b.getLong(); |
|
| 43 |
+ freeSpaceInImages = b.getInt(); |
|
| 44 |
+ storageDescription = PacketUtil.readString(b); |
|
| 45 |
+ volumeLabel = PacketUtil.readString(b); |
|
| 46 |
+ } |
|
| 47 |
+} |
@@ -0,0 +1,3 @@ |
||
| 1 |
+<resources> |
|
| 2 |
+ <string name="app_name">ryc</string> |
|
| 3 |
+</resources> |
@@ -1 +1 @@ |
||
| 1 |
-include ':app', ':common', ':views' |
|
| 1 |
+include ':app', ':common', ':views', ':ryc' |