| 1234567891011121314151617181920212223 |
- //go:build linux
- package app
- import (
- "time"
- "hth/internal/backend"
- "hth/internal/config"
- "hth/internal/profile"
- )
- func newSerialBackend(cfg *config.Config, p *profile.Profile) (backend.Backend, error) {
- inter := p.InterByteTimeout()
- if cfg.Serial.InterByteTimeoutMS > 0 {
- inter = time.Duration(cfg.Serial.InterByteTimeoutMS) * time.Millisecond
- }
- resp := p.GetResponseTimeout()
- if cfg.Serial.ResponseTimeoutMS > 0 {
- resp = time.Duration(cfg.Serial.ResponseTimeoutMS) * time.Millisecond
- }
- return backend.NewSerial(cfg.Serial.Path, inter, resp), nil
- }
|