Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jempeg.empeg.protocol
Class Upgrader  view Upgrader download Upgrader.java

java.lang.Object
  extended byorg.jempeg.empeg.protocol.Upgrader

public class Upgrader
extends java.lang.Object

Version:
$Revision: 1.9 $

Nested Class Summary
static class Upgrader.SerialDiscovererListener
           
 
Field Summary
private  byte[] myBuf32
           
private  byte[] myBuffer
           
private  ConnectionIfc myConnection
           
private  java.lang.String myInfo
           
private  UpgradeListenerIfc myListener
           
private  int myManufacturer
           
private  int myProduct
           
private  java.lang.String myRelease
           
private  long mySection
           
private  org.jempeg.empeg.core.SeekableInputStream myUploadData
           
private  java.lang.String myVersion
           
private  java.lang.String myWhat
           
 
Constructor Summary
Upgrader()
           
 
Method Summary
 void checkUpgrade(org.jempeg.empeg.core.SeekableInputStream _upgradeData)
          Verify the upgrade file to make sure it's kosher.
 void close()
           
private  void closeConnection()
           
private  void commandAddress(char _command, int _address)
          Generic command
 void doUpgrade(ConnectionIfc _connection)
           
private  void dumpText()
           
private  void erasePage(int _address)
          Erase page of flash
private  void error(int _state)
          Status reporting for errors.
private  void flashArea(int _address, int _length)
          Flash an area in the unit's flash ROM: erase as necessary
private  void flushRx()
          Flush input buffer
private  int getHwRev()
          Returns the the hardware revision # of this player.
private  void initializeConnection(ConnectionIfc _connection)
           
private  void lockPage(int _address)
          Lock page of flash (C3 flash only)
static void main(java.lang.String[] _args)
           
private  void partition(java.lang.String _partitionName)
          Size partition
private  void programBlock(int _address, int _length)
          Program flash rom from ram buffer
private  void pumpPartition(java.lang.String _partitionName, int _length)
          Pump a partition with gzipped data
private  int readDec(int _timeout)
          Read a decimal value
private  int readHex(int _timeout, int _digits)
          Read a hex value
private  int readL()
           
private  java.lang.String readString(long _length)
           
private  long readUL()
          Read a 32 bit little-endian unsigned long from the file.
 void setListener(UpgradeListenerIfc _listener)
           
private  int sizePartition(java.lang.String _partitionName)
          Get the size of a partition.
private  void startFlash()
          Enter flash ROM download
private  void startPump()
          Enter disk pumper
private  void status(int _state)
          Status reporting for when we don't have much to say
private  void status(int _stage, int _percent)
           
private  void status(int _state, int _current, int _max)
          Status reporting
private  void unlockPage(int _address)
          Unlock page of flash (C3 flash only)
 void upload(ConnectionIfc _connection, org.jempeg.empeg.core.SeekableInputStream _uploadData, int _address)
          Uploads the given stream of data to a specifc address of the Empeg.
private  boolean waitFor(java.lang.String _string, int _timeout)
          Waits for a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myConnection

private ConnectionIfc myConnection

myUploadData

private org.jempeg.empeg.core.SeekableInputStream myUploadData

myBuf32

private byte[] myBuf32

myBuffer

private byte[] myBuffer

mySection

private long mySection

myListener

private UpgradeListenerIfc myListener

myManufacturer

private int myManufacturer

myProduct

private int myProduct

myInfo

private java.lang.String myInfo

myWhat

private java.lang.String myWhat

myRelease

private java.lang.String myRelease

myVersion

private java.lang.String myVersion
Constructor Detail

Upgrader

public Upgrader()
Method Detail

close

public void close()
           throws java.io.IOException

checkUpgrade

public void checkUpgrade(org.jempeg.empeg.core.SeekableInputStream _upgradeData)
                  throws java.io.IOException
Verify the upgrade file to make sure it's kosher. Tell the observer about any text we find in it.


upload

public void upload(ConnectionIfc _connection,
                   org.jempeg.empeg.core.SeekableInputStream _uploadData,
                   int _address)
            throws java.io.IOException
Uploads the given stream of data to a specifc address of the Empeg.


doUpgrade

public void doUpgrade(ConnectionIfc _connection)
               throws java.io.IOException

setListener

public void setListener(UpgradeListenerIfc _listener)

initializeConnection

private void initializeConnection(ConnectionIfc _connection)
                           throws java.io.IOException

closeConnection

private void closeConnection()
                      throws java.io.IOException

getHwRev

private int getHwRev()
              throws java.io.IOException
Returns the the hardware revision # of this player.


readUL

private long readUL()
             throws java.io.IOException
Read a 32 bit little-endian unsigned long from the file.


readL

private int readL()
           throws java.io.IOException

readString

private java.lang.String readString(long _length)
                             throws java.io.IOException

waitFor

private boolean waitFor(java.lang.String _string,
                        int _timeout)
                 throws java.io.IOException
Waits for a string. waitFor times out only when there's no data for n seconds. The whole string is sent in one, so will never span across calls.


readHex

private int readHex(int _timeout,
                    int _digits)
             throws java.io.IOException
Read a hex value


readDec

private int readDec(int _timeout)
             throws java.io.IOException
Read a decimal value


commandAddress

private void commandAddress(char _command,
                            int _address)
                     throws java.io.IOException
Generic command


erasePage

private void erasePage(int _address)
                throws java.io.IOException
Erase page of flash


lockPage

private void lockPage(int _address)
               throws java.io.IOException
Lock page of flash (C3 flash only)


unlockPage

private void unlockPage(int _address)
                 throws java.io.IOException
Unlock page of flash (C3 flash only)


programBlock

private void programBlock(int _address,
                          int _length)
                   throws java.io.IOException
Program flash rom from ram buffer


flushRx

private void flushRx()
              throws java.io.IOException
Flush input buffer


status

private void status(int _stage,
                    int _percent)

startFlash

private void startFlash()
                 throws java.io.IOException
Enter flash ROM download


flashArea

private void flashArea(int _address,
                       int _length)
                throws java.io.IOException
Flash an area in the unit's flash ROM: erase as necessary


startPump

private void startPump()
                throws java.io.IOException
Enter disk pumper


pumpPartition

private void pumpPartition(java.lang.String _partitionName,
                           int _length)
                    throws java.io.IOException
Pump a partition with gzipped data


sizePartition

private int sizePartition(java.lang.String _partitionName)
                   throws java.io.IOException
Get the size of a partition.


partition

private void partition(java.lang.String _partitionName)
                throws java.io.IOException
Size partition


status

private void status(int _state,
                    int _current,
                    int _max)
Status reporting


status

private void status(int _state)
Status reporting for when we don't have much to say


error

private void error(int _state)
Status reporting for errors.


dumpText

private void dumpText()
               throws java.io.IOException

main

public static void main(java.lang.String[] _args)
                 throws java.lang.Throwable