Serial protocol definition
Click on "Serial protocol setup" button or select "Serial
protocol" from "Setup" menu and add a new 'send' and 'receive'
serial protocol and edit them.
The serial protocol list is now
The symbols of these protocols are 's0' and 'r0' that are generated automatically by this program.
The send data protocol is
Value | 0x02 | text data | 0x03 |
Size (byte) | 1 | unknown | 1 |
Note | flag | read from a Serial Text Field (length unknown) | flag |
then the send serial protocol (s0) edit in HelloDevice IDE is
The receive data protocol is
Value | 0x02 | text data | 0x03 |
Size (byte) | 1 | unknown | 1 |
Note | flag | displayed by a Serial Label (length unknown) | flag |
This chat application will accept the data which will be sent from another
same one. First, check the byte value 0x02, and a text data
will follow. The end of the text data will be identified by a byte value 0x03.
The receive serial protocol (r0) edit in HelloDevice IDE is
When you presses the Serial Gate Button (send protocol symbol property of this button is 's0' and the symbol of above protocol is 's0') in the final product of this example, it will compose a serial data which consists of 0x02, a text data and 0x03. The text data will be read from the Serial Text Field which is already put on the design panel and the write destination of which is 'v0'. This application runs as a server also and accepts a connection and displays the received data. To accept data, there must be defined which protocol of data will be submitted. This (receive protocol 'r0') will be assigned when deploying this application.
Java application deployment
Select "Deploy -> make application" menu or press "make
application" button in the tool bar.
Then, a dialog box titled "Create application" will pop up.
Set parameters as following.
Select a folder where the output files are to be stored.
The device type is HD1300 (means serial communication).
It will be a server to a HelloDevice therefore turn on the server function.
Let's specify the server protocol 'r0'. The server protocol candidate is every
receive protocols in the protocol list. Just select one among them.
It will be a client too, so leave 'server only' check box unchecked.
Leave host address field blank. (You can always assign this address in the
runtime.)
The client/server port number is 6001.