Monthly update, December 2023
Projects
I spent quite some time in December planning what to do in 2024, and how.
There were many power outages in my village in December, so I set aside software and spent two days replacing the old fuze box with a new one. The new one allows me to switch the power to the house from the not so reliable electricity company (one phase) to a 3 phase power generator (6 Kw). I also added some meters to see how much power I consume for various things, and a timer that turns on my water boiler for only one hour each night when the electricity is cheaper.
I also took some days off to spend more time with my 9 dogs for christmas, and to put a panel outside my office. The building is very old, so upgrades makes a big difference.
nsblast
I added the new UI to the embedded web server and added bulding of the react UI files to CMake. I also added a new target for the REST api to facilitate permission settings from the UI.
Next-app
From mid December, I worked exclusively on next-app. The target is to have a Proof of Concept (POC) ready by the end of January. That is an ambitious goal! I have not worked with QML for years, never used QT6, and not used gRPC for anything complex. In the last 5 years, I have not used SQL - all the database work has been with mongodb, arangodb and similar "noqsl" databases. With nextapp, the initial implementation use MariaDB with a "classic" SQL database architecture. However, the database is an implementation detail in the back-end server, so I can change that at any time. All the communication between the back-end server and the users applications use gRPC and Protobuf messages.
QT gRPC support
One nice surprise for me was that QT6 has it's own gRPC support! It's much simpler to use than the standard C++ stuff generated by Googles toolkit.
This is all I needed to add in CMakeList.txt to add gRPC to the QT project:
1set (protofile "${CMAKE_CURRENT_SOURCE_DIR}/../proto/nextapp.proto")
2
3qt_add_protobuf(MyProtoMessageLib
4 QML
5 QML_URI nextapp.pb
6 PROTO_FILES ${protofile}
7)
8
9qt_add_grpc(MyGrpcClient CLIENT
10 PROTO_FILES ${protofile}
11)
Then, in the code I can call into async gRPC methods from the main thread, in a very simple manner:
1
2 client_->attachChannel(std::make_shared<QGrpcHttp2Channel>(channelOptions));
3 auto info_call = client_->GetServerInfo({});
4 info_call->subscribe(this, [info_call, this]() {
5 nextapp::pb::ServerInfo se = info_call->read<nextapp::pb::ServerInfo>();
6 LOG_INFO << "Connected to server version " << server_version_;
7 }, [this](QGrpcStatus status) {
8 LOG_ERROR_N << "Comm error: " << status.message();
9 });
10
The code for my QT gRPC stuff is here:
I'll add an article about QT gRPC to my gRPC blog series as soon as I find the time to write some demo code.
Well done QT!