modem

package
v0.0.0-...-fab4774 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NEWLINE              = "\r\n"
	ECHOOFF              = "ATE0" + NEWLINE
	USEFULLERRORMESSAGES = "AT+CMEE=1" + NEWLINE
	DISABLENOTIFICATIONS = "AT+WIND=0" + NEWLINE
	ENABLETEXTMODE       = "AT+CMGF=1" + NEWLINE
)

serial modem constant functions calls

Variables

View Source
var GSMModem []interface{}

GSMModem are interfaces :D

Functions

func SendSMS

func SendSMS(number, message string) string

send the sms. * given a message and a number

Types

type GSM

type GSM interface {
	Connect() error

	Expect(possibilities []string) (string, error)
	Write(message string) bool
	Read(message_size int) string
	Send(command string, waitForOk bool) string
	SMS(mobileno, message string) string // send sms function
	// contains filtered or unexported methods
}

interfrace function for all modems

type GSMADBModem

type GSMADBModem struct {
	DeviceId       string
	AndroidVersion int
}

func ModemList

func ModemList() ([]GSMADBModem, error)

func NewADBModem

func NewADBModem(DeviceId string, version int) *GSMADBModem

func (*GSMADBModem) Connnect

func (m *GSMADBModem) Connnect() error

func (*GSMADBModem) Expect

func (m *GSMADBModem) Expect(possibilities []string) (string, error)

func (*GSMADBModem) Read

func (m *GSMADBModem) Read(message_size int) string

func (*GSMADBModem) SMS

func (m *GSMADBModem) SMS(mobileno, message string) string

func (*GSMADBModem) Send

func (m *GSMADBModem) Send(command string, waitForOk bool) string

func (*GSMADBModem) Write

func (m *GSMADBModem) Write(message string) bool

type GSMSerialModem

type GSMSerialModem struct {
	ComPort  string
	BaudRate int
	Port     *serial.Port
	DeviceId string
}

serial modem

func NewSerialModem

func NewSerialModem(ComPort, DeviceId string, BaudRate int) (modem *GSMSerialModem)

new modem object

func (*GSMSerialModem) Connect

func (m *GSMSerialModem) Connect() (err error)

connect to the modem utilizing the serial port

func (*GSMSerialModem) Expect

func (m *GSMSerialModem) Expect(possibilities []string) (string, error)

expect output on bus

func (*GSMSerialModem) Read

func (m *GSMSerialModem) Read(message_size int) string

read a message vom serial

func (*GSMSerialModem) SMS

func (m *GSMSerialModem) SMS(mobileno, message string) string

send a sms

func (*GSMSerialModem) Send

func (m *GSMSerialModem) Send(command string, waitForOk bool) string

send message and may wait for a success

func (*GSMSerialModem) Write

func (m *GSMSerialModem) Write(message string)

write a message to serial bus

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