Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Serial4j: A JNI lib for UNIX Terminal Control #130

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ed2d29b
Serial4j: Initial file and build implementation
pavly-gerges Aug 9, 2022
b6e9b53
Serial4j: Removed HelloJShellCom
pavly-gerges Aug 9, 2022
01be75d
Serial4J: Added UART terminal control using C and jni example
pavly-gerges Aug 19, 2022
ad443f7
Merge branch 'master' of https://github.com/Software-Hardware-Codesig…
pavly-gerges Aug 23, 2022
5620966
Java: Added Exceptions, Streams, Errnos and BaudRates - Natives: Adde…
pavly-gerges Aug 28, 2022
4a08bda
Java: Added java io example, Jni: Added some utilities
pavly-gerges Aug 29, 2022
0ea422a
HelloSerial4j: Changed entry api class to TerminalDevice and added Re…
pavly-gerges Sep 4, 2022
fcb7240
Serial4j API: Added file io permissions/flags and read configuration
pavly-gerges Sep 7, 2022
0ccdf8d
Serial4j API: Added terminal flags management
pavly-gerges Sep 9, 2022
13b7c38
Serial4j API: Fixed terminal flags getters
pavly-gerges Sep 9, 2022
aa34622
Serial4j API Natives: Added multithreading features for the JNIEnv po…
Sep 12, 2022
93115dd
Update README.md
pavly-gerges Sep 12, 2022
7991bef
Serial4j API: Added examples docs, Files: Added HAL arch
Sep 13, 2022
5be51b4
Update README.md
pavly-gerges Sep 13, 2022
42dc2c9
Serial4j README.md: Started general overview
pavly-gerges Sep 13, 2022
4963a55
Update README.md
pavly-gerges Sep 13, 2022
ffb3dd8
Serial4j Natives: Fixed DynamicBuffer::remove(int), Files: Added gnu-…
Sep 14, 2022
08acb06
Merge branch 'hello-jni-com' of https://github.com/Software-Hardware-…
Sep 14, 2022
21f3cef
Serial4j Natives: Added BufferUtils::nullifyBufferCells(void**, int) …
Sep 14, 2022
5e259ef
Serial4j Natives: Removed DynamicBuffer::remove(int) test methods
Sep 14, 2022
dfaa369
Serial4j Natives/BufferUtils: Memory management optimizations
Sep 14, 2022
46b5ca8
Serial4j Natives: Added docs for DynamicBuffer.h
Sep 15, 2022
0c583c0
Serial4j API: Refactored code to OOP via jni
Sep 16, 2022
8d16d84
Serial4j API: Fixed out of memory issues on NativeTerminalDevice#read…
Sep 18, 2022
424d0ba
Serial4j API: Added `TerminalDevice#writeData(int[])` and docs improv…
Sep 20, 2022
95ba6c0
Serial4j API: Errno to exception and docs improvements
Sep 20, 2022
294822f
Files: Added java 8 and jvm 8 specifications PDF
Sep 20, 2022
429d1ef
Serial4j API: Added NativeErrno and improved java throwable classes
Sep 22, 2022
639b192
Merge branch 'master' of https://github.com/Software-Hardware-Codesig…
Sep 22, 2022
5d0d668
Serial4j Build: Added javadocs generator script
Sep 23, 2022
1a2cd1c
Serial4j API: Java exceptions enhancements and docs improvements
pavly-gerges Sep 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Empty file added HelloSerial4j/.gitignore
Empty file.
36 changes: 36 additions & 0 deletions HelloSerial4j/CommonVariables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#**
#* Ccoffee Build tool, manual build, alpha-v1.
#*
#* @author pavl_g.
#*#

