gmodem

package module
v0.0.0-...-4ef99c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2017 License: BSD-3-Clause Imports: 5 Imported by: 1

README

gmodem

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

Overview

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

Index

Package files

doc.go modem.go

type Modem

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 (*Modem) SetReadTimeout
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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Modem

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 <CR> automatically to the command.

func (*Modem) SetReadTimeout

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL