Connect to the android tv device
()
| 138 | |
| 139 | // Connect to the android tv device |
| 140 | func (c *Command) Connect() error { |
| 141 | config := &tls.Config{Certificates: []tls.Certificate{*c.Certificates}, InsecureSkipVerify: true} |
| 142 | |
| 143 | conn, err := tls.Dial("tcp", c.Address+":"+strconv.Itoa(c.Port), config) |
| 144 | if err != nil { |
| 145 | return errors.New("command - connexion: " + err.Error()) |
| 146 | } |
| 147 | c.Connection = conn |
| 148 | |
| 149 | state := conn.ConnectionState() |
| 150 | for !state.HandshakeComplete { |
| 151 | } |
| 152 | |
| 153 | go c.readLoop() |
| 154 | |
| 155 | c.sendConfiguration() |
| 156 | |
| 157 | return nil |
| 158 | } |
| 159 | |
| 160 | // handle message from the android tv device |
| 161 | func (c *Command) handleData(raw []byte) { |
nothing calls this directly
no test coverage detected