Skip to content

Commit

Permalink
add option to handle tcp command
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasilijs Jelcaninovs committed May 26, 2021
1 parent 718a9f1 commit 62038d7
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 45 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ A low level Go driver for AT modems.

[![Build Status](https://travis-ci.org/warthog618/modem.svg)](https://travis-ci.org/warthog618/modem)
[![Coverage Status](https://coveralls.io/repos/github/warthog618/modem/badge.svg?branch=master)](https://coveralls.io/github/warthog618/modem?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/warthog618/modem)](https://goreportcard.com/report/github.com/warthog618/modem)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/warthog618/modem/blob/master/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/vasjaj/modem)](https://goreportcard.com/report/github.com/vasjaj/modem)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/vasjaj/modem/blob/master/LICENSE)

modem is a Go library for interacting with AT based modems.

Expand Down Expand Up @@ -96,8 +96,8 @@ For more information, refer to package documentation, tests and example commands

Package | Documentation | Tests | Example code
------- | ------------- | ----- | ------------
[at](at) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/warthog618/modem/at) | [at_test](at/at_test.go) | [modeminfo](cmd/modeminfo/modeminfo.go)
[gsm](gsm) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/warthog618/modem/gsm) | [gsm_test](gsm/gsm_test.go) | [sendsms](cmd/sendsms/sendsms.go), [waitsms](cmd/waitsms/waitsms.go)
[info](info) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/warthog618/modem/info) | [info_test](info/info_test.go) | [phonebook](cmd/phonebook/phonebook.go)
[serial](serial) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/warthog618/modem/serial) | [serial_test](serial/serial_test.go) | [modeminfo](cmd/modeminfo/modeminfo.go), [sendsms](cmd/sendsms/sendsms.go), [waitsms](cmd/waitsms/waitsms.go)
[trace](trace) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/warthog618/modem/trace) | [trace_test](trace/trace_test.go) | [sendsms](cmd/sendsms/sendsms.go), [waitsms](cmd/waitsms/waitsms.go)
[at](at) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vasjaj/modem/at) | [at_test](at/at_test.go) | [modeminfo](cmd/modeminfo/modeminfo.go)
[gsm](gsm) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vasjaj/modem/gsm) | [gsm_test](gsm/gsm_test.go) | [sendsms](cmd/sendsms/sendsms.go), [waitsms](cmd/waitsms/waitsms.go)
[info](info) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vasjaj/modem/info) | [info_test](info/info_test.go) | [phonebook](cmd/phonebook/phonebook.go)
[serial](serial) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vasjaj/modem/serial) | [serial_test](serial/serial_test.go) | [modeminfo](cmd/modeminfo/modeminfo.go), [sendsms](cmd/sendsms/sendsms.go), [waitsms](cmd/waitsms/waitsms.go)
[trace](trace) | [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vasjaj/modem/trace) | [trace_test](trace/trace_test.go) | [sendsms](cmd/sendsms/sendsms.go), [waitsms](cmd/waitsms/waitsms.go)
6 changes: 3 additions & 3 deletions at/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
A low level Go driver for AT modems.

