gogsm

package module
v0.0.0-...-39649ef Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandError = errors.New("cmd error")
View Source
var CommandNotSupportError = errors.New("cmd not support")

Functions

This section is empty.

Types

type AsyncEvent

type AsyncEvent struct {
	Type AsyncEventType
	Msg  Msg
}

type AsyncEventType

type AsyncEventType int
const (
	EvtSMS AsyncEventType = 1 << iota
)

type Modem

type Modem struct {
	// contains filtered or unexported fields
}

func NewModem

func NewModem(serialPort string) (*Modem, error)

func (*Modem) Command

func (m *Modem) Command(d string) ([]string, error)

func (*Modem) Connect

func (m *Modem) Connect() error

func (*Modem) DeleteMsg

func (m *Modem) DeleteMsg(idx int) error

func (*Modem) ReadMessages

func (m *Modem) ReadMessages() ([]Msg, error)

func (*Modem) ReadMsg

func (m *Modem) ReadMsg(idx int) (*Msg, error)

func (*Modem) ReadUntilOkError

func (m *Modem) ReadUntilOkError() ([]string, error)

func (*Modem) SendSMS

func (m *Modem) SendSMS(number, message string) error

func (*Modem) Subscribe

func (m *Modem) Subscribe(ctx context.Context, evtMask AsyncEventType) (chan AsyncEvent, error)

type Msg

type Msg struct {
	Index   int
	Status  MsgStatus
	Inbound bool
	From    string
	To      string
	TS      time.Time
	Body    string
}

type MsgStatus

type MsgStatus int
const (
	StatusRecvUnread  MsgStatus = 0
	StatusRecvRead    MsgStatus = 1
	StatusPendingSend MsgStatus = 2
	StatusSent        MsgStatus = 3
)

Directories

Path Synopsis
examples
deletemsg command
readmsgs command
recvnewmsgs command
sendsms command

Jump to

Keyboard shortcuts

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