#include <afb/afb-binding.h>
#include <stdint.h>
#include <glib.h>
#include <errno.h>
Go to the source code of this file.
|
REQ_ERROR | get_value_uint16 (const struct afb_req request, const char *source, uint16_t *out_id) |
|
REQ_ERROR | get_value_int16 (const struct afb_req request, const char *source, int16_t *out_id) |
|
REQ_ERROR | get_value_int32 (const struct afb_req request, const char *source, int32_t *out_id) |
|
void | hs_add_object_to_json_object (struct json_object *j_obj, int count,...) |
|
void | hs_add_object_to_json_object_str (struct json_object *j_obj, int count,...) |
|
void | hs_add_object_to_json_object_func (struct json_object *j_obj, const char *verb_name, int count,...) |
|
int | hs_search_event_name_index (const char *value) |
|
◆ AFB_BINDING_VERSION
#define AFB_BINDING_VERSION 2 |
◆ REQ_ERROR
◆ REQ_ERROR
Enumerator |
---|
REQ_FAIL | |
REQ_OK | |
NOT_NUMBER | |
OUT_RANGE | |
Definition at line 25 of file hs-helper.h.
◆ get_value_int16()
REQ_ERROR get_value_int16 |
( |
const struct afb_req |
request, |
|
|
const char * |
source, |
|
|
int16_t * |
out_id |
|
) |
| |
Definition at line 48 of file hs-helper.c.
51 const char* tmp = afb_req_value (request, source);
56 long tmp_id = strtol(tmp,&endptr,10);
59 if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
68 *out_id = (int16_t)tmp_id;
◆ get_value_int32()
REQ_ERROR get_value_int32 |
( |
const struct afb_req |
request, |
|
|
const char * |
source, |
|
|
int32_t * |
out_id |
|
) |
| |
Definition at line 72 of file hs-helper.c.
75 const char* tmp = afb_req_value (request, source);
80 long tmp_id = strtol(tmp,&endptr,10);
83 if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
92 *out_id = (int32_t)tmp_id;
◆ get_value_uint16()
REQ_ERROR get_value_uint16 |
( |
const struct afb_req |
request, |
|
|
const char * |
source, |
|
|
uint16_t * |
out_id |
|
) |
| |
Definition at line 24 of file hs-helper.c.
27 const char* tmp = afb_req_value (request, source);
32 long tmp_id = strtol(tmp,&endptr,10);
35 if( (tmp_id > UINT16_MAX) || (tmp_id < 0) )
44 *out_id = (uint16_t)tmp_id;
◆ hs_add_object_to_json_object()
void hs_add_object_to_json_object |
( |
struct json_object * |
j_obj, |
|
|
int |
count, |
|
|
|
... |
|
) |
| |
Definition at line 96 of file hs-helper.c.
99 va_start(args, count);
100 for(
int i = 0; i < count; ++i )
102 char *key = va_arg(args,
char*);
103 int value = va_arg(args,
int);
104 json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
◆ hs_add_object_to_json_object_func()
void hs_add_object_to_json_object_func |
( |
struct json_object * |
j_obj, |
|
|
const char * |
verb_name, |
|
|
int |
count, |
|
|
|
... |
|
) |
| |
Definition at line 125 of file hs-helper.c.
128 va_start(args, count);
130 json_object_object_add(j_obj,
"verb", json_object_new_string(verb_name));
132 for(
int i = 0; i < count; ++i )
134 char *key = va_arg(args,
char*);
135 int value = va_arg(args,
int);
136 json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
◆ hs_add_object_to_json_object_str()
void hs_add_object_to_json_object_str |
( |
struct json_object * |
j_obj, |
|
|
int |
count, |
|
|
|
... |
|
) |
| |
Definition at line 110 of file hs-helper.c.
113 va_start(args, count);
114 for(
int i = 0; i < count; ++i )
116 char *key = va_arg(args,
char*);
117 char *value = va_arg(args,
char*);
118 json_object_object_add(j_obj, key, json_object_new_string(value));
◆ hs_search_event_name_index()
int hs_search_event_name_index |
( |
const char * |
value | ) |
|
Definition at line 142 of file hs-helper.c.
144 size_t buf_size = 50;
147 for(
size_t i = 0 ; i < size ; ++i)
149 if(!strncmp(value,
evlist[i], buf_size))
static const char * evlist[]
◆ evlist
Initial value:= {
"tap_shortcut",
"on_screen_message",
"reserved"
}
Definition at line 33 of file hs-helper.h.