You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
668 B
Go

package main
import (
"fmt"
"os"
"strconv"
pc "github.com/kgolding/go-pocsagencode"
)
func main() {
if len(os.Args) != 3 {
fmt.Printf("Usage: %s <pager addr> <text message>\ne.g. %s 13100100 'Hello world!'\n", os.Args[0], os.Args[0])
os.Exit(1)
}
addr, err := strconv.Atoi(os.Args[1])
if err != nil {
fmt.Println("Invalid pager addr - must be a number")
os.Exit(2)
}
messages := []*pc.Message{
&pc.Message{
Addr: uint32(addr),
Content: os.Args[2],
},
}
burst, _ := pc.Generate(messages)
fmt.Printf("Message: %s\n\n", burst.String())
fmt.Printf("Hex bytes: % X\n\n", burst.Bytes())
fmt.Printf("Binary: %s\n\n", burst.BinStr())
}