summaryrefslogtreecommitdiffstats
path: root/libnavi/src/navicore.cpp
blob: 5402aa898c0ea072d3bbb7d2ab2fb95f1e0f4a7a (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2017 AISIN AW CO.,LTD

#include "libnavicore.hpp"
#include "BinderClient.h"

static BinderClient mBinderClient;

naviapi::Navicore::Navicore()
{
}

naviapi::Navicore::~Navicore()
{
}

bool naviapi::Navicore::connect(int argc, char *argv[], NavicoreListener* listener)
{
	this->mListener = listener;

	if (argc != 3)
	{
		printf("Error: argc != 3 : argc = %d\n", argc);
		return false;
	}

	char url[1024];
	sprintf(url, "ws://localhost:%d/api?token=%s", atoi(argv[1]), argv[2]);

	return mBinderClient.ConnectServer(url, this->mListener);
}

void naviapi::Navicore::disconnect()
{
	// TODO
}

void naviapi::Navicore::getAllSessions()
{
	mBinderClient.NavicoreGetAllSessions();
}

void naviapi::Navicore::getPosition(std::vector<int32_t> params)
{
	mBinderClient.NavicoreGetPosition(params);
}

void naviapi::Navicore::getAllRoutes()
{
	mBinderClient.NavicoreGetAllRoutes();
}

void naviapi::Navicore::createRoute(uint32_t session)
{
	mBinderClient.NavicoreCreateRoute(session);
}

void naviapi::Navicore::pauseSimulation(uint32_t session)
{
	mBinderClient.NavicorePauseSimulation(session);
}

void naviapi::Navicore::setSimulationMode(uint32_t session, bool activate)
{
	mBinderClient.NavicoreSetSimulationMode(session, activate);
}

void naviapi::Navicore::cancelRouteCalculation(uint32_t session, uint32_t routeHandle)
{
	mBinderClient.NavicoreCancelRouteCalculation(session, routeHandle);
}

void naviapi::Navicore::setWaypoints(uint32_t session, uint32_t routeHandle, bool flag, std::vector<Waypoint> waypoints)
{
	mBinderClient.NavicoreSetWaypoints(session, routeHandle, flag, waypoints);
}

void naviapi::Navicore::calculateRoute(uint32_t session, uint32_t routeHandle)
{
	mBinderClient.NavicoreCalculateRoute(session, routeHandle);
}