summaryrefslogtreecommitdiff
path: root/tvapi/android/jni/cfbc_test.cpp (plain)
blob: ecba2e6d52711d91fde3080a78e14efd55717582
1#include "stdlib.h"
2#include "stdio.h"
3#include "tv/CFbcCommunication.h"
4
5int main(int argc, char **argv)
6{
7 int idx = 0, send_buf[128], recv_buf[128], cmd_value = 1, run_flag = 0, run_cnt = 0, cmd_type = 0, read_flag = 0;
8 printf("run begin.......\n");
9 if (argc < 4) {
10 printf("usage:./libcfbc_jni cmd_type cmd_value run_cnt(all hex mode)\n");
11 return 0;
12 }
13
14 cmd_type = strtol(argv[1], NULL, 16);
15 cmd_value = strtol(argv[2], NULL, 16);
16 run_cnt = strtol(argv[3], NULL, 16);
17
18 CFbcCommunication *cfbcHandle = new CFbcCommunication();
19 printf("to test.......\n");
20 cfbcHandle->run();
21 sleep(0.2);
22
23 switch (cmd_type) {
24 default:
25 for (idx = 0; idx < run_cnt; idx++) {
26 memset(send_buf, 0, sizeof(send_buf));
27 memset(recv_buf, 0, sizeof(recv_buf));
28 send_buf[0] = cmd_type;
29 send_buf[1] = 3;
30 send_buf[2] = cmd_value;
31 printf("\n\n======%d to set value is:0x%02x\n", idx, cmd_value);
32 cfbcHandle->handleCmd(COMM_DEV_SERIAL, send_buf, recv_buf);
33 sleep(1);
34 }
35 break;
36 }
37
38 printf("wait to exit......\n");
39 cfbcHandle->requestExitAndWait();
40 delete cfbcHandle;
41 printf("program exited\n");
42 return 0;
43}
44