Struct coap::client::CoAPClient
[−]
[src]
pub struct CoAPClient { /* fields omitted */ }
Methods
impl CoAPClient
[src]
pub fn new_with_specific_source<A: ToSocketAddrs, B: ToSocketAddrs>(
bind_addr: A,
peer_addr: B
) -> Result<CoAPClient>
[src]
bind_addr: A,
peer_addr: B
) -> Result<CoAPClient>
Create a CoAP client with the specific source and peer address.
pub fn new<A: ToSocketAddrs>(addr: A) -> Result<CoAPClient>
[src]
Create a CoAP client with the peer address.
pub fn get(url: &str) -> Result<CoAPResponse>
[src]
Execute a get request
pub fn get_with_timeout(url: &str, timeout: Duration) -> Result<CoAPResponse>
[src]
Execute a get request with the coap url and a specific timeout.
pub fn observe<H: Fn(Packet) + Send + 'static>(
&mut self,
resource_path: &str,
handler: H
) -> Result<()>
[src]
&mut self,
resource_path: &str,
handler: H
) -> Result<()>
Observe a resource with the handler
pub fn unobserve(&mut self)
[src]
Stop observing
pub fn request_with_timeout(
url: &str,
timeout: Option<Duration>
) -> Result<CoAPResponse>
[src]
url: &str,
timeout: Option<Duration>
) -> Result<CoAPResponse>
Deprecated since 0.6.0
: please use get_with_timeout
instead
Execute a request with the coap url and a specific timeout. Default timeout is 5s.
pub fn request(url: &str) -> Result<CoAPResponse>
[src]
Deprecated since 0.6.0
: please use get
instead
Execute a request with the coap url.
pub fn send(&self, request: &CoAPRequest) -> Result<()>
[src]
Execute a request.
pub fn receive(&self) -> Result<CoAPResponse>
[src]
Receive a response.
pub fn set_receive_timeout(&self, dur: Option<Duration>) -> Result<()>
[src]
Set the receive timeout.