1 #include "json_helper.hpp"
7 using json = nlohmann::json;
9 json_object *to_json(genivi::surface_properties const &s) {
10 auto j = json::object({
12 {"size", {{"width", s.size.w}, {"height", s.size.h}}},
14 {{"width", s.dst_rect.w},
15 {"height", s.dst_rect.h},
17 {"y", s.dst_rect.y}}},
19 {{"width", s.src_rect.w},
20 {"height", s.src_rect.h},
22 {"y", s.src_rect.y}}},
23 {"visibility", s.visibility},
24 {"opacity", s.opacity},
25 {"orientation", s.orientation},
27 return json_tokener_parse(j.dump().c_str());
30 json_object *to_json(genivi::screen const *s) {
31 auto o = json_object_new_object();
32 json_object_object_add(o, "id", json_object_new_int(s->id));
37 json_object *to_json_(T const &s) {
38 auto a = json_object_new_array();
41 for (auto const &i : s) {
42 json_object_array_add(a, to_json(i.second));
49 json_object *to_json(genivi::controller::props_map const &s) {
53 json_object *to_json(std::vector<uint32_t> const &v) {
54 auto a = json_object_new_array();
55 for (const auto i : v) {
56 json_object_array_add(a, json_object_new_int(i));