pub trait Node {
    type Clock: Clock<Instant = Self::Instant>;
    type Instant: Instant;
    type Transport: Transport;
    type Transmitter: Transmitter<Self::Instant, Transport = Self::Transport>;
    type Receiver: Receiver<Self::Instant, Transport = Self::Transport>;
Show 18 methods fn receive<H>(
        &mut self,
        handler: &mut H
    ) -> Result<(), <Self::Receiver as Receiver<Self::Instant>>::Error>
    where
        H: TransferHandler<Self::Instant, Self::Transport>
; fn start_publishing<T>(
        &mut self,
        subject: SubjectId,
        timeout: <<<Self as Node>::Clock as Clock>::Instant as Instant>::Duration,
        priority: <Self::Transport as Transport>::Priority
    ) -> Result<PublishToken<T>, StartSendError<<Self::Transmitter as Transmitter<Self::Instant>>::Error>>
    where
        T: Message
; fn stop_publishing<T>(&mut self, token: PublishToken<T>)
    where
        T: Message
; fn publish<T>(
        &mut self,
        token: &PublishToken<T>,
        payload: &T
    ) -> Result<(), <Self::Transmitter as Transmitter<Self::Instant>>::Error>
    where
        T: Message + Serialize
; fn start_sending_requests<T>(
        &mut self,
        service: ServiceId,
        receive_timeout: <<<Self as Node>::Clock as Clock>::Instant as Instant>::Duration,
        response_payload_size_max: usize,
        priority: <Self::Transport as Transport>::Priority
    ) -> Result<ServiceToken<T>, StartSendError<<Self::Receiver as Receiver<Self::Instant>>::Error>>
    where
        T: Request
; fn stop_sending_requests<T>(&mut self, token: ServiceToken<T>)
    where
        T: Request
; fn send_request<T>(
        &mut self,
        token: &ServiceToken<T>,
        payload: &T,
        destination: <Self::Transport as Transport>::NodeId
    ) -> Result<<Self::Transport as Transport>::TransferId, <Self::Transmitter as Transmitter<Self::Instant>>::Error>
    where
        T: Request + Serialize
; fn subscribe_message(
        &mut self,
        subject: SubjectId,
        payload_size_max: usize,
        timeout: <<<Self as Node>::Clock as Clock>::Instant as Instant>::Duration
    ) -> Result<(), <Self::Receiver as Receiver<Self::Instant>>::Error>; fn subscribe_request(
        &mut self,
        service: ServiceId,
        payload_size_max: usize,
        timeout: <<<Self as Node>::Clock as Clock>::Instant as Instant>::Duration
    ) -> Result<(), <Self::Receiver as Receiver<Self::Instant>>::Error>; fn send_response<T>(
        &mut self,
        token: ResponseToken<Self::Transport>,
        timeout: <<<Self as Node>::Clock as Clock>::Instant as Instant>::Duration,
        payload: &T
    ) -> Result<(), <Self::Transmitter as Transmitter<Self::Instant>>::Error>
    where
        T: Response + Serialize
; fn flush(
        &mut self
    ) -> Result<(), <Self::Transmitter as Transmitter<Self::Instant>>::Error>; fn clock(&self) -> &Self::Clock; fn clock_mut(&mut self) -> &mut Self::Clock; fn transmitter(&self) -> &Self::Transmitter; fn transmitter_mut(&mut self) -> &mut Self::Transmitter; fn receiver(&self) -> &Self::Receiver; fn receiver_mut(&mut self) -> &mut Self::Receiver; fn node_id(&self) -> <Self::Transport as Transport>::NodeId;
}
Expand description

A UAVCAN node

A node has a node ID (it is not anonymous), a clock, a queue of outgoing frames waiting to be sent, and information about the subjects and services it is using.

Associated Types

The clock that this node uses

The instant that this node’s clock produces

The transport that this node uses

The transmitter that this node uses

The receiver that this node uses

Required methods

Receives any available incoming frames and attempts ot reassemble them into a transfer

If the frame completes a transfer, the transfer is passed to the provided handler.

This function returns an error if memory for the received transfer could not be allocated. Other types of errors, like an invalid frame format or an incorrect transfer CRC, may cause transfers to be lost but are not reported as errors here.

Starts publishing messages on subject

The returned PublishToken can be used with the publish function to send a message.

This function returns an error if memory for the publishing data could not be allocated, or if the subject ID is already in use.

Stops publishing messages on a subject

Publishes a message

A token can be created by calling start_publishing.

Sets up to send requests for a service

This also subscribes to the corresponding responses.

This function returns an error if memory could not be allocated, or if the subject ID is already in use.

Stops sending requests for a service

Sends a service request to another node

On success, this function returns the transfer ID of the request.

Subscribes to messages on a topic

Subscribes to requests for a service

Responds to a service request

This function requires a response token to match this response to its corresponding request. The token is passed to a transfer handler along with a request, so that the handler can send a response.

Attempts to flush all outgoing frames

Returns a reference to the enclosed clock

Returns a mutable reference to the enclosed clock

Returns a reference to the transport transmitter

Returns a mutable reference to the transport transmitter

Returns a reference to the transport receiver

Returns a mutable reference to the transport receiver

Returns the identifier of this node

Implementors