neto
Class NetO

java.lang.Object
  extended byneto.NetO

public class NetO
extends java.lang.Object

The NetO class should be used when one wants to develop an application for exchanging data between a computer and one or more handheld terminals and/or datacollectors.

If it is desired to use the events which are generated by NetO, it should be done as in the next codesample:

 import neto.*;

 public class fraMain extends JFrame implements ProgressListener, ShowPollListener, ProtocolMessageListener
 {
     private NetO NetoCtl = new NetO();
     JPanel contentPane;
     //... (more variables)

     //Construct the frame
     public fraMain()
     {
         enableEvents(AWTEvent.WINDOW_EVENT_MASK);
         try
         {
             NetoCtl.addProgressListener(this);
             NetoCtl.addProtocolMessageListener(this);
             NetoCtl.addShowPollListener(this);
             jbInit();
         }
         catch (Exception e)
         {
             e.printStackTrace();
         }
     }

     //... (more functions)

     public void Progress(ProgressEvent progress)
     {
         jtaOutput.append("Port = " + progress.getPort() + "\n" +
                          "Current % = " + progress.GetCurrentPercentage() + "\n" +
                          "Total % = " + progress.GetTotalPercentage());
     }

     public void ProtocolMessage(ProtocolMessageEvent protMsg)
     {
         jtaOutput.append("Port = " + protMsg.getPort() + "\n" +
                          "Message code = " + protMsg.GetMsgCode() + "\n" +
                          "Message string = " + protMsg.GetMessage() + "\n" +
                          "Is final? = " + protMsg.GetFinal());
     }

     public void ShowPoll(ShowPollEvent showPollEvent)
     {
         jtaOutput.append("Port = " + showPollEvent.getPort() + "\n" +
                          "terminal id = " + showPollEvent.getTerminalId());
     }
 }
 

Version:
EGF28203
Author:
Vincent Ramp

Field Summary
static short COM_BOTH
           
static short COM_DOWNLOAD
           
static short COM_UPLOAD
           
static short DOWN_APPEND
           
static short DOWN_NEW
           
static short DOWN_OVERWRITE
           
static short IRDA_ACTISYS_220L_PLUS
           
static short IRDA_IRU_1300
           
static short IRDA_NONE
           
static short IRDA_PARALLAX_LITELINK
           
static short IRDA_TEKRAM
           
 
Constructor Summary
NetO()
          Initializes NetO.
 
