-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
64 lines (50 loc) · 1004 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2015 Satoshi Konno. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
lightdev is a sample implementation of UPnP standard device, BinaryLight:1.
NAME
lightdev
SYNOPSIS
lightdev [OPTIONS]
DESCRIPTION
lightdev is a sample implmentation of UPnP Standardized DCP, BinaryLight:1
OPTIONS
-v : *level* Enable verbose output.
RETURN VALUE
Return EXIT_SUCCESS or EXIT_FAILURE
*/
package main
import (
"bufio"
"os"
"github.com/cybergarage/go-logger/log"
)
func handleInput() {
for {
reader := bufio.NewReader(os.Stdin)
key, err := reader.ReadByte()
if err != nil {
continue
}
if key == 'q' {
return
}
}
}
func main() {
log.SetSharedLogger(log.NewStdoutLogger(log.LevelTrace))
dev, err := NewLightDevice()
if err != nil {
log.Error(err)
os.Exit(1)
}
err = dev.Start()
if err != nil {
log.Error(err)
os.Exit(1)
}
defer dev.Stop()
handleInput()
os.Exit(0)
}