main.c
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include "JZsdkLib.h"
#include "BaseConfig.h"
int main(int argc, char* argv[])
{
//设定本程序为 uart程序模式 还是 psdk程序模式
//前者可用于 uart连接对外接口 或者是 通过uart控制的psdk
//后者则是用于直接镶套在psdk程序里面
//参数解析
JZsdk_ParamterParsing(argc, argv);
//通过参数判断出进行什么提示程序操作
//如果是喊话器设备
#if MEGAPHONE_CONFIG_STATUS == VERSION_SWITCH_ON
//如果是 -e 程序错误 播放喊话器错误
//如果是 -s 程序成功 播放喊话器升级成功
//如果是 -f 程序失败 播放喊话器升级失败
#endif
while (1)
{
delayMs(1000);
}
}
// #include<stdio.h>
// #include<unistd.h>
// #include<string.h>
// #include<getopt.h>
// void print_usage()
// {
// printf("\nUsage:\n");
// printf("\t--name=student name\n");
// printf("\t-s, --sex=student sex\n"
// "\t\tif no usage ,sex is 0 means man\n\n");
// printf("\t-g, --grade=student in grade\n");
// printf("\t-c, --class=student in class\n");
// printf("\t-h, --help\n");
// }
// int main(int argc, char* argv[])
// {
// int opt, grade, class, sex = -1;
// char *name = NULL;
// struct option long_options[] = {
// {"name", required_argument, NULL, 'n'},
// {"sex", optional_argument, &sex, 's'},
// {"grade", optional_argument, NULL, 'g'},
// {"class", required_argument, NULL, 'c'},
// {"help", no_argument, NULL, 'H'},
// {0, 0, 0, 0}
// };
// printf("n:s::g::c:H\n");
// while ((opt = getopt_long(argc, argv, "n:s::g::c:H", long_options, NULL)) != -1) {
// printf ("\nopt:%c, optarg:%s, optind:%d, opterr:%d, optopt:%c, argv[optind]:%s\n",
// opt, optarg, optind, opterr, optopt, argv[optind-1]);
// switch (opt) {
// case 'n':
// name = optarg;
// printf("name:%s\n", name);
// break;
// case 's':
// printf("sex:%d\n", sex);
// if (sex == -1)sex = 0;
// //printf("sex:%d, %s", sex, sex > 0 ? "gilr":"mem");
// break;
// case 'g':
// if (!strcmp(argv[optind-1], "-g"))grade = 1;
// else
// grade = strtoul(optarg, NULL, 10);
// break;
// case 'c':
// class = strtoul(optarg, NULL, 10);
// break;
// case 'H':
// print_usage();
// return 0;
// default:
// print_usage();
// return -1;
// }
// }
// printf("A student info:\n"
// "name:%s\n"
// "sex:%s\n"
// "grade:%d\n"
// "class:%d\n",
// name, sex > 0 ? "gilr" : "men", grade, class)
// ;
// return 0;
// }