このページでは

C

ロギング・サポートの実装

ログの印刷

PlatformContext::consoleWrite を実装して、メッセージの印刷をサポートする。このメソッドは、Qt Quick Ultraliteコアによって呼び出され、1文字を印刷し、Qul::PlatformInterface::log の出力として動作する。

実装例

void ExamplePlatform::consoleWrite(char character) {
    // Write the charactor to your boards output device
}

注意: パフォーマンス上の理由から、各バッファを直接デバイスに書き込まず、何らかのバッファリングを行うことを推奨します。

サンプルのプラットフォームは、example-baremetal/platform_context.cpp でバッファリングの実装方法を示しています。

プラットフォーム適応からのメッセージ印刷

開発中にQul::PlatformInterface::log を使ってメッセージを印刷することができます。

Qul::PlatformInterface::log("Qt for MCUs!\r\n");

Cコードからのログ印刷をサポートするC APIも提供されています。qul_printfqul_vprintf は、PlatformContext::consoleWrite を出力として使用します。

qul_printf("Ultimate performance. Tiny footprint.\r\n");

qul_snprintf()、qul_sprintf()、qul_vsnprintf()も参照の こと。

特定の Qt ライセンスの下で利用可能です。
詳細を参照してください。