MCPcopy Create free account
hub / github.com/drosoCode/atvremote / write

Method write

pkg/v2/command/command.go:116–132  ·  view source on GitHub ↗

send a remote message to the android tv device

(data pb.RemoteMessage)

Source from the content-addressed store, hash-verified

114
115// send a remote message to the android tv device
116func (c *Command) write(data pb.RemoteMessage) error {
117 raw, err := proto.Marshal(&data)
118 if err != nil {
119 return errors.New("v2 - write message - marshal:" + err.Error())
120 }
121
122 _, err = c.Connection.Write([]byte{byte(len(raw))})
123 if err != nil {
124 return errors.New("v2 - write message - send 1:" + err.Error())
125 }
126 _, err = c.Connection.Write(raw)
127 if err != nil {
128 return errors.New("v2 - write message - send 2:" + err.Error())
129 }
130
131 return nil
132}
133
134// Create a new command object with the ip and port of the android tv device and a certificate
135func New(addr string, port int, certs *tls.Certificate) Command {

Callers 4

handleDataMethod · 0.95
sendConfigurationMethod · 0.95
SendKeyMethod · 0.95
OpenLinkMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected