Return to Home Page

Pico Configuration Push Observer

This observer forms part of the Configuration request/response cycle.

sequenceDiagram participant Pi participant Pico Pi->>Pico: PiToPico.ConfigStatusRequest Pico->>Pi: PicoToPi.ConfigStatusResponse Pi->>Pico: PiToPico.ConfigPush

It implements the observer that allows the Pico to respond to the PiToPico.ConfigPush IBus messages. It takes the incoming Config object and saves it in the Configuration Store. It also emits the current configuration as a PicoToPi.ConfigStatusResponse once the new config is saved so that everyone snooping can know that it has changed.

Source

The source code for this observer is pretty straight-forward:

void PicoConfigurationReadRequestObserver::onNewPiToPicoPacket(messages::PiToPicoMessage message) {
    if (message.messageType == messages::PiToPicoMessage::MessageType::ConfigStatusRequest) {
        logger->d(getTag(), "Got a config request from Pi.");
        configurationStatusWriter->scheduleEmit(
                configurationManager->getConfigurationCopy().toMessage()
                );
}
Return to Top