gsm

package
v0.0.0-...-9b7fa04 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2021 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

实现了GSM模块手法短信的功能.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gsm

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

GSM结构体

func NewGsm

func NewGsm(name string, baud int, logger *l4g.Logger) (*Gsm, error)

构建一个新的GSM结构体. name 与GSM模块连接的串口设备. baud 串口使用的波特率 logger 日志

func (*Gsm) Init

func (g *Gsm) Init() error

初始化

func (*Gsm) Ping

func (g *Gsm) Ping() error

检测GSM AT命令的通道是否正常. return 错误; ==nil AT命令通道正常.

func (*Gsm) RecvSMS

func (g *Gsm) RecvSMS() (*sms.Message, error)

接收短信, 这个函数会阻塞直至接收到短信. return 接收到的短信.

func (*Gsm) RecvSMSWithTimeout

func (g *Gsm) RecvSMSWithTimeout(timeout *time.Duration) (*sms.Message, error)

在指定超时时间内接收短信, 这个函数会阻塞直至接收到短信或超时. timeout 超时时间. return 接收到的短信, 错误.

func (*Gsm) SendSMS

func (g *Gsm) SendSMS(num, msg string) error

发送短信. num 接收者的号码. msg 需要发送的短信内容. return 错误; ==nil 发送正常.

func (*Gsm) Teardown

func (g *Gsm) Teardown() error

关闭GSM模块

Jump to

Keyboard shortcuts

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