send a remote message to the android tv device
(data pb.RemoteMessage)
| 114 | |
| 115 | // send a remote message to the android tv device |
| 116 | func (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 |
| 135 | func New(addr string, port int, certs *tls.Certificate) Command { |
no outgoing calls
no test coverage detected