-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
29 lines (26 loc) · 818 Bytes
/
main.cpp
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
#include "myphoneapi.h"
#include "lib/nokia_commands.h"
#include <QApplication>
#include <QLibrary>
int main(int argc, char** argv) {
QApplication app(argc, argv);
typedef MyPhoneAPI* (*pf)();
//TODO: Fix path for library
pf function=(pf)QLibrary::resolve(("./lib/libmyphoneapi.so"),"GetClass");
MyPhoneAPI* mp=function();
//qDebug() << mp->getMe();
mp->openConnection();
// Testing the talkToPhone method
QString man = mp->talkToPhone(NOKIA_BRAND);
// Ugly hack to remove the "-char from return
man.remove(0,1);
qDebug() << "Manufacturer: " << man;
QString ser = mp->talkToPhone(NOKIA_SERIAL);
ser.remove(0,1);
qDebug() << "Serial no: " << ser;
QString mod = mp->talkToPhone(NOKIA_MODEL);
mod.remove(0,1);
qDebug() << "Model: " << mod;
mp->closeConnection();
return 0;
}