-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,9 @@ | |
// a commercial license, send an email to [email protected]. | ||
// | ||
|
||
// Package args provides functionality to parse command-line arguments. | ||
// It includes a function to parse arguments passed by the user and a variable to check if the version flag is set. | ||
// The package also handles invalid arguments by printing an error message and exiting the program. | ||
package args | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
// a commercial license, send an email to [email protected]. | ||
// | ||
|
||
// Package main implements the serial discovery | ||
package main | ||
|
||
import ( | ||
|
@@ -48,6 +49,7 @@ type SerialDiscovery struct { | |
} | ||
|
||
// Hello is the handler for the pluggable-discovery HELLO command | ||
// revive:disable:unused-parameter | ||
func (d *SerialDiscovery) Hello(userAgent string, protocolVersion int) error { | ||
return nil | ||
} | ||
|
@@ -68,10 +70,10 @@ func (d *SerialDiscovery) Stop() error { | |
|
||
// StartSync is the handler for the pluggable-discovery START_SYNC command | ||
func (d *SerialDiscovery) StartSync(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) error { | ||
close, err := sync.Start(eventCB, errorCB) | ||
done, err := sync.Start(eventCB, errorCB) | ||
if err != nil { | ||
return err | ||
} | ||
d.closeChan = close | ||
d.closeChan = done | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,19 @@ | |
// a commercial license, send an email to [email protected]. | ||
// | ||
|
||
// Package sync provides functions for synchronizing and processing updates | ||
// related to serial port discovery. | ||
// | ||
// This package includes functions for comparing two lists of serial ports and | ||
// sending 'add' and 'remove' events based on the differences between the lists. | ||
// It also includes utility functions for converting port details to the discovery | ||
// protocol format. | ||
// | ||
// The main function in this package is `processUpdates`, which takes in two lists | ||
// of serial port details and an event callback function. It compares the two lists | ||
// and sends 'add' and 'remove' events based on the differences. The `portListHas` | ||
// function is used to check if a port is contained in a list, and the `toDiscoveryPort` | ||
// function is used to convert port details to the discovery protocol format. | ||
package sync | ||
|
||
import ( | ||
|
@@ -23,6 +36,7 @@ import ( | |
"go.bug.st/serial/enumerator" | ||
) | ||
|
||
// nolint | ||
// processUpdates sends 'add' and 'remove' events by comparing two ports enumeration | ||
// made at different times: | ||
// - ports present in the new list but not in the old list are reported as 'added' | ||
|
@@ -44,6 +58,7 @@ func processUpdates(old, new []*enumerator.PortDetails, eventCB discovery.EventC | |
} | ||
} | ||
|
||
// nolint | ||
// portListHas checks if port is contained in list. The port metadata are | ||
// compared in particular the port address, and vid/pid if the port is a usb port. | ||
func portListHas(list []*enumerator.PortDetails, port *enumerator.PortDetails) bool { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,12 @@ | |
// a commercial license, send an email to [email protected]. | ||
// | ||
|
||
// Package version provides information about the version of the application. | ||
// It includes the version string, commit hash, and timestamp. | ||
// The package also defines a struct `Info` that represents the version information. | ||
// The `newInfo` function creates a new `Info` instance with the provided application name. | ||
// The `String` method of the `Info` struct returns a formatted string representation of the version information. | ||
// The package also initializes the `Version` variable with a default version string if it is empty. | ||
package version | ||
|
||
import ( | ||
|