usb.jphoto
Class Initiator

java.lang.Object
  |
  +--usb.jphoto.NameFactory
        |
        +--usb.jphoto.BaselineInitiator
              |
              +--usb.jphoto.Initiator
All Implemented Interfaces:
java.lang.Runnable

public class Initiator
extends BaselineInitiator

This supports all standardized PTP-over-USB operations, including operations (and modes) that are optional for all responders. Filtering operations invoked on this class may be done on the device, or may be emulated on the client side. At this time, not all standardized operations are supported.


Constructor Summary
Initiator(usb.core.Device dev)
          This is essentially a class driver, following Annex D of the PTP specification.
Initiator(usb.core.Interface intf)
          This is essentially a class driver, following Annex D of the PTP specification.
 
Method Summary
 int copyObject(int handle, int storageId, int parent)
           
 int deleteObject(int handle, int formats)
           
 int formatStore(int storageId, int formatCode)
          Reformats the specified storage unit.
 int getDevicePropDesc(int propcode, DevicePropDesc desc)
          Fills out the provided device property description.
 int getDevicePropValue(int propcode, DevicePropValue value)
          Gets the value of the specified device property.
 int[] getImageHandles(int storageID, int association)
          Returns an array of image handles in the store (or stores) specified; uses device-side filtering when it's available.
 int getNumImages(int storageID, int association)
          Returns the number of images in the specified association on the specified store; uses device-side filtering when it's available.
 Response getPartialObject(int handle, int offset, int count)
           
 int initiateCapture(int storageId, int formatCode)
          Starts the capture of one (or more) new data objects, according to current device properties.
 int initiateOpenCapture(int storageId, int formatCode)
          Starts an open-ended capture of new data objects, according to current device properties.
 int moveObject(int handle, int storageId, int parent)
           
 int powerDown()
          Sends a PowerDown command to the device, causing it to power down and close all currently open sessions.
 int resetDevice()
          Sends a ResetDevice command to the device, putting it into a default state and closing all open sessions.
 int resetDevicePropValue(int propcode)
          Resets the value of the specified device property to the factory default.
 int selfTest(int type)
          Sends a SelfTest command to the device.
 int setDevicePropValue(int propcode, DevicePropValue value)
          Sets the value of the specified device property.
 int setObjectProtection(int handle, int status)
           
 int terminateOpenCapture()
          Closes the current session's open capture operation.
 
Methods inherited from class usb.jphoto.BaselineInitiator
close, closeSession, fillObject, finalize, getDeviceInfo, getDeviceInfoUncached, getNumObjects, getObject, getObjectHandles, getObjectInfo, getPortIdentifier, getPtpInterface, getSessionId, getStorageIDs, getStorageInfo, getThumb, isPull, isPush, openSession, reset, run, sendObject, sendObjectInfo, transact, transact0, transact1, transact2, transact3
 
Methods inherited from class usb.jphoto.NameFactory
getEventString, getFormatString, getOpcodeString, getPropertyName, getResponseString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Initiator

public Initiator(usb.core.Device dev)
          throws java.io.IOException
This is essentially a class driver, following Annex D of the PTP specification.

Initiator

public Initiator(usb.core.Interface intf)
          throws java.io.IOException
This is essentially a class driver, following Annex D of the PTP specification.
Method Detail

copyObject

public int copyObject(int handle,
                      int storageId,
                      int parent)
               throws java.io.IOException

deleteObject

public int deleteObject(int handle,
                        int formats)
                 throws java.io.IOException

formatStore

public int formatStore(int storageId,
                       int formatCode)
                throws java.io.IOException
Reformats the specified storage unit. All images (and other objects) on the media will be erased; write-protected objects will be erased, unlike invoking deleteObject(int, int).
Parameters:
storageId - the storage unit to reformat
formatCode - normally zero. Otherwise, a value as defined in table 12 of the PTP specification, selecting among types of filesystem supported by the device (flat, hierarchical, DCF, vendor-defined, and so on).
Returns:
response code

getDevicePropDesc

