ztex
Class ZtexIhxFile1

java.lang.Object
  extended by ztex.IhxFile
      extended by ztex.ZtexIhxFile1

public class ZtexIhxFile1
extends IhxFile

Represents a firmware image with ZTEX descriptor 1 loaded from an ihx (Intel Hex format) file.
The ZTEX descriptor is usually located at the position 0x6x of the firmware image.
A description of the ZTEX descriptor 1 can be found in ZtexDevice1.

See Also:
ZtexDevice1, Ztex1

Field Summary
 
Fields inherited from class ztex.IhxFile
ihxData
 
Constructor Summary
ZtexIhxFile1(java.io.InputStream in, java.lang.String name)
          Constructs an instance from a given file name and descriptor position.
ZtexIhxFile1(java.io.InputStream in, java.lang.String name, int pZtexDescriptorOffs)
          Constructs an instance from a given file name and descriptor position.
ZtexIhxFile1(java.lang.String fileName)
          Constructs an instance from a given file name.
ZtexIhxFile1(java.lang.String fileName, int pZtexDescriptorOffs)
          Constructs an instance from a given file name and descriptor position.
 
Method Summary
 int fwVersion()
          Returns the firmware version.
 byte[] interfaceCapabilities()
          Returns the interface capabilities (all 6 bytes).
 int interfaceCapabilities(int i)
          Returns byte i of the interface capabilities.
 int interfaceVersion()
          Returns the interface version.
 byte[] moduleReserved()
          Returns the application specific information (all 12 bytes).
 int moduleReserved(int i)
          Returns byte i of the application specific information.
 byte[] productId()
          Returns the product ID (all 4 bytes).
 int productId(int i)
          Returns byte i of the product ID.
 void setSnString(java.lang.String s)
          Modifies the serial number string.
 java.lang.String snString()
          Returns the serial number string.
 java.lang.String toString()
          Returns a string representation if the instance.
 
Methods inherited from class ztex.IhxFile
dataInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZtexIhxFile1

public ZtexIhxFile1(java.io.InputStream in,
                    java.lang.String name,
                    int pZtexDescriptorOffs)
             throws java.io.IOException,
                    IhxFileDamagedException,
                    IncompatibleFirmwareException
Constructs an instance from a given file name and descriptor position.
This method can also read system resources, e.g. files from the current jar archive.

Parameters:
in - Input stream from which the ihx file is read.
name - Name of the input.
pZtexDescriptorOffs - The position of the descriptor in bytes. The default position is 0x6c.
Throws:
java.io.IOException - If an read error occurred.
IhxFileDamagedException - If the ihx file is damaged.
IncompatibleFirmwareException - If the firmware image contains no valid ZTEX descriptor 1 at the specified position.

ZtexIhxFile1

public ZtexIhxFile1(java.io.InputStream in,
                    java.lang.String name)
             throws java.io.IOException,
                    IhxFileDamagedException,
                    IncompatibleFirmwareException
Constructs an instance from a given file name and descriptor position.
The ZTEX descriptor 1 is expected to be at the position 0x6c of the firmware image.
This method can also read system resources, e.g. files from the current jar archive.

Parameters:
in - Input stream from which the ihx file is read.
name - Name of the input.
Throws:
java.io.IOException - If an read error occurred.
IhxFileDamagedException - If the ihx file is damaged.
IncompatibleFirmwareException - If the firmware image contains no valid ZTEX descriptor 1 at the specified position.

ZtexIhxFile1

public ZtexIhxFile1(java.lang.String fileName,
                    int pZtexDescriptorOffs)
             throws java.io.IOException,
                    IhxFileDamagedException,
                    IncompatibleFirmwareException
Constructs an instance from a given file name and descriptor position.
This method can also read system resources, e.g. files from the current jar archive.

Parameters:
fileName - The file name.
pZtexDescriptorOffs - The position of the descriptor in bytes. The default position is 0x6c.
Throws:
java.io.IOException - If an read error occurred.
IhxFileDamagedException - If the ihx file is damaged.
IncompatibleFirmwareException - If the firmware image contains no valid ZTEX descriptor 1 at the specified position.

ZtexIhxFile1

public ZtexIhxFile1(java.lang.String fileName)
             throws java.io.IOException,
                    IhxFileDamagedException,
                    IncompatibleFirmwareException
Constructs an instance from a given file name. The ZTEX descriptor 1 is expected to be at the position 0x6c of the firmware image.
This method can also read system resources, e.g. files from the current jar archive.

Parameters:
fileName - The file name.
Throws:
java.io.IOException - If an read error occurred.
IhxFileDamagedException - If the ihx file is damaged.
IncompatibleFirmwareException - If the firmware image contains no valid ZTEX descriptor 1 at the specified position.
Method Detail

productId

public final byte[] productId()
Returns the product ID (all 4 bytes).

Returns:
PRODUCT_ID, see ZtexDevice1.

productId

public int productId(int i)
Returns byte i of the product ID.

Parameters:
i - index
Returns:
PRODUCT_ID[i], see ZtexDevice1.

fwVersion

public final int fwVersion()
Returns the firmware version.

Returns:
FW_VERSION, see ZtexDevice1.

interfaceVersion

public final int interfaceVersion()
Returns the interface version.

Returns:
INTERFACE_VERSION, see ZtexDevice1.

interfaceCapabilities

public final byte[] interfaceCapabilities()
Returns the interface capabilities (all 6 bytes).

Returns:
INTERFACE_CAPABILITIES, see ZtexDevice1.

interfaceCapabilities

public final int interfaceCapabilities(int i)
Returns byte i of the interface capabilities.

Parameters:
i - index
Returns:
INTERFACE_CAPABILITIES[i], see ZtexDevice1.

moduleReserved

public final byte[] moduleReserved()
Returns the application specific information (all 12 bytes).

Returns:
MODULE_RESERVED, see ZtexDevice1.

moduleReserved

public final int moduleReserved(int i)
Returns byte i of the application specific information.

Parameters:
i - index
Returns:
MODULE_RESERVED[i], see ZtexDevice1.

snString

public final java.lang.String snString()
Returns the serial number string.

Returns:
SN_STRING, see ZtexDevice1.

setSnString

public final void setSnString(java.lang.String s)
                       throws IncompatibleFirmwareException
Modifies the serial number string.

Parameters:
s - The new serial number string which must not be longer then 10 characters.
Throws:
IncompatibleFirmwareException

toString

public java.lang.String toString()
Returns a string representation if the instance.

Overrides:
toString in class java.lang.Object
Returns:
a string representation if the instance.