-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
1 parent
d2b01b9
commit f4c756e
Showing
8 changed files
with
939 additions
and
120 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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package bleclient | ||
|
||
import "time" | ||
|
||
// optionApplier needs to be implemented by each configurable option type | ||
type optionApplier interface { | ||
apply(cfg *configuration) | ||
} | ||
|
||
// debugOption is the type for applying the debug switch on or off. | ||
type debugOption bool | ||
|
||
// scanTimeoutOption is the type for applying another timeout than the default 10 min. | ||
type scanTimeoutOption time.Duration | ||
|
||
func (o debugOption) String() string { | ||
return "debug option for BLE client adaptors" | ||
} | ||
|
||
func (o scanTimeoutOption) String() string { | ||
return "scan timeout option for BLE client adaptors" | ||
} | ||
|
||
func (o debugOption) apply(cfg *configuration) { | ||
cfg.debug = bool(o) | ||
} | ||
|
||
func (o scanTimeoutOption) apply(cfg *configuration) { | ||
cfg.scanTimeout = time.Duration(o) | ||
} |
Oops, something went wrong.