X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=doc%2Fapi-ref%2Fhtml%2Fd3%2Fd3d%2Fhs-helper_8h.html;fp=doc%2Fapi-ref%2Fhtml%2Fd3%2Fd3d%2Fhs-helper_8h.html;h=edf1de4eead7e00f54eeeb8308c3d720fc95f2ab;hb=31ff5ce755d00cf12ea2ffc96c33ed9acd36358f;hp=5ee78fe1e9829c821103932d74cb87180e489c05;hpb=bbb4ee8e9974c4b008da84a1e504120f70606c92;p=apps%2Fagl-service-homescreen.git diff --git a/doc/api-ref/html/d3/d3d/hs-helper_8h.html b/doc/api-ref/html/d3/d3d/hs-helper_8h.html index 5ee78fe..edf1de4 100644 --- a/doc/api-ref/html/d3/d3d/hs-helper_8h.html +++ b/doc/api-ref/html/d3/d3d/hs-helper_8h.html @@ -3,8 +3,7 @@ - - + HomeScreenBinding: src/hs-helper.h File Reference @@ -12,6 +11,9 @@ + @@ -29,19 +31,39 @@ - + - - - - + +
#include <afb/afb-binding.h>
-#include <stdint.h>
-#include <glib.h>
-#include <errno.h>
-#include "hmi-debug.h"
+#include <json-c/json.h>

Go to the source code of this file.

- + + + + + + + + + + +

Macros

#define AFB_BINDING_VERSION   2
#define AFB_BINDING_VERSION   3
 
#define AFB_EVENT_BAD_REQUEST   100
 
#define AFB_REQ_SUBSCRIBE_ERROR   101
 
#define AFB_REQ_UNSUBSCRIBE_ERROR   102
 
#define AFB_REQ_SHOWNOTIFICATION_ERROR   103
 
#define AFB_REQ_SHOWINFORMATION_ERROR   104
 
@@ -101,12 +130,12 @@ Enumerations

Typedefs

- - - - - - + + + + + + @@ -118,30 +147,104 @@ Functions

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)
 
REQ_ERROR get_value_uint16 (const afb_req_t request, const char *source, uint16_t *out_id)
 
REQ_ERROR get_value_int16 (const afb_req_t request, const char *source, int16_t *out_id)
 
REQ_ERROR get_value_int32 (const afb_req_t 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,...)
- + + + + + + + + +

Variables

static const char * evlist []
const char * evlist []
 
const char _error []
 
const char _application_id []
 
const char _display_message []
 
const char _reply_message []
 

Macro Definition Documentation

- -

◆ AFB_BINDING_VERSION

+ +
+
+ + + + +
#define AFB_BINDING_VERSION   3
+
+ +

Definition at line 19 of file hs-helper.h.

+
+
+
- +
#define AFB_BINDING_VERSION   2#define AFB_EVENT_BAD_REQUEST   100
-

Definition at line 19 of file hs-helper.h.

+

Definition at line 23 of file hs-helper.h.

-

Typedef Documentation

- -

◆ REQ_ERROR

+ +
+
+ + + + +
#define AFB_REQ_SHOWINFORMATION_ERROR   104
+
+ +

Definition at line 27 of file hs-helper.h.

+ +
+
+ +
+
+ + + + +
#define AFB_REQ_SHOWNOTIFICATION_ERROR   103
+
+

Definition at line 26 of file hs-helper.h.

+ +
+
+ +
+
+ + + + +
#define AFB_REQ_SUBSCRIBE_ERROR   101
+
+ +

Definition at line 24 of file hs-helper.h.

+ +
+
+ +
+
+ + + + +
#define AFB_REQ_UNSUBSCRIBE_ERROR   102
+
+ +

Definition at line 25 of file hs-helper.h.

+ +
+
+

Typedef Documentation

+
@@ -154,9 +257,7 @@ Variables

Enumeration Type Documentation

- -

◆ REQ_ERROR

- +
@@ -166,32 +267,34 @@ Variables
- - - - + + + +
Enumerator
REQ_FAIL 
REQ_OK 
NOT_NUMBER 
OUT_RANGE 
Enumerator
REQ_FAIL  +
REQ_OK  +
NOT_NUMBER  +
OUT_RANGE  +
-

Definition at line 26 of file hs-helper.h.

-
27 {
28  REQ_FAIL = -1,
29  REQ_OK=0,
30  NOT_NUMBER,
31  OUT_RANGE
32 }REQ_ERROR;
- - - -
REQ_ERROR
Definition: hs-helper.h:26
+

Definition at line 29 of file hs-helper.h.

+
30 {
31  REQ_FAIL = -1,
32  REQ_OK=0,
33  NOT_NUMBER,
34  OUT_RANGE
35 }REQ_ERROR;
+ + + +
REQ_ERROR
Definition: hs-helper.h:29

Function Documentation

- -

◆ get_value_int16()

- +
- + @@ -213,25 +316,32 @@ Variables
REQ_ERROR get_value_int16 (const struct afb_req const afb_req_t  request,
+

get int16 value from source

+

Parameters

+
    +
  • request : Describes the request by bindings from afb-daemon
  • +
  • source : input source
  • +
  • out_id : output int16 value
  • +
+

Return

+

error code

-

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 }
- - - +

Definition at line 82 of file hs-helper.cpp.

+
83 {
84  char* endptr;
85  const char* tmp = afb_req_value (request, source);
86  if(!tmp)
87  {
88  return REQ_FAIL;
89  }
90  long tmp_id = strtol(tmp,&endptr,10);
91 
92  /* error check of range */
93  if( (tmp_id > INT16_MAX) || (tmp_id < INT16_MIN) )
94  {
95  return OUT_RANGE;
96  }
97  if(*endptr != '\0')
98  {
99  return NOT_NUMBER;
100  }
101 
102  *out_id = (int16_t)tmp_id;
103  return REQ_OK;
104 }
+ + +
- -

