-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDuplicateRoute.cpp
42 lines (33 loc) · 1.11 KB
/
DuplicateRoute.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
30
31
32
33
34
35
36
37
38
39
40
41
////////////////////////////////////////////////////////////////////////////////
// Gets a Route info by ID
////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
#include "../include/route4me.h"
#define KEY "11111111111111111111111111111111"
using namespace std;
int main()
{
// global init
CRoute4Me::init();
CRoute4Me route(KEY);
const char *route_id = "CA902292134DBC134EAF8363426BD247";
const char *route_destination_id = "174405709A";
int ret = route.get_address(route_id, route_destination_id);
if (ret == 0) {
cout << "Route address by ID:" << endl << Json::FastWriter().write(route.get_json_resp()) << endl;
if (route.duplicate_route(route_id, "none") == 0) {
cout << "Duplicated route " << endl;
}
else {
cout << "Duplicating problem for route " << route_id << endl;
}
}
else {
cout << "Error reading address: " << route.get_err_code() << ": " << route.get_err_msg() << endl;
ret = -1;
}
// global cleanup
CRoute4Me::cleanup();
return ret;
}