X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=doc%2Fapi-ref%2Fhtml%2Fdd%2Fd1d%2Fhs-helper_8c.html;fp=doc%2Fapi-ref%2Fhtml%2Fdd%2Fd1d%2Fhs-helper_8c.html;h=0000000000000000000000000000000000000000;hb=31ff5ce755d00cf12ea2ffc96c33ed9acd36358f;hp=ce8d1bd94b42baecedda23b2913cbc62c97c5826;hpb=bbb4ee8e9974c4b008da84a1e504120f70606c92;p=apps%2Fagl-service-homescreen.git diff --git a/doc/api-ref/html/dd/d1d/hs-helper_8c.html b/doc/api-ref/html/dd/d1d/hs-helper_8c.html deleted file mode 100644 index ce8d1bd..0000000 --- a/doc/api-ref/html/dd/d1d/hs-helper_8c.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - -HomeScreenBinding: src/hs-helper.c File Reference - - - - - - - - - -
-
- - - - - - -
-
HomeScreenBinding -
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
-
-Functions
-
-
hs-helper.c File Reference
-
-
-
#include "hs-helper.h"
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <json-c/json.h>
-#include <stdarg.h>
-
-

Go to the source code of this file.

- - - - - - - - - - - - - - - - -

-Functions

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)
 
-

Function Documentation

- -

◆ 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.

-
49 {
50  char* endptr;
51  const char* tmp = afb_req_value (request, source);
52  if(!tmp)
53  {
54  return REQ_FAIL;
55  }
56  long tmp_id = strtol(tmp,&endptr,10);
57 
58  /* error check of range */
59  if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
60  {
61  return OUT_RANGE;
62  }
63  if(*endptr != '\0')
64  {
65  return NOT_NUMBER;
66  }
67 
68  *out_id = (int16_t)tmp_id;
69  return REQ_OK;
70 }
- - - -
-
-
- -

◆ 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.

-
73 {
74  char* endptr;
75  const char* tmp = afb_req_value (request, source);
76  if(!tmp)
77  {
78  return REQ_FAIL;
79  }
80  long tmp_id = strtol(tmp,&endptr,10);
81 
82  /* error check of range */
83  if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
84  {
85  return OUT_RANGE;
86  }
87  if(*endptr != '\0')
88  {
89  return NOT_NUMBER;
90  }
91 
92  *out_id = (int32_t)tmp_id;
93  return REQ_OK;
94 }
- - - -
-
-
- -

◆ 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.

-
25 {
26  char* endptr;
27  const char* tmp = afb_req_value (request, source);
28  if(!tmp)
29  {
30  return REQ_FAIL;
31  }
32  long tmp_id = strtol(tmp,&endptr,10);
33 
34  /* error check of range */
35  if( (tmp_id > UINT16_MAX) || (tmp_id < 0) )
36  {
37  return OUT_RANGE;
38  }
39  if(*endptr != '\0')
40  {
41  return NOT_NUMBER;
42  }
43 
44  *out_id = (uint16_t)tmp_id;
45  return REQ_OK;
46 }
- - - -
-
-
- -

◆ 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.

-
97 {
98  va_list args;
99  va_start(args, count);
100  for(int i = 0; i < count; ++i )
101  {
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));
105  ++i;
106  }
107  va_end(args);
108 }
-
-
- -

◆ 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.

-
126 {
127  va_list args;
128  va_start(args, count);
129 
130  json_object_object_add(j_obj,"verb", json_object_new_string(verb_name));
131 
132  for(int i = 0; i < count; ++i )
133  {
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));
137  ++i;
138  }
139  va_end(args);
140 }
-
-
- -

◆ 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.

-
111 {
112  va_list args;
113  va_start(args, count);
114  for(int i = 0; i < count; ++i )
115  {
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));
119  ++i;
120  }
121  va_end(args);
122 }
-
-
- -

◆ hs_search_event_name_index()

- -
-
- - - - - - - - -
int hs_search_event_name_index (const char * value)
-
- -

Definition at line 142 of file hs-helper.c.

-
143 {
144  size_t buf_size = 50;
145  size_t size = sizeof evlist / sizeof *evlist;
146  int ret = -1;
147  for(size_t i = 0 ; i < size ; ++i)
148  {
149  if(!strncmp(value, evlist[i], buf_size))
150  {
151  ret = i;
152  break;
153  }
154  }
155  return ret;
156 }
static const char * evlist[]
Definition: hs-helper.h:34
-
-
-
-
- - - -