Skip to content

Commit b69319a

Browse files
committed
Changelog for KSerial Class
Version 2.0.1 1. Auto-Reconnection: - Added automatic reconnection with a configurable retry delay. This ensures the connection is re-established if lost, enhancing reliability in unstable environments. 2. Connection Status Flow: - Integrated StateFlow to broadcast real-time connection status, enabling subscribers to react to changes in connection. 3. Concurrency Safety: - Incorporated a Mutex (named communication) to ensure thread-safe access during read and write operations, protecting against concurrency issues. 4. Failure Handling & Retry Logic: - Introduced a configurable maxFailureCount to automatically disconnect after a series of consecutive failures, preventing potential deadlocks. - Added a responseFailureCounter to track failures, with an automatic reset upon successful operation. - Improved error handling by disconnecting and resetting the connection if the maximum failure threshold is reached. 5. Enhanced Logging: - Expanded logging to provide detailed information about connection status, data transmission, and errors, aiding in debugging and traceability. 6. Builder Pattern: - Implemented a Builder pattern for flexible instance creation, allowing configuration of parameters like baudRate, dataBits, stopBits, parity, retryDelay, readDelay, and maxFailureCount. 7. Helper Method for Port Discovery: - Added a getPorts() method in a companion object to list all available serial ports, simplifying the process of selecting a port. 8. Connection Verification: - Added an ensureConnected() method that verifies and re-establishes the connection before every read/write operation to prevent attempts on a disconnected port. 9. Documentation and Comments: - Added detailed comments and documentation throughout the code, enhancing readability, maintainability, and usability.
1 parent 8fdd22e commit b69319a

4 files changed

Lines changed: 130 additions & 111 deletions

File tree

.idea/workspace.xml

Lines changed: 21 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

KSerial/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.gtech"
7-
version = "2.0.1"
7+
version = "1.0.6"
88

99
repositories {
1010
mavenCentral()

KSerial/src/main/kotlin/Connection.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package com.gtech
2-
31
enum class Connection {
42
CONNECTING,
53
CONNECTED,

0 commit comments

Comments
 (0)