Documentation
¶
Index ¶
- Constants
- Variables
- func BuildCommand(address, input, status string, data []byte, method Method) ([]byte, error)
- func BuildRawCommand(address, input, state string, data []byte, method Method) ([]byte, error)
- func BuildRawMuteCommand(input, address, status string) ([]byte, error)
- func BuildRawVolumeCommand(input string, address string, volume string) ([]byte, error)
- func GetChecksumByte(message []byte) byte
- func GetCommandAddress(commandByte byte, address string) ([]byte, error)
- func GetMute(address, input string) (status.Mute, error)
- func GetStatus(subscribe, unsubscribe []byte, address string, pconn pooled.Conn) ([]byte, error)
- func GetVolume(address, input string) (status.Volume, error)
- func MakeSubstitutions(command []byte, toCheck map[string]int) ([]byte, error)
- func Mute(input string, address string) error
- func ParseMuteStatus(message []byte) (status.Mute, error)
- func ParseVolumeStatus(message []byte) (status.Volume, error)
- func SetVolume(input string, address string, volume string) error
- func UnMute(input string, address string) error
- func Unwrap(message []byte) ([]byte, error)
- func Validate(message []byte) ([]byte, error)
- func Wrap(message []byte) ([]byte, error)
- type Method
- type RawDICommand
- type RawDIResponse
- type ReadWrite
- 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
View Source
const PORT = "1023"
View Source
const TIMEOUT = 5
TIMEOUT .
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 BuildCommand ¶
BuildCommand .
func BuildRawCommand ¶
BuildRawCommand .
func BuildRawMuteCommand ¶
func BuildRawVolumeCommand ¶
func GetChecksumByte ¶
generates a checksum byte according to the exclusive or of all bytes in the message
func GetCommandAddress ¶
builds command, node, virtual device, and object
func MakeSubstitutions ¶
func ParseMuteStatus ¶
@pre: checksum byte removed
func ParseVolumeStatus ¶
@pre: checksum byte removed
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 RawDICommand ¶
type RawDIResponse ¶
type RawDIResponse struct {
Response []string `json:"response"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.