Documentation ¶
Overview ¶
Package ipod implements the iPod Accessory protocol (iap)
Index ¶
- Constants
- func BoolToByte(b bool) byte
- func ByteToBool(b byte) bool
- func Checksum(p []byte) uint8
- func DumpLingos() string
- func RegisterLingos(lingoID uint8, m interface{}) error
- func Respond(req *Command, pw CommandWriter, payload interface{})
- func Send(pw CommandWriter, payload interface{})
- func StringToBytes(s string) []byte
- func TrxReset()
- type CRC8
- type CmdBuffer
- type Command
- type CommandReader
- type CommandSerde
- type CommandWriter
- type FrameReadWriter
- type FrameReader
- type FrameWriter
- type LingoCmdID
- type LookupResult
- type PacketReader
- type PacketWriter
- type Transaction
- type UnknownPayload
Constants ¶
const ( LingoGeneralID = 0x00 LingoSimpleRemoteID = 0x02 LingoDisplayRemoteID = 0x03 LingoExtRemoteID = 0x04 LingoUSBHostID = 0x06 LingoRFTunerID = 0x07 LingoEqID = 0x08 LingoSportsID = 0x09 LingoDigitalAudioID = 0x0A LingoStorageID = 0x0C )
const (
PacketStartByte byte = 0x55
)
Variables ¶
This section is empty.
Functions ¶
func BoolToByte ¶
func ByteToBool ¶
func DumpLingos ¶
func DumpLingos() string
DumpLingos returns a list of all registered lingos and commands
func RegisterLingos ¶
RegisterLingos registers a set of lingo commands
func Respond ¶
func Respond(req *Command, pw CommandWriter, payload interface{})
func Send ¶
func Send(pw CommandWriter, payload interface{})
func StringToBytes ¶
StringToBytes convers a string to a null-terminated byte slice
Types ¶
type Command ¶
type Command struct { ID LingoCmdID //Optional Transaction *Transaction Payload interface{} }
Command represents iap packet payload
func BuildCommand ¶
type CommandReader ¶
type CommandSerde ¶
type CommandSerde struct {
TrxEnabled bool
}
func (*CommandSerde) MarshalCmd ¶
func (s *CommandSerde) MarshalCmd(cmd *Command) ([]byte, error)
func (*CommandSerde) UnmarshalCmd ¶
func (s *CommandSerde) UnmarshalCmd(pkt []byte) (*Command, error)
type CommandWriter ¶
type FrameReadWriter ¶
type FrameReadWriter interface { FrameReader FrameWriter }
FrameReadWriter is the interface implemented by iap transports i.e. usbhid
type FrameReader ¶
type FrameWriter ¶
type LingoCmdID ¶
type LingoCmdID uint32
LingoCmdID represents Lingo ID and Command ID
func LookupID ¶
func LookupID(v interface{}) (id LingoCmdID, ok bool)
LookupID finds a registered LingoCmdID by the type of v i.e. reverse to Lookup
func NewLingoCmdID ¶
func NewLingoCmdID(lingo, cmd uint16) LingoCmdID
func (LingoCmdID) CmdID ¶
func (id LingoCmdID) CmdID() uint16
func (LingoCmdID) GoString ¶
func (id LingoCmdID) GoString() string
func (LingoCmdID) LingoID ¶
func (id LingoCmdID) LingoID() uint8
func (LingoCmdID) String ¶
func (id LingoCmdID) String() string
type LookupResult ¶
type LookupResult struct { Payload interface{} Transaction bool }
LookupResult contains the result of a Lookup. Payload is a pointer to a new zero value of the found type Transaction specifies if the Transaction should be present in the packet.
func Lookup ¶
func Lookup(id LingoCmdID, payloadSize int, defaultTrxEnabled bool) (LookupResult, bool)
Lookup finds a the payload by LingoCmdID using payloadSize as a hint
type PacketReader ¶
type PacketReader struct {
// contains filtered or unexported fields
}
func NewPacketReader ¶
func NewPacketReader(frame []byte) *PacketReader
func (*PacketReader) ReadPacket ¶
func (pd *PacketReader) ReadPacket() ([]byte, error)
type PacketWriter ¶
type PacketWriter struct {
// contains filtered or unexported fields
}
func NewPacketWriter ¶
func NewPacketWriter() *PacketWriter
func (*PacketWriter) Bytes ¶
func (pw *PacketWriter) Bytes() []byte
func (*PacketWriter) WritePacket ¶
func (pw *PacketWriter) WritePacket(payload []byte) error
type Transaction ¶
type Transaction uint16
func NewTransaction ¶
func NewTransaction(t uint16) *Transaction
func TrxNext ¶
func TrxNext() *Transaction
func (*Transaction) Copy ¶
func (tr *Transaction) Copy() *Transaction
func (*Transaction) Delta ¶
func (tr *Transaction) Delta(d int) *Transaction
func (Transaction) GoString ¶
func (tr Transaction) GoString() string
func (Transaction) String ¶
func (tr Transaction) String() string
type UnknownPayload ¶
type UnknownPayload []byte
UnknownPayload is a payload that represents an unknown command