Skip to content

avldya/gogsmmodem

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gogsmmodem: Go library for GSM modems

Build Status

Go library for the sending and receiving SMS messages through a GSM modem.

Tested devices

  • ZTE MF110/MF627/MF636

Installation

Run:

go get github.com/barnybug/gogsmmodem

Usage

Example:

package main

import (
    "fmt"

    "github.com/barnybug/gogsmmodem"
    "github.com/tarm/goserial"
)

func main() {
    conf := serial.Config{Name: "/dev/ttyUSB1", Baud: 115200}
    modem, err := gogsmmodem.Open(&conf, true)
    if err != nil {
        panic(err)
    }

    for packet := range modem.OOB {
        fmt.Printf("%#v\n", packet)
        switch p := packet.(type) {
        case gogsmmodem.MessageNotification:
            fmt.Println("Message notification:", p)
            msg, err := modem.GetMessage(p.Index)
            if err == nil {
                fmt.Printf("Message from %s: %s\n", msg.Telephone, msg.Body)
                modem.DeleteMessage(p.Index)
            }
        }
    }
}

Changelog

0.1.0

  • First release

About

Go GSM Modem library for sending and receiving SMS messages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%