C
Implementing Logging Support
Printing log
Implement the PlatformContext::consoleWrite to support printing messages. This method is called by the Qt Quick Ultralite core to print single characters and it acts as the output for Qul::PlatformInterface::log.
Example implementation
void ExamplePlatform::consoleWrite(char character) { // Write the charactor to your boards output device }
Note: It is recommended to do some kind of buffering and not directly write each buffer to the device for performance reasons.
The example platform shows in example-baremetal/platform_context.cpp
how a buffering could be implemented.
Printing messages from the platform adaptation
You can use Qul::PlatformInterface::log to print messages during development.
Qul::PlatformInterface::log("Qt for MCUs!\r\n");
A C API is also provided to support printing logs from C code. qul_printf and qul_vprintf uses the PlatformContext::consoleWrite as the output.
qul_printf("Ultimate performance. Tiny footprint.\r\n");
See also qul_snprintf(), qul_sprintf(), and qul_vsnprintf().
Available under certain Qt licenses.
Find out more.