Skip to main content

RouterConnection

Struct RouterConnection 

Source
pub struct RouterConnection { /* private fields */ }
Expand description

A KNXnet/IP router connection over multicast UDP.

Implementations§

Source§

impl RouterConnection

Source

pub async fn connect( local_addr: Ipv4Addr, multicast: SocketAddrV4, ) -> Result<Self, KnxIpError>

Join the KNX multicast group and start receiving routing indications.

local_addr is the local interface to bind to (use 0.0.0.0 for any). multicast is the multicast group + port (default 224.0.23.12:3671).

§Errors

Returns KnxIpError if the socket cannot be created or joined.

Source

pub async fn connect_v4( local_addr: Ipv4Addr, multicast: SocketAddrV4, ) -> Result<Self, KnxIpError>

Join an IPv4 KNX multicast group and start receiving routing indications.

§Errors

Returns KnxIpError if the socket cannot be created or joined.

Source

pub async fn connect_v6( interface: u32, multicast: SocketAddrV6, ) -> Result<Self, KnxIpError>

Join an IPv6 multicast group and start receiving routing indications.

Use the target address scope id or pass an explicit interface index for link-local multicast groups.

§Errors

Returns KnxIpError if the socket cannot be created or joined.

Source

pub async fn connect_multicast( multicast: SocketAddr, ) -> Result<Self, KnxIpError>

Join a KNX multicast group from a generic socket address.

IPv4 uses 0.0.0.0 as the interface selector. IPv6 uses the target scope id as the interface index when present.

§Errors

Returns KnxIpError if the socket cannot be created or joined.

Source

pub async fn connect_default(local_addr: Ipv4Addr) -> Result<Self, KnxIpError>

Connect to the default KNX multicast group (224.0.23.12:3671).

§Errors

Returns KnxIpError if the socket cannot be created.

Trait Implementations§

Source§

impl KnxConnection for RouterConnection

Source§

fn send(&self, frame: CemiFrame) -> KnxFuture<'_, Result<(), KnxIpError>>

Send a CEMI frame to the KNX bus. Read more
Source§

fn recv(&mut self) -> KnxFuture<'_, Option<CemiFrame>>

Receive the next CEMI frame from the KNX bus. Read more
Source§

fn close(&mut self) -> KnxFuture<'_, ()>

Close the connection gracefully.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GroupOps for T
where T: KnxConnection,

Source§

fn group_write( &self, ga: GroupAddress, data: &[u8], ) -> KnxFuture<'_, Result<(), KnxIpError>>

Write a raw value to a group address. Read more
Source§

fn group_write_value( &self, ga: GroupAddress, dpt: Dpt, value: &DptValue, ) -> KnxFuture<'_, Result<(), KnxIpError>>

Write a DPT-encoded DptValue to a group address. Read more
Source§

fn group_read(&self, ga: GroupAddress) -> KnxFuture<'_, Result<(), KnxIpError>>

Send a group read request. Read more
Source§

fn group_respond( &self, ga: GroupAddress, data: &[u8], ) -> KnxFuture<'_, Result<(), KnxIpError>>

Send a group value response. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more