-
Notifications
You must be signed in to change notification settings - Fork 1
/
esptouchtask.mm
41 lines (31 loc) · 1.35 KB
/
esptouchtask.mm
1
2
3
4
5
6
7
8
9
10
11
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
40
41
#include "esptouchtask.h"
#ifdef Q_OS_DARWIN
void EspTouchTask::run()
{
emit finished(response);
}
void EspTouchTask::interrupt()
{
}
#else
#include <QtAndroidExtras/QAndroidJniObject>
#include <QtAndroid>
void EspTouchTask::run()
{
QAndroidJniObject java_apSsid = QAndroidJniObject::fromString(apSsid);
QAndroidJniObject java_apBssid = QAndroidJniObject::fromString(apBssid);
QAndroidJniObject java_apPass = QAndroidJniObject::fromString(apPassword);
QAndroidJniObject java_resp = QtAndroid::androidActivity().callObjectMethod("runEsptouch",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;",
java_apSsid.object<jstring>(),
java_apBssid.object<jstring>(),
java_apPass.object<jstring>()
);
response = java_resp.toString();
emit finished(response);
}
void EspTouchTask::interrupt()
{
QtAndroid::androidActivity().callMethod<void>("interruptEsptouch");
}
#endif // Q_OS_DARWIN