func (s *STFRotation) Rotation() (int, error) {
	if s.lastValue == -1 || s.stopped {
		return 0, errors.New("Rotation not ready")
	}
	return s.lastValue, nil
}
0, 90, 180, 270
package stf
import (
	"bufio"
	"fmt"
	"io"
	"log"
	"net/http"
	"strconv"
	"strings"
	"sync"
	"time"
	adb "github.com/openatx/go-adb"
	"github.com/openatx/go-adb/wire"
	"github.com/pkg/errors"
)
const (
	defaultRotationPkgName  = "jp.co.cyberagent.stf.rotationwatcher"
	defaultRotationMaxRetry = 3
)
type STFRotation struct {
	d           *adb.Device
	mu          sync.Mutex
	lastValue   int
	subscribers map[chan int]bool
	cmdConn     *wire.Conn
	wg          sync.WaitGroup
	stopped     bool
	leftRetry   int
}
func NewSTFRotation(d *adb.Device) *STFRotation {
	return &STFRotation{
		d:           d,
		subscribers: make(map[chan int]bool),
		leftRetry:   defaultRotationMaxRetry,
		lastValue:   -1,
	}
}