Crate tplink_shome_protocol

Crate tplink_shome_protocol 

Source
Expand description

Simple library to easily communicate with a tp link smart device.

§Usage

use std::io;
use std::net::TcpStream;

use tplink_shome_protocol::{receive_message, send_message};

fn main() -> io::Result<()> {
    let stream = TcpStream::connect("192.168.1.1:9999")?;
    let raw = r#"{"system":{"get_sysinfo":{}}}"#;
    send_message(&stream, raw)?;
    let message = receive_message(&stream)?;
    ...
}

Functions§

decrypt
encrypt
receive_message
Blocks until it receives a message from the TcpStream
send_message
Sends a message to the smart device connected via the TcpStream