Skip to content

__main__

main() #

Run firmware parameter manager utility.

During installation of cogip-tools, setuptools is configured to create the cogip-firmware-parameter-manager script using this function as entrypoint.

Source code in cogip/tools/firmware_parameter_manager/__main__.py
80
81
82
83
84
85
86
87
def main():
    """
    Run firmware parameter manager utility.

    During installation of cogip-tools, `setuptools` is configured
    to create the `cogip-firmware-parameter-manager` script using this function as entrypoint.
    """
    typer.run(main_opt)

main_async(server_url, parameters_group) async #

CLI utility to test firmware parameter communication. Creates its own Socket.IO client to host the FirmwareParameterManager.

Source code in cogip/tools/firmware_parameter_manager/__main__.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
async def main_async(server_url: str, parameters_group: FirmwareParametersGroup):
    """
    CLI utility to test firmware parameter communication.
    Creates its own Socket.IO client to host the FirmwareParameterManager.
    """
    sio = socketio.AsyncClient(logger=False)
    manager = FirmwareParameterManager(sio=sio, parameter_group=parameters_group)

    await sio.connect(server_url, namespaces=[manager.namespace])

    print("Firmware parameter values before reading from firmware:")
    for param in manager.parameter_group:
        print(f"  {param.name:.<40} {param.value}")
    print()

    for param in manager.parameter_group:
        try:
            await manager.get_parameter_value(param.name)
        except TimeoutError:
            print(f"  {param.name:.<40} TIMEOUT")

    print("Firmware parameter values after reading from firmware:")
    for param in manager.parameter_group:
        print(f"  {param.name:.<40} {param.value}")
    print()

    manager.cleanup()
    await sio.disconnect()