[![Build Status](https://travis-ci.org/warthog618/modem.svg)](https://travis-ci.org/warthog618/modem)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/warthog618/modem/at)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vasjaj/modem/at)
[![Coverage Status](https://coveralls.io/repos/github/warthog618/modem/badge.svg?branch=master)](https://coveralls.io/github/warthog618/modem?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/warthog618/modem)](https://goreportcard.com/report/github.com/warthog618/modem)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/warthog618/modem/blob/master/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/vasjaj/modem)](https://goreportcard.com/report/github.com/vasjaj/modem)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/vasjaj/modem/blob/master/LICENSE)

The **at** package provides a low level driver which sits between an
io.ReadWriter, representing the physical modem, and a higher level driver or
Expand Down
2 changes: 1 addition & 1 deletion at/at.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ func parseCmdID(cmdLine string) string {
// parseRxLine parses a received line and identifies the line type.
func parseRxLine(line string, cmdID string) rxl {
switch {
case line == "OK":
case line == "OK" || line == "SEND OK":
return rxlStatusOK
case strings.HasPrefix(line, "ERROR"),
strings.HasPrefix(line, "+CME ERROR:"),
Expand Down
4 changes: 2 additions & 2 deletions at/at_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/warthog618/modem/at"
"github.com/warthog618/modem/trace"
"github.com/vasjaj/modem/at"
"github.com/vasjaj/modem/trace"
)

func TestNew(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/modeminfo/modeminfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"os"
"time"

"github.com/warthog618/modem/at"
"github.com/warthog618/modem/serial"
"github.com/warthog618/modem/trace"
"github.com/vasjaj/modem/at"
"github.com/vasjaj/modem/serial"
"github.com/vasjaj/modem/trace"
)

var version = "undefined"
Expand Down
10 changes: 5 additions & 5 deletions cmd/phonebook/phonebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
"strings"
"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"
"github.com/vasjaj/modem/at"
"github.com/vasjaj/modem/gsm"
"github.com/vasjaj/modem/info"
"github.com/vasjaj/modem/serial"
"github.com/vasjaj/modem/trace"
)

var version = "undefined"
Expand Down
8 changes: 4 additions & 4 deletions cmd/sendsms/sendsms.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
"os"
"time"

"github.com/warthog618/modem/at"
"github.com/warthog618/modem/gsm"
"github.com/warthog618/modem/serial"
"github.com/warthog618/modem/trace"
"github.com/vasjaj/modem/at"
"github.com/vasjaj/modem/gsm"
"github.com/vasjaj/modem/serial"
"github.com/vasjaj/modem/trace"
"github.com/warthog618/sms"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/ussd/ussd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"strings"
"time"

"github.com/warthog618/modem/at"
"github.com/warthog618/modem/info"
"github.com/warthog618/modem/serial"
"github.com/warthog618/modem/trace"
"github.com/vasjaj/modem/at"
"github.com/vasjaj/modem/info"
"github.com/vasjaj/modem/serial"
"github.com/vasjaj/modem/trace"
"github.com/warthog618/sms/encoding/gsm7"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/waitsms/waitsms.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"os"
"time"

"github.com/warthog618/modem/at"
"github.com/warthog618/modem/gsm"
"github.com/warthog618/modem/serial"
"github.com/warthog618/modem/trace"
"github.com/vasjaj/modem/at"
"github.com/vasjaj/modem/gsm"
"github.com/vasjaj/modem/serial"
"github.com/vasjaj/modem/trace"
)

var version = "undefined"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/warthog618/modem
module github.com/vasjaj/modem

require (
github.com/pkg/errors v0.9.1
Expand Down
11 changes: 11 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
Expand All @@ -11,18 +12,28 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/warthog618/sms v0.3.0 h1:LYAb5ngmu2qjNExgji3B7xi2tIZ9+DsuE9pC5xs4wwc=
github.com/warthog618/sms v0.3.0/go.mod h1:+bYZGeBxu003sxD5xhzsrIPBAjPBzTABsRTwSpd7ld4=
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY=
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea h1:+WiDlPBBaO+h9vPNZi8uJ3k4BkKQB7Iow3aqwHVA5hI=
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
6 changes: 3 additions & 3 deletions gsm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
A high level Go driver for GSM modems.

[![Build Status](https://travis-ci.org/warthog618/modem.svg)](https://travis-ci.org/warthog618/modem)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/warthog618/modem/gsm)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/vasjaj/modem/gsm)
[![Coverage Status](https://coveralls.io/repos/github/warthog618/modem/badge.svg?branch=master)](https://coveralls.io/github/warthog618/modem?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/warthog618/modem)](https://goreportcard.com/report/github.com/warthog618/modem)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/warthog618/modem/blob/master/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/vasjaj/modem)](https://goreportcard.com/report/github.com/vasjaj/modem)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/vasjaj/modem/blob/master/LICENSE)

The **gsm** package provides a wrapper around [**at**](../at) that supports sending and receiving SMS messages, including long multi-part messages.

Expand Down
4 changes: 2 additions & 2 deletions gsm/gsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"strings"
"time"

"github.com/warthog618/modem/at"
"github.com/warthog618/modem/info"
"github.com/vasjaj/modem/at"
"github.com/vasjaj/modem/info"
"github.com/warthog618/sms"
"github.com/warthog618/sms/encoding/pdumode"
"github.com/warthog618/sms/encoding/tpdu"
Expand Down
6 changes: 3 additions & 3 deletions gsm/gsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/warthog618/modem/at"
"github.com/warthog618/modem/gsm"
"github.com/warthog618/modem/trace"
"github.com/vasjaj/modem/at"
"github.com/vasjaj/modem/gsm"
"github.com/vasjaj/modem/trace"
"github.com/warthog618/sms"
"github.com/warthog618/sms/encoding/pdumode"
"github.com/warthog618/sms/encoding/semioctet"
Expand Down
2 changes: 1 addition & 1 deletion info/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/warthog618/modem/info"
"github.com/vasjaj/modem/info"
)

func TestHasPrefix(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion serial/serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
"github.com/warthog618/modem/serial"
"github.com/vasjaj/modem/serial"
)

func modemExists(name string) func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion trace/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/warthog618/modem/trace"
"github.com/vasjaj/modem/trace"
)

func TestNew(t *testing.T) {
Expand Down

0 comments on commit 62038d7

Please sign in to comment.