# Bash colors using ANSI
# favored the 24-bit (3 colors * 8-bit for each one<255>) color system
# Colors
# process failure color
RED_C='\033[38;2;255;50;50m'
# success color
GREEN_C='\e[38;2;0;180;0m'
# extra
WHITE_C='\e[38;2;255;255;255m'
# Java color
ORANGE_C='\e[38;2;250;155;0m'
# C alternative color
DARK_GREY_C='\e[1;30m'
# kotlin color
VIOLET_C='\e[38;2;217;80;223m'
# groovy color
CYAN_C='\e[38;2;0;155;255m'
# C++ color
MAGNETA_C='\e[38;2;170;150;150m'
# Scala color
BRIGHT_RED_C='\e[38;2;200;120;120m'
# Highlights
RED_H='\033[1;41m'
GREEN_H='\033[1;42m'
WHITE_H='\e[1;47m'
# Flashes
RED_C_F='\033[1;5;41m'
GREEN_C_F='\033[1;5;42m'
WHITE_C_F='\e[1;5;47m'
RESET_Cs='\033[0;0m'
Binary file not shown.
Binary file not shown.
1,970 changes: 1,970 additions & 0 deletions HelloSerial4j/HAL (Hardware abstraction layer) Architecture/output.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions HelloSerial4j/JAVAHOME.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#**
#* Ccoffee Build tool, manual build, alpha-v1.
#* @author pavl_g.
#*#
# DONOT DELETE OR RENAME
## EDIT YOUR CUSTOM JAVAHOME FROM HERE, Ccoffee uses this custom java home to create new aliases for your script !
compile_dir=`pwd`
build_dir="${compile_dir%/*}"
project_dir="${build_dir%/*}"
root_dir="${project_dir%/*}"
JAVA__HOME=$root_dir'/jdk-19/bin'
export JAVA_HOME="${JAVA__HOME%/*}"

7 changes: 7 additions & 0 deletions HelloSerial4j/NDKPATH.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#**
#* Ccoffee Build tool, manual build, alpha-v1.
#* @author pavl_g.
#*#
# DONOT DELETE OR RENAME
## EDIT YOUR CUSTOM NDKBASEHOME FROM HERE, Ccoffee uses this custom NDK home to create new aliases for your script !
NDK__BASEHOME=/home/twisted/Android/Sdk/ndk/21.1.6352462
36 changes: 36 additions & 0 deletions HelloSerial4j/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## The Serial4j Architectural HAL:

![image](https://user-images.githubusercontent.com/60224159/189999625-fd667e7c-b219-4aa8-a91f-c9809dcef225.png)

Serial4j is a terminal io library primarialy built on top of POSIX base file API `<fcntl>` for file control operations, `<unistd>` for Unix std R/W operations and `<dirent>` for directory entry dir operations.

## Quick Overview:

- Java Implementation of the binding library:

| Entity/Class | Usages |
|---------------|----------------|
| `com.serial4j.core.serial` | A java package that provides the base implementation code for the serial4j API to control a terminal device. |
| `TerminalDevice.java` | A java class that provides a final implementation code for the `NativeTerminalDevice.java`, the api opens, initializes and R/W from/to a terminal device. |
| `Permissions.java` | A java class that provides the permissions for the terminal io operations. |
| `BaudRate.java` | A java enum class that provides the constants for the available POSIX termios bit speed. |
| `SerialPort.java` | A java wrapper class that wraps a serial port with a name and a port descriptor. |
| `ReadConfiguration.java` | A java enum class that provides an implementation for the various read configurations defined by the POSIX `termios-c_cc.h`. |
| `NativeTerminalDevice.java` | A java class that provides a base implementation for the Serial4j base native code. |
| | |
| `com.serial4j.core.control` | A java package that provides the terminal flags for the terminal device including control, local, input and output flags. |
| `TerminalFlag.java` | A java abstract class that provides the base implementation for a terminal flag. |
| `TerminalControlFlag.java` | A java class that provides an implementation for the POSIX terminal control mode flags, e.g: CREAD for receive enable, CS8 for charachter size 8-bits,...etc. |
| `TerminalLocalFlag.java` | A java class that provides an implementation for the POSIX terminal local mode flags, e.g: ECHO for enabling echoing charachters, ECHOCTL for enabling echoing control charachters visually on the terminal. |
| `TerminalInputFlag.java` | A java class that provides an implementation for the POSIX terminal input mode flags, e.g: IUTF8 for enabling utf-8 input, ICRNL for mapping (translating) CR into NL on input. |
| `TerminalOutputFlag.java` | A java class that provides an implementation for the POSIX terminal output mode flags, e.g: OCRNL for mapping (translating) CR to NL on output. |
| | |
| `com.serial4j.core.throwable` | A java package that provides java exceptions as translations to C native error codes. |

- Java Binding library for the native API:

- Direct Implementation of the POSIX base file/directory and terminal IO APIs:


- Unix/POSIX Base APIs:

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading