jcontrol.system
Class Download

java.lang.Object
  extended by jcontrol.system.Download
All Implemented Interfaces:
Runnable

public class Download
extends Object
implements Runnable

Manages the download of new Java software to a JControl module.

The downloader is automatically invoked by the virtual machine if no application is found in the current memory bank. You can also invoke the downloader from an application using the run method.

Author:
Andreas Wesseler, Helge Böhme
Available on JControl Devices:
all

Field Summary
 boolean error
          Error flag, set to true if the download-process terminated abnormal.
 
Constructor Summary
Download()
          Constructs a new Downloader.
 
Method Summary
static void main(String[] args)
          Program entry point, will be started if no application is loaded into the Device.
 void run()
          Main Download code sequence.
 int xReceive(byte[] data)
          XModem receive sequence.
 void xTransmit(byte[] data)
          XModem transmit sequence.
 
Methods inherited from class java.lang.Object
clone, equals, notifyAll, wait
 

Field Detail

error

public boolean error
Error flag, set to true if the download-process terminated abnormal.

Constructor Detail

Download

public Download()
         throws IOException
Constructs a new Downloader.

Throws:
IOException
Method Detail

main

public static void main(String[] args)
                 throws IOException
Program entry point, will be started if no application is loaded into the Device.

Parameters:
args -
Throws:
IOException

run

public void run()
Main Download code sequence. Directly callable or using a Thread. In both cases invocation is only possible once (you have to create a new instance for a new call). If code is written to flash memory this method never returns (a virtual machine restart is performed).

Specified by:
run in interface Runnable
See Also:
Runnable.run()

xReceive

public int xReceive(byte[] data)
             throws IOException
XModem receive sequence. Part of the download sequence. You can use this code from your application for other purposes, too.

Parameters:
data - array to fill with received data (size: a multiple of 128)
Throws:
IOException - if the reception failed

xTransmit

public void xTransmit(byte[] data)
               throws IOException
XModem transmit sequence. Part of the download sequence. You can use this code from your application for other purposes, too.

Parameters:
data - to transmit (size: a multiple of 128)
Throws:
IOException - if the transmission failed