summaryrefslogtreecommitdiff
path: root/src/pke-at-data-stub.cpp
blob: d539f11255eba6de11bb9269e06c0d554f23f27e (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

#include "pke-at-data-stub.hpp"

#include "../data/service_types_json.h"
#include "../data/upcoming_plans_json.h"
#include "../data/plan_items_json.h"

#include "pke-at-data-parser.hpp"

void pke_at_data_stub::init() const {
}

void pke_at_data_stub::teardown() const {
};

FPADIRT(pk_arr_t<di_service_type>)
pke_at_data_stub::get_service_types() const {
	static PPADIRT(pk_arr_t<di_service_type>) ret{};
	ret = {};
	std::thread([]() {
		pke_at_data_interface_response_t<pk_arr_t<di_service_type>> val{};
		val.result_code = pke_at_data_interface_result_code_success;
		val.value = pk_new<pk_arr_t<di_service_type>>();
		*val.value = pke_at_data_parser_service_types((char*)data_service_types_json);
		ret.set_value(val);
	}).detach();
	return ret.get_future();
};

FPADIRT(pk_arr_t<di_plan>)
pke_at_data_stub::get_plans_upcoming_from_service_type(di_service_type *service_type) const {
	(void)service_type;
	static PPADIRT(pk_arr_t<di_plan>) ret{};
	ret = {};
	std::thread([]() {
		pke_at_data_interface_response_t<pk_arr_t<di_plan>> val{};
		val.result_code = pke_at_data_interface_result_code_success;
		val.value = pk_new<pk_arr_t<di_plan>>();
		*val.value = pke_at_data_parser_plans((char*)data_upcoming_plans_json);
		ret.set_value(val);
	}).detach();
  return ret.get_future();
}

FPADIRT(pk_arr_t<di_plan_item>)
pke_at_data_stub::get_plan_items(di_plan *plan) const {
	(void)plan;
	static PPADIRT(pk_arr_t<di_plan_item>) ret{};
	ret = {};
	std::thread([]() {
		pke_at_data_interface_response_t<pk_arr_t<di_plan_item>> val{};
		val.result_code = pke_at_data_interface_result_code_success;
		val.value = pk_new<pk_arr_t<di_plan_item>>();
		*val.value = pke_at_data_parser_plan_items((char*)data_plan_items_json);
		ret.set_value(val);
	}).detach();
	return ret.get_future();
}

/*
PPADIRT(pk_arr_t<pke_at_plan_details>)
pke_at_data_stub::get_song_arrangements() const {
	PPADIRT(pk_arr_t<pke_at_plan_details>) ret{};
	return ret;
};
*/