Add: power on with context, SIM808 support
This commit is contained in:
@ -5,7 +5,6 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.unprism.ru/KRBL/sim-modem/api/modem/at"
|
||||
"gitea.unprism.ru/KRBL/sim-modem/api/modem/utils"
|
||||
@ -69,10 +68,15 @@ func (d *dialer) Send(number, msg string) error {
|
||||
return err
|
||||
}
|
||||
d.logger.Println(sresp)
|
||||
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 {
|
||||
|
||||
// Message body
|
||||
if err := d.port.RawSend(fmt.Sprintf("%s\x1A", msg)); err != nil {
|
||||
return fmt.Errorf("message request: %w", err)
|
||||
}
|
||||
resp, err := d.port.RawRead(at.ReadTimeout)
|
||||
if err != nil {
|
||||
return fmt.Errorf("message request read: %w", err)
|
||||
}
|
||||
d.logger.Println("Send response:", resp)
|
||||
if !at.Resp(resp).Check() {
|
||||
return fmt.Errorf("error response: %s", resp)
|
||||
|
Reference in New Issue
Block a user