X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=doc%2Fapi-ref%2Fhtml%2Fdf%2Fdac%2Ftest_8cpp.html;h=00f95150e9176c735216b46942eaf82bcd12ac2b;hb=599de8d3f35cb0fe56c7e27591862d61944b456b;hp=7995dcb6bb640e1ff22ddf160a9159e056b7dcc2;hpb=26ec25e2f9271396328c208ae1a256fdf1a92c91;p=apps%2Fagl-service-homescreen.git diff --git a/doc/api-ref/html/df/dac/test_8cpp.html b/doc/api-ref/html/df/dac/test_8cpp.html index 7995dcb..00f9515 100644 --- a/doc/api-ref/html/df/dac/test_8cpp.html +++ b/doc/api-ref/html/df/dac/test_8cpp.html @@ -162,15 +162,15 @@ Variables

Definition at line 117 of file test.cpp.

-
118 {
119  int ret;
120  if(argc == 1)
121  {
122  printf("Please input port num in first argument, and token in second argument");
123  usage();
124  return 0;
125  }
126  if(argc == 2)
127  {
128  string av(argv[1]);
129  if( (av == "-h") || (av == "--help"))
130  {
131  usage();
132  return 0;
133  }
134  }
135 
136  string port_string(argv[1]);
137  string token(argv[2]);
138  char* endptr;
139  long port = strtol(port_string.c_str(),&endptr,10);
140 
141  /* error check of range */
142  if( (port > 20000) || (port < 0) )
143  {
144  printf("input under 20000(temporary number)");
145  return 0;
146  }
147  if(*endptr != '\0')
148  {
149  printf("not number");
150  return 0;
151  }
152 
153  cout << "Call test for LibHomeScreen" << endl;
154  hs = new LibHomeScreen();
155  hs->init(port, token);
156 
157  // hs->registerCallback(&onEv, &onRep);
158  //
159  // hs->subscribe(event_list[0]); // tap_shortcut event subscribe
160  // hs->subscribe(event_list[1]);
161 
162  hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [](const char* application_name){
163  cout << "set_event_handler Event_TapShortcut application_name = " << application_name << endl;
164  });
165 
166  hs->set_event_handler(LibHomeScreen::Event_OnScreenMessage, [](const char* display_message){
167  cout << "set_event_handler Event_OnScreenMessage display_message = " << display_message << endl;
168  });
169 
170 
171  if (ret < 0) {
172  printf("failed to create event loop");
173  return -1;
174  }
175  hs->runEventloop();
176 
177  call_test();
178 
179  return 0;
180 }
static void usage()
Definition: test.cpp:35
+
118 {
119  int ret;
120  if(argc == 1)
121  {
122  printf("Please input port num in first argument, and token in second argument");
123  usage();
124  return 0;
125  }
126  if(argc == 2)
127  {
128  string av(argv[1]);
129  if( (av == "-h") || (av == "--help"))
130  {
131  usage();
132  return 0;
133  }
134  }
135 
136  string port_string(argv[1]);
137  string token(argv[2]);
138  char* endptr;
139  long port = strtol(port_string.c_str(),&endptr,10);
140 
141  /* error check of range */
142  if( (port > 20000) || (port < 0) )
143  {
144  printf("input under 20000(temporary number)");
145  return 0;
146  }
147  if(*endptr != '\0')
148  {
149  printf("not number");
150  return 0;
151  }
152 
153  cout << "Call test for LibHomeScreen" << endl;
154  hs = new LibHomeScreen();
155  hs->init(port, token);
156 
157  // hs->registerCallback(&onEv, &onRep);
158  //
159  // hs->subscribe(event_list[0]); // tap_shortcut event subscribe
160  // hs->subscribe(event_list[1]);
161 
162  hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [](json_object *object){
163  const char *application_name = json_object_get_string(
164  json_object_object_get(object, "application_name"));
165  cout << "set_event_handler Event_TapShortcut application_name = " << application_name << endl;
166  });
167 
169  const char *display_message = json_object_get_string(
170  json_object_object_get(object, "display_message"));
171  cout << "set_event_handler Event_OnScreenMessage display_message = " << display_message << endl;
172  });
173 
174  hs->set_event_handler(LibHomeScreen::Event_OnScreenReply, [](json_object *object){
175  const char *reply_message = json_object_get_string(
176  json_object_object_get(object, "reply_message"));
177  cout << "set_event_handler Event_OnScreenReply reply_message = " << reply_message << endl;
178  });
179 
180  if (ret < 0) {
181  printf("failed to create event loop");
182  return -1;
183  }
184 
185  call_test();
186 
187  return 0;
188 }
static void usage()
Definition: test.cpp:35
LibHomeScreen * hs
Definition: test.cpp:33
- + +
static void call_test()
Definition: test.cpp:51
- -
int init(const int port, const std::string &token)
+
int init(const int port, const std::string &token)
-
void set_event_handler(enum EventType et, handler_func f)
- +
void set_event_handler(enum EventType et, handler_func f)
+
@@ -302,7 +302,7 @@ Variables

Definition at line 35 of file test.cpp.

-
36 {
37  cout << "verb "<< "key:arg" << endl;
38  cout << "example:" << endl;
39  cout << "ping" << endl;
40  cout << "------- -------- --- " << endl;
41  cout << " verb key value" << endl;
42  cout << "verb list:" << endl;
43  for(auto itr = LibHomeScreen::api_list.begin(); itr != LibHomeScreen::api_list.end(); ++itr)
44  {
45  cout << " " << *itr << endl;
46  }
47  // Todo output api list
48  exit(0);
49 }
static const std::vector< std::string > api_list
+
36 {
37  cout << "verb "<< "key:arg" << endl;
38  cout << "example:" << endl;
39  cout << "ping" << endl;
40  cout << "------- -------- --- " << endl;
41  cout << " verb key value" << endl;
42  cout << "verb list:" << endl;
43  for(auto itr = LibHomeScreen::api_list.begin(); itr != LibHomeScreen::api_list.end(); ++itr)
44  {
45  cout << " " << *itr << endl;
46  }
47  // Todo output api list
48  exit(0);
49 }
static const std::vector< std::string > api_list