prototooth/examples/nusserver/linux.go
Ayke van Laethem b568c93250
all: add support for sending notifications
This is done by enabling the Notify permission and writing to the
characteristics: writes will automatically notify connected centrals.
2020-06-03 19:42:21 +02:00

34 lines
434 B
Go

// +build linux,!baremetal
package main
import (
"os"
"golang.org/x/crypto/ssh/terminal"
)
var (
stdout = os.Stdout
terminalState *terminal.State
)
func getchar() byte {
var b [1]byte
os.Stdin.Read(b[:])
return b[0]
}
func putchar(ch byte) {
b := [1]byte{ch}
os.Stdout.Write(b[:])
}
func initTerminal() {
terminalState, _ = terminal.MakeRaw(0)
}
func restoreTerminal() {
terminal.Restore(0, terminalState)
}