◆ get_value_int32()

- +
- + @@ -253,25 +363,32 @@ Variables
REQ_ERROR get_value_int32 (const struct afb_req const afb_req_t  request,
+

get int32 value from source

+

Parameters

+
    +
  • request : Describes the request by bindings from afb-daemon
  • +
  • source : input source
  • +
  • out_id : output int32 value
  • +
+

Return

+

error code

-

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 }
- - - +

Definition at line 118 of file hs-helper.cpp.

+
119 {
120  char* endptr;
121  const char* tmp = afb_req_value (request, source);
122  if(!tmp)
123  {
124  return REQ_FAIL;
125  }
126  long tmp_id = strtol(tmp,&endptr,10);
127 
128  /* error check of range */
129  if( (tmp_id > INT32_MAX) || (tmp_id < INT32_MIN) )
130  {
131  return OUT_RANGE;
132  }
133  if(*endptr != '\0')
134  {
135  return NOT_NUMBER;
136  }
137 
138  *out_id = (int32_t)tmp_id;
139  return REQ_OK;
140 }
+ + +
- -

◆ get_value_uint16()

- +
- + @@ -293,18 +410,25 @@ Variables
REQ_ERROR get_value_uint16 (const struct afb_req const afb_req_t  request,
+

get uint16 value from source

+

Parameters

+
    +
  • request : Describes the request by bindings from afb-daemon
  • +
  • source : input source
  • +
  • out_id : output uint16 value
  • +
+

Return

+

error code

-

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 }
- - - +

Definition at line 46 of file hs-helper.cpp.

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

◆ hs_add_object_to_json_object()

- +
@@ -333,14 +457,21 @@ Variables
+

add int object to json object

+

Parameters

+
    +
  • j_obj : the json object will join in int json object
  • +
  • count : input parameter number
  • +
  • ... : parameter list
  • +
+

Return

+

None

-

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 }
+

Definition at line 154 of file hs-helper.cpp.

+
155 {
156  va_list args;
157  va_start(args, count);
158  for(int i = 0; i < count; ++i )
159  {
160  char *key = va_arg(args, char*);
161  int value = va_arg(args, int);
162  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
163  ++i;
164  }
165  va_end(args);
166 }
- -

◆ hs_add_object_to_json_object_func()

- +
@@ -375,14 +506,22 @@ Variables
+

add new json object to json object

+

Parameters

+
    +
  • j_obj : the json object will join in new json object
  • +
  • verb_name : new json object's verb value
  • +
  • count : input parameter number
  • +
  • ... : parameter list
  • +
+

Return

+

None

-

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 }
+

Definition at line 207 of file hs-helper.cpp.

+
208 {
209  va_list args;
210  va_start(args, count);
211 
212  json_object_object_add(j_obj,"verb", json_object_new_string(verb_name));
213 
214  for(int i = 0; i < count; ++i )
215  {
216  char *key = va_arg(args, char*);
217  int value = va_arg(args, int);
218  json_object_object_add(j_obj, key, json_object_new_int((int32_t)value));
219  ++i;
220  }
221  va_end(args);
222 }
- -

◆ hs_add_object_to_json_object_str()

- +
@@ -411,14 +550,21 @@ Variables
+

add string object to json object

+

Parameters

+
    +
  • j_obj : the json object will join in string json object
  • +
  • count : input parameter number
  • +
  • ... : parameter list
  • +
+

Return

+

None

-

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 }
+

Definition at line 180 of file hs-helper.cpp.

+
181 {
182  va_list args;
183  va_start(args, count);
184  for(int i = 0; i < count; ++i )
185  {
186  char *key = va_arg(args, char*);
187  char *value = va_arg(args, char*);
188  json_object_object_add(j_obj, key, json_object_new_string(value));
189  ++i;
190  }
191  va_end(args);
192 }
- -

◆ hs_search_event_name_index()

- +
@@ -431,34 +577,87 @@ Variables
+

search event position in event list

+

Parameters

+
    +
  • value : searched event name
  • +
+

Return

+

event's index in event list

-

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
+

Definition at line 234 of file hs-helper.cpp.

+
235 {
236  size_t buf_size = 50;
237  size_t size = sizeof evlist / sizeof *evlist;
238  int ret = -1;
239  for(size_t i = 0 ; i < size ; ++i)
240  {
241  if(!strncmp(value, evlist[i], buf_size))
242  {
243  ret = i;
244  break;
245  }
246  }
247  return ret;
248 }
const char * evlist[]
Definition: hs-helper.cpp:22

Variable Documentation

- -

◆ evlist

+ +
+
+ + + + +
const char _application_id[]
+
+ +

Definition at line 28 of file homescreen.cpp.

+
+
+ +
+
+ + + + +
const char _display_message[]
+
+ +

Definition at line 29 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + +
const char _error[]
+
+ +

Definition at line 27 of file homescreen.cpp.

+ +
+
+ +
+
+ + + + +
const char _reply_message[]
+
+ +

Definition at line 30 of file homescreen.cpp.

+ +
+
+
- - - - - -
const char* evlist[]
-
-static
-Initial value:
= {
"tap_shortcut",
"on_screen_message",
"on_screen_reply",
"reserved"
}
-

Definition at line 34 of file hs-helper.h.

+ +

Definition at line 22 of file hs-helper.cpp.

@@ -467,7 +666,7 @@ Variables