Method Summary
 void addProgressListener(ProgressListener l)
          the addProgressListener method registers a ProgressListener object to listen to ShowPoll events.
 void addProtocolMessageListener(ProtocolMessageListener l)
          the addProtocolMessageListener method registers a ProtocolMessageListener object to listen to ProtocolMessage events.
 void addShowPollListener(ShowPollListener l)
          the addShowPollListener method registers a ShowPollListener object to listen to ShowPoll events.
 int AddToList(java.lang.String id, java.lang.String[] files, java.lang.String rcv_dir, short down_type, short com_type)
          The AddToList method adds a new terminal id with it's specific settings to the list.
 int DeleteAllListItems()
          The DeleteAllListItems method removes all entered list items from memory.
 int DeleteListItem(int list_position)
          The DeleteListItem method removes one handheld terminal id item from memory if possible.
 void Destroy()
          The Destoy method destroys NetO.
 int Download(java.lang.String id, java.lang.String rcv_dir, short down_type)
          The Download method starts the transfer of files from the handheld terminal to PC.
 int getBaud_rate()
           
 int getData_bits()
           
 short getIrda_device()
           
 int GetListItem(int list_position, java.lang.String[] id, java.lang.String[][] files, java.lang.String[] rcv_dir, short[] down_type, short[] com_type)
          The GetListItem method gets the entered parameters of a selected list number.
 int GetMaxPackageLength()
           
 int GetNumberOfListItems()
          The GetNumberOfListItems method returns the number of handheld terminal items in the list that is stored in memory.
 int getParity_bits()
           
 int getPoll_speed()
           
 int getPoll_timeout()
           
 int getRxtx_delay()
           
 java.lang.String getSerial_port()
           
 java.util.ArrayList GetSerialPortList()
          The GetSerialPortList method returns an Arraylist with all available serial ports on the system.
 int getStop_bits()
           
 int InsertToList(int list_position, java.lang.String id, java.lang.String[] files, java.lang.String rcv_dir, short down_type, short com_type)
          The InsertToList method adds a new terminal id with it's specific settings to the list.
 int IsProtocolRunning()
          The IsProtocolRunning method indicates if the protocol is running.
 void removeProgressListener(ProgressListener l)
          the removeProgressListener method deregisters a ProgressListener object registered using addProgressListener.
 void removeProtocolMessageListener(ProtocolMessageListener l)
          the removeProtocolMessageListener method deregisters a ProtocolMessageListener object registered using addProtocolMessageListener.
 void removeShowPollListener(ShowPollListener l)
          the removeShowPollListener method deregisters a ShowPollListener object registered using addShowPollListener.
 void setBaud_rate(int baudrate)
          By using the setBaud_rate method, the communication speed will be changed.
 void setData_bits(int bytesize)
          The setData_bits method changes the number of bits that are used per byte.
 void setIrda_device(short irda)
          The setIrda_device method sets the serial port with an IrDA adapter.
 void SetMaxPackageLength(int newlength)
          The SetMaxPackageLength method is used to change the size of the package to send data from the PC to the terminal.
 void setParity_bits(int parity)
          The setParity_bits changes the parity setting.
 void setPoll_speed(int pollspeed)
          By calling setPoll_speed the time between two polls is set.
 void setPoll_timeout(int miliseconds)
          The SetPoll_timeout method sets the time when the protocol stops on no answer at the polls.
 void setRxtx_delay(int rxtxdelay)
          Using setRxtx_delay will set the time between the sending and receiving of data.
 void setSerial_port(java.lang.String serialport)
          The setSerial_port method changes the serial port that will used by the protocol.
 void setStop_bits(int stopbits)
          The setStop_bits method sets the number of stop bits to be used.
 int StartListNeto()
          The StartListNeto method starts the continuous protocol.
 void StopRunning()
          The StopRunning method interrupts the running protocol and stops communication between PC and handheld terminal.
 int UpDownload(java.lang.String id, java.lang.String[] files, java.lang.String rcv_dir, short down_type, short com_type)
          The UpDownload method has the functionality of the Upload and the Download methods.
 int Upload(java.lang.String id, java.lang.String[] files)
          The Upload method starts the transfer of files from the PC to the handheld terminal.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COM_BOTH

public static final short COM_BOTH
See Also:
Constant Field Values

COM_DOWNLOAD

public static final short COM_DOWNLOAD
See Also:
Constant Field Values

COM_UPLOAD

public static final short COM_UPLOAD
See Also:
Constant Field Values

DOWN_APPEND

public static final short DOWN_APPEND
See Also:
Constant Field Values

DOWN_NEW

public static final short DOWN_NEW
See Also:
Constant Field Values

DOWN_OVERWRITE

public static final short DOWN_OVERWRITE
See Also:
Constant Field Values

IRDA_ACTISYS_220L_PLUS

public static final short IRDA_ACTISYS_220L_PLUS
See Also:
Constant Field Values

IRDA_IRU_1300

public static final short IRDA_IRU_1300
See Also:
Constant Field Values

IRDA_NONE

public static final short IRDA_NONE
See Also:
Constant Field Values

IRDA_PARALLAX_LITELINK

public static final short IRDA_PARALLAX_LITELINK
See Also:
Constant Field Values

IRDA_TEKRAM

public static final short IRDA_TEKRAM
See Also:
Constant Field Values
Constructor Detail

NetO

public NetO()
Initializes NetO.

Method Detail

addProgressListener

public void addProgressListener(ProgressListener l)
the addProgressListener method registers a ProgressListener object to listen to ShowPoll events.

Parameters:
l - A ProgressListener object whose Progress method will be called.

addProtocolMessageListener

public void addProtocolMessageListener(ProtocolMessageListener l)
the addProtocolMessageListener method registers a ProtocolMessageListener object to listen to ProtocolMessage events.

Parameters:
l - A ProtocolMessageListener object whose ProtocolMessage method will be called.

addShowPollListener

public void addShowPollListener(ShowPollListener l)
the addShowPollListener method registers a ShowPollListener object to listen to ShowPoll events.

Parameters:
l - A ShowPollListener object whose ShowPoll method will be called.

AddToList

