Added signal check.
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.unprism.ru/KRBL/sim-modem/api/modem/at"
|
||||
)
|
||||
@ -40,7 +41,7 @@ func (d *dialer) Init() error {
|
||||
}
|
||||
// Setup prefered message storage
|
||||
if err := d.setupMsgSt(); err != nil {
|
||||
return fmt.Errorf("setup msg storage: %w", err)
|
||||
d.logger.Printf("ERROR setup msg storage: %s\n", err.Error())
|
||||
}
|
||||
// Check number
|
||||
if resp, err := d.port.Send("AT+CNUM"); err != nil || !resp.Check() {
|
||||
@ -57,7 +58,7 @@ func (d *dialer) Send(number, msg string) error {
|
||||
return err
|
||||
}
|
||||
d.logger.Println(sresp)
|
||||
resp, err := d.port.RawSend(fmt.Sprintf("%s\x1A", msg)) // Add additional \r\n because there is not supposed to be
|
||||
resp, err := d.port.RawSend(fmt.Sprintf("%s\x1A", msg), time.Millisecond) // Add additional \r\n because there is not supposed to be
|
||||
if err != nil {
|
||||
return fmt.Errorf("message request: %w", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user