Skip to content

Commit

Permalink
modem doesn't need to be GSM
Browse files Browse the repository at this point in the history
  • Loading branch information
warthog618 committed May 11, 2020
1 parent 43b5a0a commit 95c4cf8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cmd/ussd/ussd.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"time"

"github.com/warthog618/modem/at"
"github.com/warthog618/modem/gsm"
"github.com/warthog618/modem/info"
"github.com/warthog618/modem/serial"
"github.com/warthog618/modem/trace"
Expand Down Expand Up @@ -48,18 +47,18 @@ func main() {
if *verbose {
mio = trace.New(m)
}
g := gsm.New(at.New(mio, at.WithTimeout(*timeout)))
if err = g.Init(); err != nil {
a := at.New(mio, at.WithTimeout(*timeout))
if err = a.Init(); err != nil {
log.Fatal(err)
}
rspChan := make(chan string)
handler := func(info []string) {
rspChan <- info[0]
}
g.AddIndication("+CUSD:", handler)
a.AddIndication("+CUSD:", handler)
hmsg := strings.ToUpper(hex.EncodeToString(gsm7.Pack7BitUSSD([]byte(*msg), 0)))
cmd := fmt.Sprintf("+CUSD=1,\"%s\",%d", hmsg, *dcs)
_, err = g.Command(cmd)
_, err = a.Command(cmd)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 95c4cf8

Please sign in to comment.