Mock Observer
The Mock Observer was written to test that the IBus parsing logic on the Pico worked. I wanted a way to verify all the Ibus ingress logic of the DmaManager worked by printing out the contents of the incoming Ibus messages to the screen.
I could verify this by corroborating with an install of NavCoder
on an old PeopleNet T1000 tablet. I used a Modbmw USB Ibus Dongle to attach the tablet to the IBus network.
Here you can see the MockObserver
helping to decode the first valid packet the Pico firmware read. There were enough global broadcasts on the network from the cluster that I could tell by inspection if I was decoding them correctly. You can see in the log messages that every packet gets sent to every observer, and its up to the observers to figure out what they want to do with the packet.
Source
The source code for the observer depends on the correct bus topology being set in the DmaManager:
void MockObserver::onNewPacket(std::shared_ptr<pico::ibus::data::IbusPacket> iBusPacket) {
if (busTopologyManager->getBusToplogy() == topology::BusTopology::SLED_NO_PI) {
logger->d("MockObserver", iBusPacket->toString());
}
}