Some interface improvements.

This commit is contained in:
Andrey Egorov
2024-07-25 16:58:09 +03:00
parent 211ff6c63a
commit 781d9ccda4
4 changed files with 80 additions and 86 deletions

View File

@ -2,6 +2,7 @@ package at
import (
"fmt"
"io"
"log"
"time"
@ -32,6 +33,8 @@ type Port interface {
IsConnected() bool
Send(cmd string) (Resp, error)
io.Closer
}
func New(logger *log.Logger, portName string, baudrate int) Port {
@ -110,3 +113,7 @@ func (p *atPort) Send(cmd string) (Resp, error) {
return Resp(resp), nil
}
func (p *atPort) Close() error {
return p.port.Close()
}