#include <afb/afb-binding.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <json-c/json.h>
#include <glib.h>
#include <pthread.h>
#include "hs-helper.h"
Go to the source code of this file.
◆ _GNU_SOURCE
◆ AFB_BINDING_VERSION
#define AFB_BINDING_VERSION 2 |
◆ COMMAND_EVENT_NUM
#define COMMAND_EVENT_NUM 4 |
◆ EVENT_SUBSCRIBE_ERROR_CODE
#define EVENT_SUBSCRIBE_ERROR_CODE 100 |
◆ init()
Definition at line 277 of file homescreen.c.
279 HMI_NOTICE(
"homescreen-service",
"binding init");
#define HMI_NOTICE(prefix, args,...)
static struct afb_event ev_reserved
static const char * evlist[]
static struct afb_event ev_on_screen_reply
static struct afb_event ev_on_screen_message
static struct event event_list[COMMAND_EVENT_NUM]
static struct afb_event ev_tap_shortcut
◆ on_screen_message()
static void on_screen_message |
( |
struct afb_req |
request | ) |
|
|
static |
HomeScreen OnScreen message
Parameters
Request key
- display_message : message for display
Return
Nothing
Definition at line 114 of file homescreen.c.
116 HMI_NOTICE(
"homescreen-service",
"is called.");
122 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
124 struct json_object* push_obj = json_object_new_object();
129 afb_req_fail_f(request,
"failed",
"called %s, Unknown palameter", __FUNCTION__);
134 struct json_object *res = json_object_new_object();
137 afb_req_success(request, res,
"afb_event_push event [on_screen_message]");
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
#define HMI_NOTICE(prefix, args,...)
static const char _error[]
static struct afb_event ev_on_screen_message
static const char _display_message[]
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
◆ on_screen_reply()
static void on_screen_reply |
( |
struct afb_req |
request | ) |
|
|
static |
HomeScreen OnScreen Reply
Parameters
Request key
- reply_message : message for reply
Return
Nothing
Definition at line 151 of file homescreen.c.
153 HMI_NOTICE(
"homescreen-service",
"is called.");
159 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
161 struct json_object* push_obj = json_object_new_object();
166 afb_req_fail_f(request,
"failed",
"called %s, Unknown palameter", __FUNCTION__);
171 struct json_object *res = json_object_new_object();
174 afb_req_success(request, res,
"afb_event_push event [on_screen_reply]");
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
#define HMI_NOTICE(prefix, args,...)
static const char _error[]
static struct afb_event ev_on_screen_reply
static const char _reply_message[]
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
◆ onevent()
static void onevent |
( |
const char * |
event, |
|
|
struct json_object * |
object |
|
) |
| |
|
static |
Definition at line 301 of file homescreen.c.
#define HMI_NOTICE(prefix, args,...)
◆ pingSample()
static void pingSample |
( |
struct afb_req |
request | ) |
|
|
static |
Definition at line 57 of file homescreen.c.
59 static int pingcount = 0;
60 afb_req_success_f(request, json_object_new_int(pingcount),
"Ping count = %d", pingcount);
61 HMI_NOTICE(
"homescreen-service",
"Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
#define HMI_NOTICE(prefix, args,...)
◆ preinit()
Definition at line 271 of file homescreen.c.
273 HMI_NOTICE(
"homescreen-service",
"binding preinit (was register)");
#define HMI_NOTICE(prefix, args,...)
◆ subscribe()
static void subscribe |
( |
struct afb_req |
request | ) |
|
|
static |
Subscribe event
Parameters
Return
Nothing
Note
Definition at line 189 of file homescreen.c.
191 const char *value = afb_req_value(request,
"event");
192 HMI_NOTICE(
"homescreen-service",
"value is %s", value);
198 HMI_NOTICE(
"homescreen-service",
"dedicated event doesn't exist");
207 HMI_NOTICE(
"homescreen-service",
"Please input event name");
211 struct json_object *res = json_object_new_object();
214 afb_req_success_f(request, res,
"homescreen binder subscribe event name [%s]", value);
#define HMI_NOTICE(prefix, args,...)
static const char _error[]
int hs_search_event_name_index(const char *value)
static struct event event_list[COMMAND_EVENT_NUM]
#define EVENT_SUBSCRIBE_ERROR_CODE
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
◆ tap_shortcut()
static void tap_shortcut |
( |
struct afb_req |
request | ) |
|
|
static |
tap_shortcut notify for homescreen When Shortcut area is tapped, notify these applciations
Parameters
Request key
- application_name : application name
Return
Nothing
Definition at line 77 of file homescreen.c.
85 HMI_NOTICE(
"homescreen-service",
"request params = %s.", value);
87 struct json_object* push_obj = json_object_new_object();
92 afb_req_fail_f(request,
"failed",
"called %s, Unknown palameter", __FUNCTION__);
97 struct json_object *res = json_object_new_object();
100 afb_req_success(request, res,
"afb_event_push event [tap_shortcut]");
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
#define HMI_NOTICE(prefix, args,...)
static const char _application_name[]
static const char _error[]
static struct afb_event ev_tap_shortcut
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
◆ unsubscribe()
static void unsubscribe |
( |
struct afb_req |
request | ) |
|
|
static |
Unsubscribe event
Parameters
Return
Nothing
Note
Definition at line 229 of file homescreen.c.
231 const char *value = afb_req_value(request,
"event");
232 HMI_NOTICE(
"homescreen-service",
"value is %s", value);
238 HMI_NOTICE(
"homescreen-service",
"dedicated event doesn't exist");
247 HMI_NOTICE(
"homescreen-service",
"Please input event name");
251 struct json_object *res = json_object_new_object();
254 afb_req_success_f(request, res,
"homescreen binder unsubscribe event name [%s]", value);
#define HMI_NOTICE(prefix, args,...)
static const char _error[]
int hs_search_event_name_index(const char *value)
static struct event event_list[COMMAND_EVENT_NUM]
#define EVENT_SUBSCRIBE_ERROR_CODE
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
◆ _application_name
const char _application_name[] = "application_name" |
|
static |
◆ _display_message
const char _display_message[] = "display_message" |
|
static |
◆ _error
const char _error[] = "error" |
|
static |
◆ _reply_message
const char _reply_message[] = "reply_message" |
|
static |
◆ afbBindingV2
const struct afb_binding_v2 afbBindingV2 |
Initial value:= {
.api = "homescreen",
.specification = NULL,
}
static void onevent(const char *event, struct json_object *object)
static const struct afb_verb_v2 verbs[]
Definition at line 306 of file homescreen.c.
◆ ev_on_screen_message
struct afb_event ev_on_screen_message |
|
static |
◆ ev_on_screen_reply
struct afb_event ev_on_screen_reply |
|
static |
◆ ev_reserved
struct afb_event ev_reserved |
|
static |
◆ ev_tap_shortcut
struct afb_event ev_tap_shortcut |
|
static |
◆ event_list
◆ verbs
const struct afb_verb_v2 verbs[] |
|
static |
Initial value:= {
{ .verb =
"ping", .session = AFB_SESSION_NONE, .callback =
pingSample, .auth = NULL },
{ .verb =
"tap_shortcut", .session = AFB_SESSION_NONE, .callback =
tap_shortcut, .auth = NULL },
{ .verb =
"on_screen_message", .session = AFB_SESSION_NONE, .callback =
on_screen_message, .auth = NULL },
{ .verb =
"on_screen_reply", .session = AFB_SESSION_NONE, .callback =
on_screen_reply, .auth = NULL },
{ .verb =
"subscribe", .session = AFB_SESSION_NONE, .callback =
subscribe, .auth = NULL },
{ .verb =
"unsubscribe", .session = AFB_SESSION_NONE, .callback =
unsubscribe, .auth = NULL },
{NULL }
}
static void tap_shortcut(struct afb_req request)
static void pingSample(struct afb_req request)
static void on_screen_reply(struct afb_req request)
static void unsubscribe(struct afb_req request)
static void on_screen_message(struct afb_req request)
static void subscribe(struct afb_req request)
Definition at line 260 of file homescreen.c.