1 #include "testProtocolCommon.h"
4 #include <jsonprotocol.h>
6 #include <QLocalSocket>
7 #include <QLocalServer>
8 #include <QCoreApplication>
13 void runTest(amb::AmbRemoteClient *c)
15 DebugOut(0) << "calling client->list()" << endl;
16 c->list([](std::vector<amb::Object::ObjectPtr> supported)
18 DebugOut(0) << "list call reply" << endl;
19 g_assert(supported.size() == 2);
22 DebugOut(0) << "calling client->get()" << endl;
23 c->get("interface1", [&c](amb::Object::ObjectPtr obj)
25 DebugOut(0) << "get call reply" << endl;
26 g_assert(obj->size() == 2);
28 obj->emplace("vehicleSpeed", amb::make_shared(new VehicleProperty::VehicleSpeedType(69)));
30 c->set("interface1", obj, [](bool s)
32 DebugOut(0) << "set call reply status: " << (s ? "success!" : "fail") << endl;
38 int main(int argc, char** argv)
40 DebugOut::setDebugThreshhold(7);
41 DebugOut::setThrowErr(true);
42 DebugOut::setThrowWarn(false);
44 DebugOut(0) << "Testing AMB json server/client" << endl;
46 QCoreApplication app(argc, argv);
52 socket.getSocket()->waitForConnected();
54 DebugOut(0) << "We are connected!" << endl;
56 amb::AmbRemoteClient client(&socket);