mqtt_client: rm debug

This commit is contained in:
occheung 2020-09-23 10:44:38 +08:00
parent f1376cab07
commit 5dc9ec5a08
1 changed files with 10 additions and 9 deletions

View File

@ -129,10 +129,15 @@ fn main() -> ! {
let neighbor_cache = net::iface::NeighborCache::new(&mut store.neighbor_cache[..]);
let mut routes = net::iface::Routes::new(&mut store.routes_cache[..]);
let default_v4_gw = net::wire::Ipv4Address::new(192, 168, 1, 1);
routes.add_default_ipv4_route(default_v4_gw).unwrap();
let mut net_interface = net::iface::EthernetInterfaceBuilder::new(eth_dma)
.ethernet_addr(mac_addr)
.neighbor_cache(neighbor_cache)
.ip_addrs(&mut store.ip_addrs[..])
.routes(routes)
.finalize();
/*
@ -173,9 +178,7 @@ fn main() -> ! {
cp.SCB.invalidate_icache();
cp.SCB.enable_icache();
// TODO: Remove this simple test
let mut mqtt_mux = MqttMux::new(urukul);
info!("{:?}", mqtt_mux.handle_command("Urukul/Control/Channel0/Switch", "on".as_bytes()));
// Time unit in ms
let mut time: u32 = 0;
@ -220,16 +223,14 @@ fn main() -> ! {
}
let connection = client
.poll(|_client, topic, message, _properties| match topic {
topic => {
info!("On '{:?}', received: {:?}", topic, message);
// Why is topic a string while message is a slice?
mqtt_mux.handle_command(topic, message).unwrap();
},
.poll(|_client, topic, message, _properties| {
info!("On '{:?}', received: {:?}", topic, message);
// Why is topic a string while message is a slice?
mqtt_mux.process_mqtt(topic, message);
}).is_ok();
if connection && !has_subscribed && tick {
match client.subscribe("Urukul/Control", &[]) {
match client.subscribe("Urukul/Control/#", &[]) {
Ok(()) => has_subscribed = true,
Err(minimq::Error::NotReady) => {},
e => warn!("{:?}", e),