From 31ff5ce755d00cf12ea2ffc96c33ed9acd36358f Mon Sep 17 00:00:00 2001 From: wang_zhiqiang Date: Wed, 21 Nov 2018 16:32:29 +0800 Subject: update doc add new sequence and update doxygen files. Change-Id: I6737939eb2628577d58b2d1d65086e46e7cb14a4 Signed-off-by: wang_zhiqiang --- doc/api-ref/html/df/d66/hs-helper_8cpp.html | 449 +++++++++++++++++++++ doc/api-ref/html/df/d66/hs-helper_8cpp_source.html | 113 ++++++ 2 files changed, 562 insertions(+) create mode 100644 doc/api-ref/html/df/d66/hs-helper_8cpp.html create mode 100644 doc/api-ref/html/df/d66/hs-helper_8cpp_source.html (limited to 'doc/api-ref/html/df/d66') diff --git a/doc/api-ref/html/df/d66/hs-helper_8cpp.html b/doc/api-ref/html/df/d66/hs-helper_8cpp.html new file mode 100644 index 0000000..303434a --- /dev/null +++ b/doc/api-ref/html/df/d66/hs-helper_8cpp.html @@ -0,0 +1,449 @@ + + + + + + +HomeScreenBinding: src/hs-helper.cpp File Reference + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
hs-helper.cpp File Reference
+
+
+
#include <string.h>
+#include <cstdarg>
+#include "hs-helper.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + +

+Functions

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,...)
 
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)
 
+ + + +

+Variables

const char * evlist []
 
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
REQ_ERROR get_value_int16 (const afb_req_t request,
const char * source,
int16_t * out_id 
)
+
+

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 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 }
+ + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
REQ_ERROR get_value_int32 (const afb_req_t request,
const char * source,
int32_t * out_id 
)
+
+

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

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 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 }
+ + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void hs_add_object_to_json_object (struct json_object * j_obj,
int count,
 ... 
)
+
+

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 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 }
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void hs_add_object_to_json_object_func (struct json_object * j_obj,
const char * verb_name,
int count,
 ... 
)
+
+

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 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 }
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void hs_add_object_to_json_object_str (struct json_object * j_obj,
int count,
 ... 
)
+
+

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 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 }
+
+
+ +
+
+ + + + + + + + +
int hs_search_event_name_index (const char * value)
+
+

search event position in event list

+

Parameters

+
    +
  • value : searched event name
  • +
+

Return

+

event's index in event list

+ +

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

+ +
+
+ + + + +
const char* evlist[]
+
+Initial value:
= {
"tap_shortcut",
"on_screen_message",
"on_screen_reply",
"showWindow",
"hideWindow",
"replyShowWindow",
"showNotification",
"showInformation",
"reserved"
}
+

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

+ +
+
+
+ + + + diff --git a/doc/api-ref/html/df/d66/hs-helper_8cpp_source.html b/doc/api-ref/html/df/d66/hs-helper_8cpp_source.html new file mode 100644 index 0000000..d0f5e2a --- /dev/null +++ b/doc/api-ref/html/df/d66/hs-helper_8cpp_source.html @@ -0,0 +1,113 @@ + + + + + + +HomeScreenBinding: src/hs-helper.cpp Source File + + + + + + + + + + +
+
+ + + + + + +
+
HomeScreenBinding +
+
+
+ + + + + + +
+
+ + +
+ +
+ + +
+
+
+
hs-helper.cpp
+
+
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <string.h>
18 #include <cstdarg>
19 #include "hs-helper.h"
20 
21 
22 const char* evlist[] = {
23  "tap_shortcut",
24  "on_screen_message",
25  "on_screen_reply",
26  "showWindow",
27  "hideWindow",
28  "replyShowWindow",
29  "showNotification",
30  "showInformation",
31  "reserved"
32  };
33 
46 REQ_ERROR get_value_uint16(const afb_req_t request, const char *source, uint16_t *out_id)
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 }
69 
82 REQ_ERROR get_value_int16(const afb_req_t request, const char *source, int16_t *out_id)
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 }
105 
118 REQ_ERROR get_value_int32(const afb_req_t request, const char *source, int32_t *out_id)
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 }
141 
154 void hs_add_object_to_json_object(struct json_object* j_obj, int count,...)
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 }
167 
180 void hs_add_object_to_json_object_str(struct json_object* j_obj, int count,...)
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 }
193 
207 void hs_add_object_to_json_object_func(struct json_object* j_obj, const char* verb_name, int count, ...)
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 }
223 
234 int hs_search_event_name_index(const char* value)
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 }
REQ_ERROR get_value_uint16(const afb_req_t request, const char *source, uint16_t *out_id)
Definition: hs-helper.cpp:46
+ +
REQ_ERROR get_value_int16(const afb_req_t request, const char *source, int16_t *out_id)
Definition: hs-helper.cpp:82
+ + + + +
void hs_add_object_to_json_object_str(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:180
+
void hs_add_object_to_json_object(struct json_object *j_obj, int count,...)
Definition: hs-helper.cpp:154
+
REQ_ERROR
Definition: hs-helper.h:29
+
const char * evlist[]
Definition: hs-helper.cpp:22
+
void hs_add_object_to_json_object_func(struct json_object *j_obj, const char *verb_name, int count,...)
Definition: hs-helper.cpp:207
+
REQ_ERROR get_value_int32(const afb_req_t request, const char *source, int32_t *out_id)
Definition: hs-helper.cpp:118
+
int hs_search_event_name_index(const char *value)
Definition: hs-helper.cpp:234
+
+ + + + -- cgit 1.2.3-korg