Documentation
¶
Index ¶
- Constants
- Variables
- func GetChecksumByte(message []byte) byte
- func MakeSubstitutions(command []byte, toCheck map[string]int) ([]byte, error)
- func Unwrap(message []byte) ([]byte, error)
- func Validate(message []byte) ([]byte, error)
- func Wrap(message []byte) ([]byte, error)
- type DSP
- func (d *DSP) BuildCommand(ctx context.Context, input, status string, data []byte, method Method) ([]byte, error)
- func (d *DSP) BuildRawCommand(ctx context.Context, input, state string, data []byte, method Method) ([]byte, error)
- func (d *DSP) BuildRawMuteCommand(ctx context.Context, input, status string) ([]byte, error)
- func (d *DSP) BuildRawVolumeCommand(ctx context.Context, input string, volume int) ([]byte, error)
- func (d *DSP) GetCommandAddress(ctx context.Context, commandByte byte) ([]byte, error)
- func (d *DSP) GetInfo(ctx context.Context) (interface{}, error)
- func (d *DSP) GetMutedByBlock(ctx context.Context, block string) (bool, error)
- func (d *DSP) GetStatus(ctx context.Context, subscribe, unsubscribe []byte, pconn connpool.Conn) ([]byte, error)
- func (d *DSP) GetVolumeByBlock(ctx context.Context, block string) (int, error)
- func (d *DSP) ParseMuteStatus(ctx context.Context, message []byte) (bool, error)
- func (d *DSP) ParseVolumeStatus(ctx context.Context, message []byte) (int, error)
- func (d *DSP) SetMutedByBlock(ctx context.Context, block string, muted bool) error
- func (d *DSP) SetVolumeByBlock(ctx context.Context, block string, volume int) error
- type Method
- type Option
- type RawDICommand
- type RawDIResponse
- type State
Constants ¶
View Source
const ( DI_SETSV = 0x88 DI_SETSVPERCENT = 0x8d DI_SUBSCRIBESV = 0x89 DI_SUBSCRIBESVPERCENT = 0x8e DI_UNSUBSCRIBESV = 0x8a DI_UNSUBSCRIBESVPERCENT = 0x8f )
View Source
const LEN_ADDR = 5
View Source
const LEN_NODE = 2
Variables ¶
View Source
var ACK = byte(0x06)
View Source
var DECODE = map[string]int{
"STX": 0x1b82,
"ETX": 0x1b83,
"ACK": 0x1b86,
"NAK": 0x1b95,
"escape": 0x1b9b,
}
View Source
var ENCODE = map[string]int{
"STX": 0x02,
"ETX": 0x03,
"ACK": 0x06,
"NAK": 0x15,
"escape": 0x1b,
}
View Source
var ETX = byte(0x03)
View Source
var RATE = []byte{0x00, 0x00, 0x00, 0x32} //represents 50 ms, the shortest interval
View Source
var STX = byte(0x02)
View Source
var VIRTUAL_DEVICE = byte(0x03)
VIRTUAL_DEVICE byte should be the same for all cases!
Functions ¶
func GetChecksumByte ¶
generates a checksum byte according to the exclusive or of all bytes in the message
func MakeSubstitutions ¶
func Unwrap ¶
removes STX and ETX bytes @pre: slice begins with STX and ends with ETX @post: slice does not contain STX nor ETX bytes
Types ¶
type DSP ¶
type DSP struct {
Address string
// contains filtered or unexported fields
}
func (*DSP) BuildCommand ¶
func (d *DSP) BuildCommand(ctx context.Context, input, status string, data []byte, method Method) ([]byte, error)
BuildCommand .
func (*DSP) BuildRawCommand ¶
func (d *DSP) BuildRawCommand(ctx context.Context, input, state string, data []byte, method Method) ([]byte, error)
BuildRawCommand .
func (*DSP) BuildRawMuteCommand ¶
func (*DSP) BuildRawVolumeCommand ¶
func (*DSP) GetCommandAddress ¶
builds command, node, virtual device, and object
func (*DSP) GetMutedByBlock ¶
GetMute .
func (*DSP) GetStatus ¶
func (d *DSP) GetStatus(ctx context.Context, subscribe, unsubscribe []byte, pconn connpool.Conn) ([]byte, error)
GetStatus .
func (*DSP) GetVolumeByBlock ¶
GetVolume .
func (*DSP) ParseMuteStatus ¶
@pre: checksum byte removed
func (*DSP) ParseVolumeStatus ¶
@pre: checksum byte removed
func (*DSP) SetMutedByBlock ¶
type RawDICommand ¶
type RawDIResponse ¶
type RawDIResponse struct {
Response []string `json:"response"`
}
Click to show internal directories.
Click to hide internal directories.