Skip to main content

Crate smartcast

Crate smartcast 

Source
Expand description

§SmartCast Api

This library provides an API for connecting to and controlling Vizio SmartCast TVs and Speakers. The struct Device provides a client for interfacing with the SmartCast device.

§Get Started

You can use discover_devices() to find SmartCast devices on your local network by issuing an SSDP Query or attempt to connect directly using Device::from_ip() or Device::from_uuid().

§Example

use smartcast::Device;

async fn example_main() -> Result<(), smartcast::Error> {

    let ssdp_devices = smartcast::discover_devices().await?;

    let dev_by_ssdp = ssdp_devices[0].clone();
    let ip_addr = dev_by_ssdp.ip();
    let uuid = dev_by_ssdp.uuid();

    let dev_by_ip = Device::from_ip(ip_addr).await?;
    let dev_by_uuid = Device::from_uuid(uuid).await?;

    assert_eq!(dev_by_ssdp.name(), dev_by_ip.name());
    assert_eq!(dev_by_ssdp.name(), dev_by_uuid.name());

    Ok(())
}

§Task List

  • Connect
  • Pairing
  • Get device state
  • Virtual remote commands
  • Readable settings
  • Writeable settings
  • Current App
  • App launching

Structs§

App
Various information about an App
Device
A SmartCast Device
DeviceInfo
Various infomation about the device returned by device_info()
Input
Input on the device
SliderInfo
Information about a settings slider
SubSetting
Settings for a Device

Enums§

ApiError
Errors from the SmartCast device
Button
Remote control “buttons” you can interact with using Device::key_press(), Device::key_down(), or Device::key_up()
ClientError
Errors for client issues in Device
Error
Errors for API calls from Device
SettingType
Object types to which SubSetting corresponds.

Functions§

discover_devices
Discover devices on network

Type Aliases§

Result
Result for API calls from Device