VAB-600 is designed with enhanced features including Watch Dog, RTC Power On, Programmable GPIO, and Serial Ports.
Eclipse is Android application integrated development environment (IDE) by official recommendation. It requires to import the specific reference Java Archive file to develop VAB-600 enhance features.
Open Eclipse IDE and create an Android project. In project properties, import the smartetk.jar by clicking “Add External JARs...” into your project.
All functions and values are placed in class named com.via.vepd.SmartETK. Import this package into Java code to use them.
ID | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
GPIO | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
Other than the Boolean TRUE and FALSE return values, there are eight other types of return values found throughout the Smart ETK SDK API.
Error code | Constant |
---|---|
S_OK | 0 |
E_FAIL | -1000 |
E_BOARD_NOT_SUPPORT | -1001 |
E_ALREADY_INITIALIZED | -1002 |
E_INVALID_ARG | -1003 |
E_OUT_OF_MEMORY | -1004 |
E_FUNC_NOT_SUPPORT | -1005 |
E_HARDWARE_ERROR | -1006 |
The S_OK return value has the constant value 0. When a function returns the S_OK value, it indicates that the function has successfully completed.
The E_FAIL return value has the constant value -1000. When a function returns the E_FAIL value, it indicates that the function has failed to complete.
The E_BOARD_NOT_SUPPORT return value has the constant value -1001. When a function returns the E_BOARD_NOT_SUPPORT value, it indicates that the mainboard is not supported.
The E_ALREADY_INITIALIZED return value has the constant value -1002. When a function returns the E_ALREADY_INITIALIZED value, it indicates that libbssjni.so has already been loaded.
The E_INVALID_ARG return value has the constant value -1003. When a function returns the E_INVALID_ARG value, it indicates that the arguments are invalid.
The E_OUT_OF_MEMORY return value has the constant value -1004. When a function returns the E_OUT_OF_MEMORY value, it indicates that there is insufficient memory.
The E_FUNC_NOT_SUPPORT return value has the constant value -1005. When a function returns the E_FUNC_NOT_SUPPORT value, it indicates that the function is not supported on this board.
The E_HARDWARE_ERROR return value has the constant value -1006. When a function returns the E_HARDWARE_ERROR value, it indicates that there is a hardware error.
Description: | This function initializes the Smart ETK and loads the JNI. |
---|---|
Returns: |
|
Description: | Check if current platform supports GPIO. |
---|---|
Returns: |
|
Description: | Check if current platform supports watch dog timer |
---|---|
Returns: |
|
Description: | Check if current platform supports RTC wake-up |
---|---|
Returns: |
|
Description: | Gets the information of GPIO |
---|---|
Returns: | An array representing GPIO |
Return type: | SmartETK.GpioInfo |
Description: | Enable specific GPIO pin. |
---|---|
Parameters: |
|
Returns: |
|
Description: | Setup I/O configuration for specific GPIO pin |
---|---|
Parameters: |
|
Returns: |
|
Description: | Set GPIO output signal |
---|---|
Parameters: |
|
Returns: |
|
Description: | Get GPIO input signal. |
---|---|
Parameters: |
|
Returns: |
|
Description: | Set watch dog timer to specific time in second. The time should not exceed the number defined by a constant SmartETK.WDT_MAX_SEC |
---|---|
Parameters: |
|
Returns: |
|
Escription: | Refresh the timer to the time set in Wdt_SetTimer |
---|---|
Returns: |
|
Description: | Start watch dog timer. If application does not call Wdt_Refresh in time set in Wdt_SetTimer, system will be reset |
---|---|
Returns: |
|
Description: | Stop watch dog timer |
---|---|
Returns: |
|
Description: | Enable RTC wake-up |
---|---|
Returns: |
|
Description: | Disable RTC wake-up |
---|---|
Returns: |
|
Description: | Set time to wake up by RTC |
---|---|
Parameters: |
|
Returns: |
|
Description: | Return terminal configuration of specific FileDescriptor |
---|---|
Parameters: |
|
Returns: |
|
Description: | Set terminal configuration of specific FileDescriptor |
---|---|
Parameters: |
|
Returns: |
|
SmartETK defines UART (Universal Asynchronous Receiver/Transmitter) related values into another class`` com.via.UartConfig`` for configuration. Instead of one-time setup for other devices, UART is transferring data continually. Developers may blocked read, selected read, or buffered read from UART. In order to provide developers all types of transmissions, the APIs should be based on Java class java.io.FileDescriptor.
To get FileDescriptor, the developers have to open the device file manually (e.g. /dev/ttyS1 or /dev/ttyUSB0) with Java class java.io.File. Then select a suitable Java transmission helper class (e.g. java.io.FileOutputStream). To setup UART parameters with FileDescriptor and class UartConfig which are provided by VIA. Please check SDK sample code for details.
Parameters in UartConfig are the same as the values in Linux Kernel. Developers who are familiar with terminal programming in C may apply the same macro to port existing applications to Java with UartConfig. See Linux Programmer’s Manual for details. To read the manual, enter man tcsetattr in Ubuntu terminal.
Currently, four connection options (in struct termios) and two speed options for Linux are available.
The four connection options are: c_cflag, c_iflag, c_oflag, c_lflag
The two speed options are: ispeed, ospeed
Four options will be applied with tcsetattr in Linux C library. c_cc[VMIN] is set to 1 and c_cc[VTIME] is set to 0. ispeed and ospeed in UartConfig will be applied to struct termios with cfsetispeed and cfsetospeed in Linux C library.
All options have to be set before applying them. It is recommended to get current configurations of FileDescriptor into UartConfig via SmartETK.Uart_GetConfig instead of allocating one manually.
All types of file transmissions in Java are available since we shared existing FileDescriptor class. After FileDescriptor is configured, developers can access UART as a normal file.