sim-modem/main.go

46 lines
1.0 KiB
Go
Raw Normal View History

2024-07-18 16:34:26 +00:00
package main
import (
"log"
2024-07-23 16:02:28 +00:00
"os"
2024-07-22 15:53:34 +00:00
"github.com/CGSG-2021-AE4/modem-test/api/modem"
2024-07-18 16:34:26 +00:00
)
func main() {
log.Println("CGSG forever!!!")
if err := mainE(); err != nil {
log.Println("MAIN finished with error:", err.Error())
}
log.Println("END")
}
func mainE() error {
2024-07-23 16:02:28 +00:00
m := modem.New(log.New(os.Stdout, "modem:", log.LstdFlags))
2024-07-23 19:04:15 +00:00
log.Println("||||||||||||||||| INIT |||||||||||||||")
2024-07-23 14:59:26 +00:00
if err := m.Init(); err != nil {
return err
}
2024-07-26 19:58:34 +00:00
if !m.Validate() {
log.Println("AAAAAAAAAAAAAAA Validation failed")
return nil
}
2024-07-23 19:04:15 +00:00
log.Println("||||||||||||||||| GET INFO |||||||||||||||||")
log.Println(m.GetData())
2024-07-29 13:51:54 +00:00
2024-08-01 16:34:58 +00:00
// log.Println("||||||||||||||||| SEND SMS |||||||||||||||||")
// log.Println(m.At().Send("AT+CNUM"))
2024-07-29 17:03:22 +00:00
// if err := m.Sms().Send("+79218937173", "CGSG forever"); err != nil {
// return err
// }
2024-08-01 16:34:58 +00:00
// if ms, err := m.Sms().ReadNew(); err != nil {
// return err
// } else {
// log.Println("NEW:", ms)
// }
log.Println("||||||||||||||||| Checking gps status |||||||||||||||||")
log.Println(m.Gps().CheckStatus())
2024-07-29 17:03:22 +00:00
2024-07-23 14:59:26 +00:00
return nil
2024-07-18 16:34:26 +00:00
}