Crates.io | w5500-mqtt |
lib.rs | w5500-mqtt |
version | 0.4.0 |
source | src |
created_at | 2022-03-20 19:39:29.986753 |
updated_at | 2024-06-09 20:15:33.280679 |
description | MQTT client for the Wiznet W5500 internet offload chip. |
homepage | https://github.com/newAM/w5500-rs |
repository | https://github.com/newAM/w5500-rs |
max_upload_size | |
id | 553705 |
size | 118,680 |
MQTT v5 client for the Wiznet W5500 SPI internet offload chip.
This is very basic at the moment, and will be expanded in the future.
use w5500_mqtt::{
ll::{
net::{Ipv4Addr, SocketAddrV4},
Sn,
},
Client, ClientId, Event, DST_PORT, SRC_PORT,
};
let mut client: Client = Client::new(
Sn::Sn2,
SRC_PORT,
SocketAddrV4::new(Ipv4Addr::new(192, 168, 5, 6), DST_PORT),
);
// wait for a connection or die trying
while !matches!(client.process(&mut w5500, monotonic_secs())?, Event::None) {}
// publish to "duck" with a payload "quack"
client.publish(&mut w5500, "duck", b"quack")?;
// subscribe to "cow"
client.subscribe(&mut w5500, "cow")?;
All features are disabled by default.