Skip to content

Library for accessing AT-Command interface for cellular modem modules.

License

Notifications You must be signed in to change notification settings

littlebitle/gmodem

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gmodem

import "github.com/sitec-systems/gmodem"

Package gmodem provides simple primitives to open a connection to a serial modem device and communicate with it by AT-Commands

doc.go modem.go

type Modem struct {
    // DevFile is the absolute path to the device file (e. g. /dev/ttyUSB1)
    DevFile string
    // Baudrate is the speed for data transfer between the you and the modem device (e. g. 115200)
    Baudrate int64
    // ReadTimeout is the timeout which is used for reading operations on the serial device. Some AT-Commands
    // needs longer to execute than others.
    ReadTimeout time.Duration
    // contains filtered or unexported fields
}

Modem holds the parameters which are needed for the serial communication with the modem device

func (*Modem) Close

func (m *Modem) Close()

Close closes the connection on the serial interface

func (*Modem) Open

func (m *Modem) Open() error

Open opens the connection to ther serial interface with the defined parameters. The function configures the default read timeout for the serial interface

func (*Modem) SendAt

func (m *Modem) SendAt(cmd string) (string, error)

SendAt sends a AT command over the serial line to the and returns the answer to the caller. The command will return an error if the Write or Read operation will fail. It doesn't return an error if the AT command fails. The function appends the closing automatically to the command.

func (m *Modem) SetReadTimeout(d time.Duration) error

SetReadTimeout sets a new value for the read timeout on the serial interface. It altough updates the ReadTimeout attribute in the Modem structure.


Generated by godoc2md

About

Library for accessing AT-Command interface for cellular modem modules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%