go-rfb/encoding_ledstate.go
Vasiliy Tolstov aa2ac23130 add led state pseudo encoding
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-01-23 01:52:23 +03:00

25 lines
554 B
Go

package rfb
import "encoding/binary"
type LedStatePseudoEncoding struct {
State uint8
}
func (*LedStatePseudoEncoding) Supported(Conn) bool {
return true
}
func (*LedStatePseudoEncoding) Type() EncodingType { return EncLedStatePseudo }
func (enc *LedStatePseudoEncoding) Read(c Conn, rect *Rectangle) error {
if err := binary.Read(c, binary.BigEndian, &enc.State); err != nil {
return err
}
return nil
}
func (enc *LedStatePseudoEncoding) Write(c Conn, rect *Rectangle) error {
return binary.Write(c, binary.BigEndian, []byte{enc.State})
}