Table of Contents
- 1. WebApp Directory structure
- 2. Sample App
- 3. Dreamhost servers
- 4. Offline
- 5. Crazy Maik
- 6. Actions and Commands
- 7. session fragment
- 8. Network
- 9. functionality
- 10. printing
- 11. HitiPPR_GetPrinterInfo
- 12. PrintingPhotoUtility
- 13. Network Discovery
- 14. update yii apps
- 15. ACT I. Scene I. Verona. A...
- 16. Scene II. A Street.
- 17. Scene III. Capulet's house.
- 18. Scene IV. A street.
- 19. Scene V. Capulet's house.
- 20. PROLOGUE
- 21. ACT II. Scene I. A lane b...
- 22. Scene II. Capulet's orchard.
- 23. Scene III. Friar Laurence...
- 24. Scene IV. A street.
- 25. Scene V. Capulet's orchard.
- 26. Scene VI. Friar Laurence'...
- 27. ACT III. Scene I. A publi...
- 28. Scene II. Capulet's orchard.
- 29. Scene III. Friar Laurence...
- 30. Scene IV. Capulet's house
- 31. Scene V. Capulet's orchard.
- 32. ACT IV. Scene I. Friar La...
- 33. Scene II. Capulet's house.
- 34. Scene III. Juliet's chamber.
- 35. Scene IV. Capulet's house.
- 36. Scene V. Juliet's chamber.
- 37. ACT V. Scene I. Mantua. A...
- 38. Scene II. Verona. Friar L...
Actions and Commands
A new EosCamera()
call result in the following statements:
addPropertyMapping(Camera.Property.ShutterSpeed, PtpConstants.Property.EosShutterSpeed);
addPropertyMapping(Camera.Property.ApertureValue, PtpConstants.Property.EosApertureValue);
addPropertyMapping(Camera.Property.IsoSpeed, PtpConstants.Property.EosIsoSpeed);
addPropertyMapping(Camera.Property.Whitebalance, PtpConstants.Property.EosWhitebalance);
addPropertyMapping(Camera.Property.ShootingMode, PtpConstants.Property.EosShootingMode);
addPropertyMapping(Camera.Property.AvailableShots, PtpConstants.Property.EosAvailableShots);
addPropertyMapping(Camera.Property.ColorTemperature, PtpConstants.Property.EosColorTemperature);
addPropertyMapping(Camera.Property.FocusMode, PtpConstants.Property.EosAfMode);
addPropertyMapping(Camera.Property.PictureStyle, PtpConstants.Property.EosPictureStyle);
addPropertyMapping(Camera.Property.ExposureMeteringMode, PtpConstants.Property.EosMeteringMode);
addPropertyMapping(Camera.Property.ExposureCompensation, PtpConstants.Property.EosExposureCompensation);
Here, we see the camera getting initialized with settings from the App. But how?
As an example, let's analyze how a captured photo is fetched from the camera to the App. It starts in a Fragment (or Activity). For example:
public class PictureFragment extends SessionFragment implements Camera.RetrieveImageListener, GestureHandler
In the Fragment's onStart()
we see an image being retrieved:
camera().retrieveImage(this, objectHandle);
where objectHandle
is an integer which points to the imagefile on the camera. Inside the Fragment/Activity, it is still transparent which camera is being called. Of course, this is nailed down by the camera()
call, which will return either an EosCamera
or a NikonCamera
. Both extend from the PtpCamera()
class, where we find:
@Override
public void retrieveImage(RetrieveImageListener listener, int objectHandle) {
queue.add(new RetrieveImageAction(this, listener, objectHandle, pictureSampleSize));
}
RetrieveImageListener
is an interface:
public interface RetrieveImageListener {
void onImageRetrieved(int objectHandle, Bitmap image);
}
The RetrieveImageAction()
class has
@Override
public void exec(IO io) {
GetObjectCommand getObject = new GetObjectCommand(camera, objectHandle, sampleSize);
io.handleCommand(getObject);
if (getObject.getResponseCode() != Response.Ok || getObject.getBitmap() == null) {
listener.onImageRetrieved(0, null);
return;
}
listener.onImageRetrieved(objectHandle, getObject.getBitmap());
}
Taking a closer look at the GetObjectCommand()
class, we see a constructor:
public GetObjectCommand(PtpCamera camera, int objectHandle, int sampleSize) {
super(camera);
this.objectHandle = objectHandle;
options = new BitmapFactory.Options();
if (sampleSize >= 1 && sampleSize
and an encodeCommand() method
@Override
public void encodeCommand(ByteBuffer b) {
encodeCommand(b, PtpConstants.Operation.GetObject, objectHandle);
}
PtpConstants.Operation.GetObject
is of particlar interest. It is defined as follows:
public static final int GetObjectHandles = 0x1007;
public static final int GetObjectInfo = 0x1008;
public static final int GetObject = 0x1009;
public static final int GetThumb = 0x100A;
public static final int DeleteObject = 0x100B;
These must be the hexadecimal codes that the EosCamera or NikonCamera recognizes. If we wish to execute a command that CrazyMaik's App did not implement, we should probably construct similar RetrieveImageAction
and GetObjectCommand
classes. For example, to delete a file on the camera, we might try to implement DeleteImageAction
and DeleteObjectCommand
classes. As seen above, PtpConstants.Operation
class actually specifies a hexadecimal constant for DeleteObject....
