gammu

package module
v0.0.0-...-201ad92 Latest Latest
Warning

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

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

README

gogammu is binding for SMS related functions of libGammu (documentation).

gogammu/smsd is simple, MySQL based, SMS daemon, written entirely in Go (it doesn't depend on Gammu SMSd).

  1. It receives messages from phone and saves them in Inbox.
  2. It waits for network connections (unix domain sockets to) and saves messages in Outbox.
  3. It sends messages from Outbox, waits for delivery reports and deletes messages if necessary.
  4. It sends logs to stderr or to specified file. You have to send HUP signal to smsd after rotating its log file.

For run it in background use runit or daemontools.

gogammu/sms simple library that implements smsd protocol. Use it for sending messages via smsd (documentation).

Protocol description

Client sends:

FROM                                - symbol of source (<=16B)
PHONE1[=DSTID1] PHONE2[=DSTID2] ... - list of phone numbers and dstIds
Lines that contain optional parameters, one parameter per line: NAME or
NAME VALUE. Implemented parameters:
    report - report required
    delete - delete message after sending (wait for reports, if required)
                     - Empty line
Message body (UTF-8)
.                    - '.' as first and only character in line

Server replies with 'OK' line or with error message and disconnects.

Client reads response and disconnects.

Documentation

Overview

Go binding for libGammu (library to work with different cell phones)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncodeError

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

func (EncodeError) Error

func (e EncodeError) Error() string

type Error

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

Error

func (Error) Error

func (e Error) Error() string

type SMS

type SMS struct {
	Time     time.Time
	SMSCTime time.Time
	Number   string
	Report   bool // True if this message is a delivery report
	Body     string
}

type StateMachine

type StateMachine struct {
	Timeout time.Duration // Default 15s
	// contains filtered or unexported fields
}

StateMachine

func NewStateMachine

func NewStateMachine(cf string) (*StateMachine, error)

Creates new state maschine using cf configuration file or default configuration file if cf == "".

func (*StateMachine) Connect

func (sm *StateMachine) Connect() error

func (*StateMachine) Disconnect

func (sm *StateMachine) Disconnect() error

func (*StateMachine) GetSMS

func (sm *StateMachine) GetSMS() (sms SMS, err error)

Read and deletes first avaliable message. Returns io.EOF if there is no more messages to read

func (*StateMachine) HardReset

func (sm *StateMachine) HardReset() error

func (*StateMachine) IsConnected

func (sm *StateMachine) IsConnected() bool

func (*StateMachine) Reset

func (sm *StateMachine) Reset() error

func (*StateMachine) SendLongSMS

func (sm *StateMachine) SendLongSMS(number, text string, report bool) error

func (*StateMachine) SendSMS

func (sm *StateMachine) SendSMS(number, text string, report bool) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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