#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 3 |
◆ EVENT_SUBSCRIBE_ERROR_CODE
#define EVENT_SUBSCRIBE_ERROR_CODE 100 |
◆ init()
Definition at line 238 of file homescreen.c.
240 AFB_NOTICE(
"binding init");
static struct afb_event ev_reserved
static const char * evlist[]
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を表示する
Parameters
Request key
- display_message : 表示したい文字列
Return
Nothing
Definition at line 113 of file homescreen.c.
115 AFB_NOTICE(
"%s is called.", __FUNCTION__);
121 AFB_NOTICE(
"request params = %s.", value);
123 struct json_object* push_obj = json_object_new_object();
128 afb_req_fail_f(request,
"failed",
"called %s, Unknown palameter", __FUNCTION__);
133 struct json_object *res = json_object_new_object();
136 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,...)
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,...)
◆ onevent()
static void onevent |
( |
const char * |
event, |
|
|
struct json_object * |
object |
|
) |
| |
|
static |
◆ pingSample()
static void pingSample |
( |
struct afb_req |
request | ) |
|
|
static |
Definition at line 55 of file homescreen.c.
57 static int pingcount = 0;
58 afb_req_success_f(request, json_object_new_int(pingcount),
"Ping count = %d", pingcount);
59 AFB_NOTICE(
"Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
◆ preinit()
Definition at line 232 of file homescreen.c.
234 AFB_NOTICE(
"binding preinit (was register)");
◆ subscribe()
static void subscribe |
( |
struct afb_req |
request | ) |
|
|
static |
Subscribe event
Parameters
Return
Nothing
Note
Definition at line 151 of file homescreen.c.
153 const char *value = afb_req_value(request,
"event");
154 AFB_NOTICE(
"value is %s", value);
160 AFB_NOTICE(
"dedicated event doesn't exist");
169 AFB_NOTICE(
"Please input event name");
173 struct json_object *res = json_object_new_object();
176 afb_req_success_f(request, res,
"homescreen binder subscribe event name [%s]", value);
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 |
HomeScreenから呼ばれる ショートカットがタップされたことをアプリケーションに通知するために使用する アプリケーションからは使用されない
Parameters
Request key
- application_name : アプリケーション名
Return
Nothing
Definition at line 76 of file homescreen.c.
78 AFB_NOTICE(
"%s is called.", __FUNCTION__);
84 AFB_NOTICE(
"request params = %s.", value);
86 struct json_object* push_obj = json_object_new_object();
91 afb_req_fail_f(request,
"failed",
"called %s, Unknown palameter", __FUNCTION__);
96 struct json_object *res = json_object_new_object();
99 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,...)
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 191 of file homescreen.c.
193 const char *value = afb_req_value(request,
"event");
194 AFB_NOTICE(
"value is %s", value);
200 AFB_NOTICE(
"dedicated event doesn't exist");
209 AFB_NOTICE(
"Please input event name");
213 struct json_object *res = json_object_new_object();
216 afb_req_success_f(request, res,
"homescreen binder unsubscribe event name [%s]", value);
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 |
◆ 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 263 of file homescreen.c.
◆ ev_on_screen_message
struct afb_event ev_on_screen_message |
|
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 =
"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 unsubscribe(struct afb_req request)
static void on_screen_message(struct afb_req request)
static void subscribe(struct afb_req request)
Definition at line 222 of file homescreen.c.