From 13bbba0e07bf0311997de9fdfc4f0904f5c6c3ca Mon Sep 17 00:00:00 2001 From: Przemko Date: Sat, 20 Nov 2021 13:03:06 +0100 Subject: [PATCH] read me --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7ecc0ad --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# go-satel + +go-satel is a Go library to integrate +with [Satel ETHM-1/ETHM-1 Plus](https://www.satel.pl/produkty/sswin/komunikacja-i-powiadamianie/komunikacja-tcp-ip/ethm-1-plus/) +module + +[![Build](https://github.com/probakowski/go-satel/actions/workflows/build.yml/badge.svg)](https://github.com/probakowski/go-satel/actions/workflows/build.yml) +[![Go Report Card](https://goreportcard.com/badge/github.com/probakowski/go-satel)](https://goreportcard.com/report/github.com/probakowski/go-satel) + +## Installation +go-satel is compatible with modern Go releases in module mode, with Go installed: + +```bash +go get github.com/probakowski/go-satel +``` + +will resolve and add the package to the current development module, along with its dependencies. + +Alternatively the same can be achieved if you use import in a package: + +```go +import "github.com/probakowski/go-satel" +``` + +and run `go get` without parameters. + +Finally, to use the top-of-trunk version of this repo, use the following command: + +```bash +go get github.com/probakowski/go-satel@master +``` + +## Usage +```go +s := satel.NewConfig("", satel.Config{EventsQueueSize: 1000}) +go func() { + value := true + for { + s.SetOutput("", value) + time.Sleep(5 * time.Second) + value = !value + } +}() +for e, ok := <-s.Events; ok; e, ok = <-s.Events { + logger.Print("change from satel", "type", e.Type, "index", e.Index, "value", e.Value) +} +``` \ No newline at end of file