[][src]Struct tokio_resol_vbus::TcpClientHandshake

pub struct TcpClientHandshake { /* fields omitted */ }

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);

Methods

impl TcpClientHandshake
[src]

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

impl Debug for TcpClientHandshake
[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T