public int getDevicePropDesc(int propcode,
                             DevicePropDesc desc)
                      throws java.io.IOException
Fills out the provided device property description.
Parameters:
propcode - code identifying the property of interest
desc - description to be filled; it may be a subtype associated with with domain-specific methods
Returns:
response code

getDevicePropValue

public int getDevicePropValue(int propcode,
                              DevicePropValue value)
                       throws java.io.IOException
Gets the value of the specified device property. The same value is also seen through getDevicePropDesc.
Parameters:
propcode - code identifying the property of interest
value - the value to be filled
Returns:
response code

getImageHandles

public int[] getImageHandles(int storageID,
                             int association)
                      throws java.io.IOException
Returns an array of image handles in the store (or stores) specified; uses device-side filtering when it's available. Device-side filtering can substantially reduce USB traffic.
Parameters:
storageID - either ~0 to indicate all media, or the ID for some particular store.
association - either zero, or ~0 to specify the root of a store; or else an association handle.

getNumImages

public int getNumImages(int storageID,
                        int association)
                 throws java.io.IOException
Returns the number of images in the specified association on the specified store; uses device-side filtering when it's available.
Parameters:
storageID - either ~0 to indicate all media, or the ID for some particular store.
association - 0, or the object handle for some association

getPartialObject

public Response getPartialObject(int handle,
                                 int offset,
                                 int count)
                          throws java.io.IOException

initiateCapture

public int initiateCapture(int storageId,
                           int formatCode)
                    throws java.io.IOException
Starts the capture of one (or more) new data objects, according to current device properties. The capture will complete without issuing further commands.
Parameters:
storageId - Where to store the object(s), or zero to let the device choose.
formatCode - Type of object(s) to capture, or zero to use the device default.
Returns:
status code indicating whether capture started; CaptureComplete events provide capture status, and ObjectAdded events provide per-object status.
See Also:
initiateOpenCapture(int, int)

initiateOpenCapture

public int initiateOpenCapture(int storageId,
                               int formatCode)
                        throws java.io.IOException
Starts an open-ended capture of new data objects, according to current device properties. Capturing will continue until terminateOpenCapture() is invoked. Intended applications include "manually" controlled exposures, and capture of time-based data such as audio or video.
Parameters:
storageId - Where to store the object(s), or zero to let the device choose.
formatCode - Type of object(s) to capture, or zero to use the device default.
Returns:
status code indicating whether capture started; CaptureComplete events provide capture status, and ObjectAdded events provide per-object status.
See Also:
initiateCapture(int, int)

moveObject

public int moveObject(int handle,
                      int storageId,
                      int parent)
               throws java.io.IOException

powerDown

public int powerDown()
              throws java.io.IOException
Sends a PowerDown command to the device, causing it to power down and close all currently open sessions.
Returns:
response code

resetDevice

public int resetDevice()
                throws java.io.IOException
Sends a ResetDevice command to the device, putting it into a default state and closing all open sessions.

resetDevicePropValue

public int resetDevicePropValue(int propcode)
                         throws java.io.IOException
Resets the value of the specified device property to the factory default.
Parameters:
propcode - code identifying the property of interest
Returns:
response code

selfTest

public int selfTest(int type)
             throws java.io.IOException
Sends a SelfTest command to the device.
Parameters:
type - typically zero, or a vendor-defined code
Returns:
response code

setDevicePropValue

public int setDevicePropValue(int propcode,
                              DevicePropValue value)
                       throws java.io.IOException
Sets the value of the specified device property. The same value is also seen through getDevicePropDesc.
Parameters:
propcode - code identifying the property of interest
value - the value to be assigned
Returns:
response code

setObjectProtection

public int setObjectProtection(int handle,
                               int status)
                        throws java.io.IOException

terminateOpenCapture

public int terminateOpenCapture()
                         throws java.io.IOException
Closes the current session's open capture operation.
See Also:
initiateOpenCapture(int, int)


Associated source code is licenced under the GPL.
See http://jphoto.sourceforge.net
This documentation was derived from that source code on 2001-04-12.