#include #include #include "jswmlib.h" int main(int argc, char *argv[]) { jswmlib_enable_log(4); { const char *show_role = "{\"CmdShowRole\":{\"role\":\"background\"}}"; JswmLibHandler handler = jswmcmd_parse(show_role); if (is_valid(handler)) { printf("handler type : %d\n", jswmcmd_type(handler)); } else { printf("Invalid handler"); } jswmcmd_free(handler); } { const char *set_role_pos = "{\"CmdSetRolePos\":{\"role\":\"background\", \"data\": {\"x\": 0, \"y\":0, \"w\": 1920, \"h\" : 1080}}}"; JswmLibHandler handler = jswmcmd_parse(set_role_pos); if (is_valid(handler)) { printf("handler type : %d\n", jswmcmd_type(handler)); } else { printf("Invalid handler"); } const char *role = jswmcmd_role(handler); struct cmdPosData *data = jswmcmd_data(handler); if (data) { printf("role: %s x: %d y: %d w: %d h: %d\n", role, data->x, data->y, data->w, data->h); } jswmcmd_free_role((char *)role); jswmcmd_free_data(handler, data); jswmcmd_free(handler); } { const char *set_role_relative_pos = "{\"CmdSetRoleRelativePos\":{\"role\":\"background\", \"data\": {\"off_x\": -34, \"off_y\":23, \"w\": 1920, \"h\" : 1080}}}"; JswmLibHandler handler = jswmcmd_parse(set_role_relative_pos); if (is_valid(handler)) { printf("handler type : %d\n", jswmcmd_type(handler)); } else { printf("Invalid handler"); } const char *role = jswmcmd_role(handler); struct cmdRelativePosData *data = jswmcmd_data(handler); if (data) { printf("role: %s x: %d y: %d w: %d h: %d\n", role, data->off_x, data->off_y, data->w, data->h); } jswmcmd_free_role((char *)role); jswmcmd_free_data(handler, data); jswmcmd_free(handler); } { const char *set_role_visible = "{\"CmdSetRoleVisibility\":{\"role\":\"background\", \"visible\": false}}"; JswmLibHandler handler = jswmcmd_parse(set_role_visible); if (is_valid(handler)) { printf("handler type : %d\n", jswmcmd_type(handler)); } else { printf("Invalid handler"); } const char *role = jswmcmd_role(handler); uint32_t *data = jswmcmd_data(handler); if (data) { printf("role: %s visible: %d\n", role, *data); } jswmcmd_free_role((char *)role); jswmcmd_free_data(handler, data); jswmcmd_free(handler); } { JswmLibHandler handler = jswmlib_init("redis://127.0.0.2"); int ivi_id = -1; if (handler) { ivi_id = app_surface_id(handler, "abc"); if (ivi_id > 0) printf("abc ivi id: %d\n", ivi_id); ivi_id = app_surface_id(handler, "app"); if (ivi_id > 0) printf("app ivi id: %d\n", ivi_id); } } }