pub struct TcpClientHandshake { /* private fields */ }
Expand description

Handles the client-side of the VBus-over-TCP handshake.

Examples

This example connects to a RESOL DL2 at “192.168.5.81”, provides the password for authorization and then send the DATA command. After that the socket transmits raw VBus data and can be used with e.g. LiveDataStream.

use tokio::prelude::*;
use tokio::net::TcpStream;
use tokio_resol_vbus::{Error, TcpClientHandshake};

let addr = "192.168.5.81:7053".parse().expect("Unable to parse address");
let handler = TcpStream::connect(&addr)
    .map_err(Error::new)
    .and_then(TcpClientHandshake::start)
    .and_then(|hs| hs.send_pass_command("vbus"))
    .and_then(|hs| hs.send_data_command())
    .and_then(|socket| {
        // use the socket
    })
    .map_err(|err| eprintln!("{}", err));
tokio::run(handler);

Implementations§

Start the VBus-over-TCP handshake as the client side connecting to a server.

Consume self and return the underlying TcpStream.

Send the CONNECT <via_tag> command to the server and wait for a positive reply.

Send the PASS <password> command to the server and wait for a positive reply.

Send the CHANNEL <channel> command to the server and wait for a positive reply.

Send the DATA command to the server and wait for a positive reply.

Send the QUIT command to the server and wait for a positive reply.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.