Improved SMS.

This commit is contained in:
Andrey Egorov
2024-08-09 18:17:20 +03:00
parent b3fb13b7b3
commit 75d05f197c
8 changed files with 255 additions and 137 deletions

View File

@ -85,7 +85,7 @@ func (g *gps) switchGpsMode(on bool) error {
// Check gps mode status
resp, err := g.port.Send("AT+CGPS?")
if err != nil {
return fmt.Errorf("make at ask: %w", err)
return err
}
if !resp.Check() || !resp.CheckFront("+CGPS:") {
return fmt.Errorf("get GPS mode: error response: %s", resp)
@ -98,7 +98,7 @@ func (g *gps) switchGpsMode(on bool) error {
// Modem is not in GPS mode
resp, err = g.port.Send("AT+CGPS=" + onStr)
if err != nil {
return fmt.Errorf("set GPS mode: %w", err)
return err
}
if !resp.Check() {
return fmt.Errorf("set GPS mode: error response: %s", resp)

View File

@ -56,7 +56,7 @@ func (g *gps) rawCollect(flags nmeaFlags) (string, error) {
// Set output rate to 10Hz
if resp, err := g.port.Send("AT+CGPSNMEARATE=1"); err != nil {
return "", fmt.Errorf("AT+CGPSNMEARATE= request: %w", err)
return "", err
} else {
if !resp.Check() {
return "", fmt.Errorf("set output rate: error response: %s", resp)