Crate roku_ecp

Source
Expand description

§Roku ECP

This crate provides a wrapper over the Roku External Control Protocol which enables a Roku device to be controlled over a local area network through a RESTful API.

§Example Usage

The crate is fairly straightforward since all relevant methods revolve around the Device struct.

For a full code representation, view the examples folder.

use roku_ecp::{Device, Key, SearchRequest, SearchType};
let roku = Device::new("192.168.1.138").unwrap(); // remember to change the IP.

// Print information on the Roku device
println!("{:?}", roku.device_info().await.unwrap());

// Press the play button
roku.key_press(Key::Play).await.unwrap();

// Search for something
let search = SearchRequest::new("The Mandalorian")
    .search_type(SearchType::TvShow)
    .season(2)

roku.search(search).await.unwrap();

§Features

Currently Implemented:

  • Queries for device, media player, and app information.
  • Key press/down/up events for various keys.
  • Launching/Installing Applications.
  • Searching through Roku’s Search UI.

Possible Features for the Future:

  • Scanning the local network for Roku devices.
  • Inputs for accelerometer, orientation, gyroscope, magnetometer, touch, and multi-touch.
  • Roku TV commands for queries and inputs.

§Dependencies

Operating Systems

Windows and macOS: None

Linux: OpenSSL + headers > v1.0.1

  • Debian: sudo apt install libssl-dev
  • Fedora: sudo dnf install openssl-devel

Async Runtime

This crate requires an asynchronous runtime such as tokio or async-std.

Structs§

Device
An HTTP client that communicates with a Roku device.
SearchRequest
Describes a search to the Roku Search UI to find and (optionally) launch content from an available provider.

Enums§

Error
Roku communication errors.
Key
Supported key values for Roku devices.
SearchType
Constraints for the type of desired search result.

Constants§

ECP_PORT
Default port for communicating with the ECP RESTful service.