Removed internet and sms temporarily.

This commit is contained in:
Andrey Egorov 2024-08-09 11:42:55 +03:00
parent dde1411b18
commit b3fb13b7b3
2 changed files with 21 additions and 21 deletions

View File

@ -112,19 +112,19 @@ func (m *modem) Init() error {
// submodulesLogger := io.Discard // FOR less logs
m.logger.Println("=============================== Init submodules")
m.ic = internet.New(log.New(submodulesLogger, "modem-internet : ", log.LstdFlags), m.port)
if err := m.ic.Init(); err != nil {
m.logger.Printf("\x1b[38;2;255;0;0mInternet: %s\x1b[38;2;255;255;255m\n", err.Error())
} else {
m.logger.Println("\x1b[38;2;0;255;0mInternet OK\x1b[38;2;255;255;255m")
}
m.sms = sms.New(log.New(submodulesLogger, "modem-sms : ", log.LstdFlags), m.port)
if err := m.sms.Init(); err != nil {
m.logger.Printf("\x1b[38;2;255;0;0mSMS: %s\x1b[38;2;255;255;255m\n", err.Error())
} else {
m.logger.Println("\x1b[38;2;0;255;0mSMS OK\x1b[38;2;255;255;255m")
}
//m.ic = internet.New(log.New(submodulesLogger, "modem-internet : ", log.LstdFlags), m.port)
//if err := m.ic.Init(); err != nil {
// m.logger.Printf("\x1b[38;2;255;0;0mInternet: %s\x1b[38;2;255;255;255m\n", err.Error())
//} else {
// m.logger.Println("\x1b[38;2;0;255;0mInternet OK\x1b[38;2;255;255;255m")
//}
//
//m.sms = sms.New(log.New(submodulesLogger, "modem-sms : ", log.LstdFlags), m.port)
//if err := m.sms.Init(); err != nil {
// m.logger.Printf("\x1b[38;2;255;0;0mSMS: %s\x1b[38;2;255;255;255m\n", err.Error())
//} else {
// m.logger.Println("\x1b[38;2;0;255;0mSMS OK\x1b[38;2;255;255;255m")
//}
m.gps = gps.New(log.New(submodulesLogger, "modem-gps : ", log.LstdFlags), m.port)
if err := m.gps.Init(); err != nil {

16
main.go
View File

@ -43,16 +43,16 @@ func mainE() error {
logger.Println(m.Update())
logger.Printf("DATA: %+v\n", m.GetData())
logger.Println("||||||||||||||||| SEND SMS |||||||||||||||||")
logger.Println(m.At().Send("AT+CNUM"))
// if err := m.Sms().Send("+79218937173", "CGSG forever"); err != nil {
// logger.Println("||||||||||||||||| SEND SMS |||||||||||||||||")
// logger.Println(m.At().Send("AT+CNUM"))
// // if err := m.Sms().Send("+79218937173", "CGSG forever"); err != nil {
// // return err
// // }
// if ms, err := m.Sms().ReadNew(); err != nil {
// return err
// } else {
// logger.Println("NEW:", ms)
// }
if ms, err := m.Sms().ReadNew(); err != nil {
return err
} else {
logger.Println("NEW:", ms)
}
logger.Println("||||||||||||||||| Checking gps status |||||||||||||||||")
st, err := m.Gps().GetStatus()
if err != nil {