QGC : How to get a value from C++ to QML

Before my Drone take off, in QGC, I need to check Base Station status is on or off.
I need to write a TCP checking function with a timer to trigger the TCP checking, and pass the result to QML namely MainToolBar.qml.
I try to first test to send a string from main.cc to MainToolBar.qml, like below:
QQuickView view;
QQmlContext* context = view.engine()->rootContext();
context->setContextProperty("_aStr", QString(“true”));
view.setSource(QUrl(“qrc:MainToolBar.qml”));
view.show();
Look like in my QML I can recognize _aStr, but when I want to show the value, nothing came out…
I removed the QGuiApplication bcos it carsh with QGCApplication(redefined problem)
I tried to use : QQmlApplicationEngine* pEngine = new QQmlApplicationEngine(parent) and create
my _aStr here but QML can recognize but still no data…

So my question are:
1.) If I to put a timer to do TCP function, where should I put the timer and function?
2.) once the function return the value(on or off), how to pass to MainToolBar.qml?

I have been struggle with this for months, sincerely hope someone can help or give me some hints, thanks so much.