public int AddToList(java.lang.String id,
                     java.lang.String[] files,
                     java.lang.String rcv_dir,
                     short down_type,
                     short com_type)
The AddToList method adds a new terminal id with it's specific settings to the list. The AddToList method appends this new terminal id to the back of the list. When the StartListNeto method is called, all terminal id's that are set by the AddToList methods are polled. The RS232 settings have to be set by the properties.

The id parameter has a maximum of 6 characters. These characters can be numeric or any other alphanumeric type. There is one specific id where all hand held terminals will answer on, this id is "&&&&&&". This specific id should not be used in a RS485 multidrop network.

The filenames in the files parameter must match the filename and pathname on the PC. The NetO ActiveX control supports both short and long filenames and pathnames. Notice that the terminal only supports the short format without the path. NetO converts a long filename to a short filename. A short filename has the 8.3 format.

The rcv_dir is the directory (path) where the downloaded files will be stored. The rcv_dir parameter can handle short and long pathnames. The files that are received from the handheld terminal are always in a short (8.3) format.

 void btnAddToList_actionPerformed(ActionEvent e)
 {
     String file_array[] = new String[3];

     file_array[0] = "c:\\My Documents\\file1.txt";
     file_array[1] = "c:\\My Documents\\file2.txt";
     file_array[2] = "c:\\My Documents\\file3.txt";

     NetoCtl.AddToList("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);
 }
 

Parameters:
id - A string expression that must match a handheld terminal id.
files - An array of strings that holds filenames that need to be uploaded on a handheld terminal.
rcv_dir - A string expression that holds the directory where the files will be stored.
down_type - A short expression that controls how the files are downloaded to the PC. Valid values are DOWN_APPEND, DOWN_OVERWRITE, DOWN_NEW.
com_type - A short expression that controls the way of communication. Valid values are COM_UPLOAD, COM_DOWNLOAD, COM_BOTH.
Returns:
1: all went right; -1: Protocol already running; -2: Protocol cannot start; -3: Terminal ID is not (properly) set; -4: RcvDir parameter is not (properly) set; -5: Downtype parameter is not (properly) set; -6: Files parameter is not (properly) set; -7: ComType parameter is not (properly) set.

DeleteAllListItems

public int DeleteAllListItems()
The DeleteAllListItems method removes all entered list items from memory.
 void btnDeleteAllListItems_actionPerformed(ActionEvent e)
 {
     NetoCtl.DeleteAllListItems();
 }
 

Returns:
1: all went right; -1: Protocol already running.

DeleteListItem

public int DeleteListItem(int list_position)
The DeleteListItem method removes one handheld terminal id item from memory if possible. For example, if the first handheld terminal id is removed from the list, the second id becomes the first handheld terminal id in the list.

The list_position parameter starts with 0. To remove the first item from the list, the list_position parameter needs to be 0. The list_position item that needs to be removed = (n-1).

 void btnDeleteListItem_actionPerformed(ActionEvent e)
 {
     String file_array[] = new String[3];

     file_array[0] = "c:\\My Documents\\file1.txt";
     file_array[1] = "c:\\My Documents\\file2.txt";
     file_array[2] = "c:\\My Documents\\file3.txt";

     //add first item
     NetoCtl.AddToList("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);
     //add second item
     NetoCtl.AddToList("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);

     jtaOutput.append(NetoCtl.GetNumberOfListItems() + " list item(s)\n");

     //Delete the first list item
     NetoCtl.DeleteListItem(0);

     jtaOutput.append(NetoCtl.GetNumberOfListItems() + " list item(s)\n");
 }
 

Parameters:
list_position - An integer expression that indicates the list item that needs to be removed from memory.
Returns:
1: all went right; -1: Protocol already running; -8: List number that is out of range.

Destroy

public void Destroy()
The Destoy method destroys NetO. It stops all timers. If this method is not called before closing the application, NetO will end-up in a deadlock, and the application will not be closed.


Download

public int Download(java.lang.String id,
                    java.lang.String rcv_dir,
                    short down_type)
The Download method starts the transfer of files from the handheld terminal to PC. The Download function tries to make contact with the handheld terminal with the RS232 settings that are set by the properties(). When starting the protocol make sure that the settings of NetO match the setting on the handheld terminal. If these settings do not match, communication is not possible.

The id parameter has a maximum of 6 characters. These characters can be numeric or any other alphanumeric type. There is one specific id where all hand held terminals will answer on, this id is "&&&&&&". This specific id should not be used in a RS485 multidrop network.

The rcv_dir is the directory (path) where the downloaded files will be stored. The rcv_dir parameter can handle short and long pathnames. The files that are received from the handheld terminal are always in a short (8.3) format.

 void btnDownload_actionPerformed(ActionEvent e)
 {
     NetoCtl.setBaud_rate(115200);            //communication speed is 115200 baud
     NetoCtl.setData_bits(8);                 //8 bits per byte
     NetoCtl.setIrda_device(NetO.IRDA_NONE);  //No IrDA device connected to the serial port
     NetoCtl.setParity_bits(0);               //No parity
     NetoCtl.setPoll_speed(150);              //every 150 ms a poll
     NetoCtl.setRxtx_delay(1);                //1 ms delay between sending and receiving
     NetoCtl.setSerial_port("com1");          //COM1
     NetoCtl.setStop_bits(0);                 //1 stopbit
     NetoCtl.setPoll_timeout(10000); //quit after 10 seconds

     NetoCtl.Download("&&&&&&", "c:\\neto temp", NetO.DOWN_OVERWRITE);
 }
 

Parameters:
id - A string expression that must match a handheld terminal id.
rcv_dir - A string expression that holds the directory where the files will be stored.
down_type - A short expression that controls how the files are downloaded to the PC. Valid values are DOWN_APPEND, DOWN_OVERWRITE, DOWN_NEW.
Returns:
1: all went right; -1: Protocol already running; -2: Protocol cannot start; -3: Terminal ID is not (properly) set; -4: RcvDir parameter is not (properly) set; -5: Downtype parameter is not (properly) set.

getBaud_rate

public int getBaud_rate()

getData_bits

public int getData_bits()

getIrda_device

public short getIrda_device()

GetListItem

public int GetListItem(int list_position,
                       java.lang.String[] id,
                       java.lang.String[][] files,
                       java.lang.String[] rcv_dir,
                       short[] down_type,
                       short[] com_type)
The GetListItem method gets the entered parameters of a selected list number. It reads parameters that have been set by AddToList method. With this function and the DeleteListItem it is easy to determine which listnr needs to be removed.

The listnr parameter starts with 0. To insert a listitem at the first item from the list the listnr parameter needs to be 0. To insert a list item at a specific position the listnr needs to be inserted = (n-1).

The id parameter has a maximum of 6 characters. These characters can be numeric or any other alphanumeric type. There is one specific id where all hand held terminals will answer on, this id is "&&&&&&". This specific id should not be used in a RS485 multidrop network.

The filenames in the files parameter must match the filename and pathname on the PC. The NetO ActiveX control supports both short and long filenames and pathnames. Notice that the terminal only supports the short format without the path. NetO converts a long filename to a short filename. A short filename has the 8.3 format.

The rcv_dir is the directory (path) where the downloaded files will be stored. The rcv_dir parameter can handle short and long pathnames. The files that are received from the handheld terminal are always in a short (8.3) format.

 void btnGetListItem_actionPerformed(ActionEvent e)
 {
     String file_array[] = new String[3];
     String[][] rcv_files = new String[1][];
     String[] id = new String[1],
              rcv_dir = new String[1];
     short[]  down_type  = new short[1],
              com_type = new short[1];

     file_array[0] = "c:\\My Documents\\file1.txt";
     file_array[1] = "c:\\My Documents\\file2.txt";
     file_array[2] = "c:\\My Documents\\file3.txt";

     //add first item
     NetoCtl.AddToList("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);
     //add second item
     NetoCtl.AddToList("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);

     NetoCtl.GetListItem(0, id, rcv_files, rcv_dir, down_type, com_type);

     jtaOutput.append("id = " + id[0] + "\nFile = " + rcv_files[0][0] + "\nrcv_dir = " + rcv_dir[0] + "\n");
 }
 

Parameters:
list_position - Integer expression to indicate where to insert the list item into the list.
id - A string expression that must match a handheld terminal id.
files - An array of strings that holds filenames that need to be uploaded on a handheld terminal.
rcv_dir - A string expression that holds the directory where the files will be stored.
down_type - A short expression that controls how the files are downloaded to the PC. Valid values are DOWN_APPEND, DOWN_OVERWRITE, DOWN_NEW.
com_type - A short expression that controls the way of communication. Valid values are COM_UPLOAD, COM_DOWNLOAD, COM_BOTH.
Returns:
1: all went right; -8: List number that is out of range.

GetMaxPackageLength

public int GetMaxPackageLength()

GetNumberOfListItems

public int GetNumberOfListItems()
The GetNumberOfListItems method returns the number of handheld terminal items in the list that is stored in memory.
 void btnGetNumberOfListItems_actionPerformed(ActionEvent e)
 {
     String file_array[] = new String[3];

     file_array[0] = "c:\\My Documents\\file1.txt";
     file_array[1] = "c:\\My Documents\\file2.txt";
     file_array[2] = "c:\\My Documents\\file3.txt";

     //add first item
     NetoCtl.AddToList("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);
     //add second item
     NetoCtl.AddToList("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);

     jtaOutput.append(NetoCtl.GetNumberOfListItems() + " list item(s)\n");
 }
 

Returns:
The number of handheld terminal list items in memory.

getParity_bits

public int getParity_bits()

getPoll_speed

public int getPoll_speed()

getPoll_timeout

public int getPoll_timeout()

getRxtx_delay

public int getRxtx_delay()

getSerial_port

public java.lang.String getSerial_port()

GetSerialPortList

public java.util.ArrayList GetSerialPortList()
The GetSerialPortList method returns an Arraylist with all available serial ports on the system. When using this on Linux only the "ttyX" part is returned. When using this function on Mac OS X, the part behind "tty." is returned.

Returns:
An arraylist containing the available serial ports on the system.

getStop_bits

public int getStop_bits()

InsertToList

public int InsertToList(int list_position,
                        java.lang.String id,
                        java.lang.String[] files,
                        java.lang.String rcv_dir,
                        short down_type,
                        short com_type)
The InsertToList method adds a new terminal id with it's specific settings to the list. The InsertToList method inserts the list item to specified position in the list. When the StartListNeto method is called, all terminal id's that are set by the InsertToList methods are polled. The RS232 settings have to be set by the properties.

The listnr parameter starts with 0. To insert a listitem at the first item from the list the listnr parameter needs to be 0. To insert a list item at a specific position the listnr needs to be inserted = (n-1).

The id parameter has a maximum of 6 characters. These characters can be numeric or any other alphanumeric type. There is one specific id where all hand held terminals will answer on, this id is "&&&&&&". This specific id should not be used in a RS485 multidrop network.

The filenames in the files parameter must match the filename and pathname on the PC. The NetO ActiveX control supports both short and long filenames and pathnames. Notice that the terminal only supports the short format without the path. NetO converts a long filename to a short filename. A short filename has the 8.3 format.

The rcv_dir is the directory (path) where the downloaded files will be stored. The rcv_dir parameter can handle short and long pathnames. The files that are received from the handheld terminal are always in a short (8.3) format.

 void btnInsertToList_actionPerformed(ActionEvent e)
 {
     String file_array[] = new String[3];

     file_array[0] = "c:\\My Documents\\file1.txt";
     file_array[1] = "c:\\My Documents\\file2.txt";
     file_array[2] = "c:\\My Documents\\file3.txt";

     NetoCtl.InsertToList(0, "&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);
 }
 

Parameters:
list_position - Integer expression to indicate where to insert the list item into the list.
id - A string expression that must match a handheld terminal id.
files - An array of strings that holds filenames that need to be uploaded on a handheld terminal.
rcv_dir - A string expression that holds the directory where the files will be stored.
down_type - A short expression that controls how the files are downloaded to the PC. Valid values are DOWN_APPEND, DOWN_OVERWRITE, DOWN_NEW.
com_type - A short expression that controls the way of communication. Valid values are COM_UPLOAD, COM_DOWNLOAD, COM_BOTH.
Returns:
1: all went right; -1: Protocol already running; -2: Protocol cannot start; -3: Terminal ID is not (properly) set; -4: RcvDir parameter is not (properly) set; -5: Downtype parameter is not (properly) set; -6: Files parameter is not (properly) set; -7: ComType parameter is not (properly) set; -8: List number that is out of range.

IsProtocolRunning

public int IsProtocolRunning()
The IsProtocolRunning method indicates if the protocol is running. It does not indicate what part of the protocol is running. It is not possible to see if the protocol is polling the handheld terminals or if communication is in progress between PC and handheld terminal.

Returns:
1: The protocol is running, further details are not stated; 0: The protocol is not running;

removeProgressListener

public void removeProgressListener(ProgressListener l)
the removeProgressListener method deregisters a ProgressListener object registered using addProgressListener.

Parameters:
l - A ProgressListener object whose Progress method will be called.

removeProtocolMessageListener

public void removeProtocolMessageListener(ProtocolMessageListener l)
the removeProtocolMessageListener method deregisters a ProtocolMessageListener object registered using addProtocolMessageListener.

Parameters:
l - A ProtocolMessageListener object whose ProtocolMessage method will be called.

removeShowPollListener

public void removeShowPollListener(ShowPollListener l)
the removeShowPollListener method deregisters a ShowPollListener object registered using addShowPollListener.

Parameters:
l - A ShowPollListener object whose ShowPoll method will be called.

setBaud_rate

public void setBaud_rate(int baudrate)
By using the setBaud_rate method, the communication speed will be changed. The baudrate has to match the baudrate as set on the handheld terminal.

The supported baudrates are:

 2400 Baud
 4800 Baud
 9600 Baud
 19200 Baud
 38400 Baud
 57600 Baud
 115200 Baud
 
If the baudrate is adjusted to a value that is not one of the above supported baudrates, the previous setting is maintained.

Parameters:
baudrate - Baudrate used during communication.

setData_bits

public void setData_bits(int bytesize)
The setData_bits method changes the number of bits that are used per byte. NetO supports two numbers of databits. These numbers are 7 and 8. Changing the databits to a value that is not supported, the previous setting is maintained.

Parameters:
bytesize - The number of bits (7 or 8) that are used per byte.

setIrda_device

public void setIrda_device(short irda)
The setIrda_device method sets the serial port with an IrDA adapter. NetO supports several different IrDA adapters. The most commonly used is the Parallax litelink adapter. This adapter can aslo be used for almost all cradles that support autobaud mode. Most common IrDA adapters are compatible with the irda adapters included with NetO.

Parameters:
irda - One of the IRDA_... variables.

SetMaxPackageLength

public void SetMaxPackageLength(int newlength)
The SetMaxPackageLength method is used to change the size of the package to send data from the PC to the terminal.

The default size is 2048 byte.

Changing the size to more than the default value may cause unexpected failures on the data terminal!

Parameters:
newlength - integer Must be between and inclusive 10 and 4200 byte

setParity_bits

public void setParity_bits(int parity)
The setParity_bits changes the parity setting. There are three parity settings possible. The parity that is used by NetO has to match the parity as set on the handheld terminal.

Possible parity settings:

 0 = No Parity
 1 = Odd Parity
 2 = Even Parity
 

If the parity is adjusted to an unsupported value the previous parity setting is maintained.

Parameters:
parity - 0 = No Parity; 1 = Odd Parity; 2 = Even Parity.

setPoll_speed

public void setPoll_speed(int pollspeed)
By calling setPoll_speed the time between two polls is set. For example: the default setting of 100 milliseconds means that every second 10 polls will be sent to a serial port. By increasing the pollspeed property less polls per second will be transmitted to a serial port. By decreasing the pollspeed more polls are transmitted per second to a serial port. The more polls per second NetO transmits the more burden the PC has to cope with. The minimum pollspeed value is 50, which means 20 polls per second. The maximum pollspeed value is 100000, which means 1 poll per 1000 seconds. When using a RS485 multidrop network the preferred pollspeed is determined by testing.

Parameters:
pollspeed - Integer between and inclusive 50 and 100.000 miliseconds

setPoll_timeout

public void setPoll_timeout(int miliseconds)
The SetPoll_timeout method sets the time when the protocol stops on no answer at the polls. For example When NetO is polling the serial port and the Poll_timeout is set to 3000, the protocol stop polling after 3 seconds when no handheld terminal has reacted on the polls. If the Poll_timeout value is smaller then the PollSpeed value, there is only one poll transmitted to the serial port. By setting the value of PollTimeout to -1 the Pollingtimeout time is disabled.

NOTE: When using the StartListNeto() method the Poll_timeout property is not used.

Parameters:
miliseconds - PollTimeout time in miliseconds.

setRxtx_delay

public void setRxtx_delay(int rxtxdelay)
Using setRxtx_delay will set the time between the sending and receiving of data. This property could be necessary when using a RS485 multidrop network, especially with long lines and many cradles. If the RxTxDelay is set to a very high value the handheld terminal will timeout. Setting the proper RxTxDelay property is determined by testing.

Parameters:
rxtxdelay - Integer larger than 0. The RxTxDelay is the time between the sending and receiving of data.

setSerial_port

public void setSerial_port(java.lang.String serialport)
The setSerial_port method changes the serial port that will used by the protocol. If the serial port variable is set to a port that is not available, the prevous serialport variable is maintained.

Parameters:
serialport - A string representing the serial port, which will be used to exchange data.

setStop_bits

public void setStop_bits(int stopbits)
The setStop_bits method sets the number of stop bits to be used.

The StopBits property can be one of these values.

 0 = 1 Stopbit
 1 = 1.5 Stopbits
 2 = 2 Stopbits
 

If the new entered StopBits property is changed to an unsupported value, the previous StopBits setting is maintained.

Parameters:
stopbits - int

StartListNeto

public int StartListNeto()
The StartListNeto method starts the continuous protocol. The protocol polls all handheld terminals that are added by the AddToList method. The Up or Downloading is controlled by the com_type parameter of the AddToList method. StartListNeto tries to make contact with the handheld terminal with the RS232 settings that are set by the properties.

When starting the protocol make sure that the settings of NetO match the setting on the handheld terminal. If the property settings do not match the handheld terminal settings then no communication between a handheld terminal and PC is possible.

The PollTimeout property is not used by the continuous protocol.

Continuous operation is stopped by StopRunning method call, by the destruction of NetO by calling Destroy or by a severe error.

 void btnStartListNetO_actionPerformed(ActionEvent e)
 {
     String file_array[] = new String[3];

     NetoCtl.setBaud_rate(115200);            //communication speed is 115200 baud
     NetoCtl.setData_bits(8);                 //8 bits per byte
     NetoCtl.setIrda_device(NetO.IRDA_NONE);  //No IrDA device connected to the serial port
     NetoCtl.setParity_bits(0);               //No parity
     NetoCtl.setPoll_speed(150);              //every 150 ms a poll
     NetoCtl.setRxtx_delay(1);                //1 ms delay between sending and receiving
     NetoCtl.setSerial_port("com1");          //COM1
     NetoCtl.setStop_bits(0);                 //1 stopbit

     file_array[0] = "c:\\My Documents\\file1.txt";
     file_array[1] = "c:\\My Documents\\file2.txt";
     file_array[2] = "c:\\My Documents\\file3.txt";

     //add first item
     NetoCtl.AddToList("123456", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);
     //add second item
     NetoCtl.AddToList("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);

     NetoCtl.StartListNeto();
 }
 

Returns:
1: all went right; -1: Protocol already running; -2: Protocol cannot start; -9: No list items are available.

StopRunning

public void StopRunning()
The StopRunning method interrupts the running protocol and stops communication between PC and handheld terminal. If the protocol does not run, the StopRunning Method has no influence.


UpDownload

public int UpDownload(java.lang.String id,
                      java.lang.String[] files,
                      java.lang.String rcv_dir,
                      short down_type,
                      short com_type)
The UpDownload method has the functionality of the Upload and the Download methods. With the UpDownload method data transfer from and to a handheld terminal is possible. UpDownload method can be set in a fixed Upload or Download mode or into automatic mode. The UpDownload method tries to make contact with thehand held terminal with the RS232 settings that are set by the properties. When starting the protocol make sure that the settings of NetO matches the setting on the handheld terminal. If these settings do not match communication is not possible.

The id parameter has a maximum of 6 characters. These characters can be numeric or any other alphanumeric type. There is one specific id where all hand held terminals will answer on, this id is "&&&&&&". This specific id should not be used in a RS485 multidrop network.

The filenames in the files parameter must match the filename and pathname on the PC. The NetO ActiveX control supports both short and long filenames and pathnames. Notice that the terminal only supports the short format without the path. NetO converts a long filename to a short filename. A short filename has the 8.3 format.

The rcv_dir is the directory (path) where the downloaded files will be stored. The rcv_dir parameter can handle short and long pathnames. The files that are received from the handheld terminal are always in a short (8.3) format.

 void btnUpDownload_actionPerformed(ActionEvent e)
 {
     String file_array[] = new String[3];

     NetoCtl.setBaud_rate(115200);            //communication speed is 115200 baud
     NetoCtl.setData_bits(8);                 //8 bits per byte
     NetoCtl.setIrda_device(NetO.IRDA_NONE);  //No IrDA device connected to the serial port
     NetoCtl.setParity_bits(0);               //No parity
     NetoCtl.setPoll_speed(150);              //every 150 ms a poll
     NetoCtl.setRxtx_delay(1);                //1 ms delay between sending and receiving
     NetoCtl.setSerial_port("com1");          //COM1
     NetoCtl.setStop_bits(0);                 //1 stopbit
     NetoCtl.setPoll_timeout(10000); //quit after 10 seconds

     file_array[0] = "c:\\My Documents\\file1.txt";
     file_array[1] = "c:\\My Documents\\file2.txt";
     file_array[2] = "c:\\My Documents\\file3.txt";

     NetoCtl.UpDownload("&&&&&&", file_array, "c:\\neto temp", NetO.DOWN_NEW, NetO.COM_BOTH);
 }
 

Parameters:
id - A string expression that must match a handheld terminal id.
files - An array of strings that holds filenames that need to be uploaded on a handheld terminal.
rcv_dir - A string expression that holds the directory where the files will be stored.
down_type - A short expression that controls how the files are downloaded to the PC. Valid values are DOWN_APPEND, DOWN_OVERWRITE, DOWN_NEW.
com_type - A short expression that controls the way of communication. Valid values are COM_UPLOAD, COM_DOWNLOAD, COM_BOTH.
Returns:
1: all went right; -1: Protocol already running; -2: Protocol cannot start; -3: Terminal ID is not (properly) set; -4: RcvDir parameter is not (properly) set; -5: Downtype parameter is not (properly) set; -6: Files parameter is not (properly) set; -7: ComType parameter is not (properly) set.

Upload

public int Upload(java.lang.String id,
                  java.lang.String[] files)
The Upload method starts the transfer of files from the PC to the handheld terminal. The Upload method tries to contact the handheld terminal with the RS232 settings that are set by the properties. Make sure that the properties match the settings on the handheld terminal. If these settings do not match communication is not possible.

The id parameter has a maximum of 6 characters. These characters can be numeric or any other alphanumeric type. There is one specific id where all hand held terminals will answer on, this id is "&&&&&&". This specific id should not be used in a RS485 multidrop network.

The filenames in the files parameter must match the filename and pathname on the PC. The NetO ActiveX control supports both short and long filenames and pathnames. Notice that the terminal only supports the short format without the path. NetO converts a long filename to a short filename. A short filename has the 8.3 format.

 void btnUpload_actionPerformed(ActionEvent e)
 {
     String file_array[] = new String[3];

     NetoCtl.setBaud_rate(115200);            //communication speed is 115200 baud
     NetoCtl.setData_bits(8);                 //8 bits per byte
     NetoCtl.setIrda_device(NetO.IRDA_NONE);  //No IrDA device connected to the serial port
     NetoCtl.setParity_bits(0);               //No parity
     NetoCtl.setPoll_speed(150);              //every 150 ms a poll
     NetoCtl.setRxtx_delay(1);                //1 ms delay between sending and receiving
     NetoCtl.setSerial_port("com1");          //COM1
     NetoCtl.setStop_bits(0);                 //1 stopbit
     NetoCtl.setPoll_timeout(10000);        //quit after 10 seconds

     file_array[0] = "c:\\My Documents\\file1.txt";
     file_array[1] = "c:\\My Documents\\file2.txt";
     file_array[2] = "c:\\My Documents\\file3.txt";

     NetoCtl.Upload("&&&&&&", file_array);
 }
 

Parameters:
id - A string expression that must match a handheld terminal id.
files - An array of strings that holds filenames that need to be uploaded on a handheld terminal.
Returns:
1: all went right; -1: Protocol already running; -2: Protocol cannot start; -3: Terminal ID is not (properly) set; -6: Files parameter is not (properly) set.