Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
断水客
IDP_DAQ_52503
提交
61b41a41
I
IDP_DAQ_52503
项目概览
断水客
/
IDP_DAQ_52503
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
IDP_DAQ_52503
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
61b41a41
编写于
6月 09, 2021
作者:
断
断水客
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update cmd.cpp
上级
0cbea174
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
61 addition
and
110 deletion
+61
-110
cmd.cpp
cmd.cpp
+61
-110
未找到文件。
cmd.cpp
浏览文件 @
61b41a41
...
...
@@ -43,136 +43,90 @@ int FindInCmds(char* val)
return
-
1
;
}
/*
****************************************************************************************
/*************************************************************
Init method if DAQ config system
****************************************************************************************
*/
*************************************************************/
void
Cmd_Init
()
{
DaqFM_Read
(
daqFMx
);
}
/*
***************************************************************************************
/************************************************************
basic cmds of system
****************************************************************************************
*/
*************************************************************/
char
cmd_Func_help
()
{
(
void
)
printf
(
"Usage: command
\n
"
);
(
void
)
printf
(
"
\n
"
);
(
void
)
printf
(
"Commands:
\n
"
);
(
void
)
printf
(
" help
\t
print this help message
\n
"
);
(
void
)
printf
(
" quit
\t
quit application
\n
"
);
(
void
)
printf
(
" prints
\t
Print the config info in ConfigFile
\n
"
);
(
void
)
printf
(
" printf
\t
Print the values of all elements of the structure
\n
"
);
(
void
)
printf
(
" save
\t
Write the configuration information to the configuration file
\n
"
);
/* The main category */
(
void
)
printf
(
"
\n\t
---Main category---
\n
"
);
(
void
)
printf
(
" sample
\t
Configure all the elems of SampleRate
\n
"
);
(
void
)
printf
(
" baud
\t
Configure all the elems of baud
\n
"
);
(
void
)
printf
(
" smethod
\t
Configure all the elems of smethod
\n
"
);
(
void
)
printf
(
" csignal
\t
Configure all the elems of csignal
\n
"
);
(
void
)
printf
(
" basicparam
\t
Configure all the elems of basicparam
\n
"
);
/* Subsidiary categories */
(
void
)
printf
(
"
\n\t
---Subsidiary categories---
\n
"
);
(
void
)
printf
(
" samplerate
\t
Configure the SampleRate
\n
"
);
(
void
)
printf
(
" dfp
\t
Configure the dfp
\n
"
);
(
void
)
printf
(
" baud
\t
Configure the baud
\n
"
);
(
void
)
printf
(
" fre
\t
Configure the fre
\n
"
);
(
void
)
printf
(
" pp
\t
Configure the pp
\n
"
);
(
void
)
printf
(
" mode
\t
Configure the mode
\n
"
);
(
void
)
printf
(
" ipaddr
\t
Configure the ipaddr
\n
"
);
(
void
)
printf
(
" mask
\t
Configure the mask
\n
"
);
(
void
)
printf
(
" gateway
\t
Configure the gateway
\n
"
);
(
void
)
printf
(
" serverip
\t
Configure the serverip
\n
"
);
(
void
)
printf
(
" serverport
\t
Configure the serverport
\n
"
);
(
void
)
printf
(
" sn
\t
Configure the sn
\n
"
);
(
void
)
printf
(
" lon
\t
Configure the lon
\n
"
);
(
void
)
printf
(
" la
\t
Configure the la
\n
"
);
(
void
)
printf
(
" model
\t
Configure the model
\n
"
);
(
void
)
printf
(
"Usage: cmd
\n
"
);
(
void
)
printf
(
"
\n
"
);
(
void
)
printf
(
"Commands:
\n
"
);
(
void
)
printf
(
" help print this help message
\n
"
);
(
void
)
printf
(
" quit quit application
\n
"
);
return
EXIT_SUCCESS
;
}
/* quit this stage */
char
cmd_Func_quit
()
{
(
void
)
printf
(
"Exiting ...
\n
"
);
exit
(
EXIT_SUCCESS
);
}
/*
Prints out the values of all elements of the structure (has not been written into Configfile)
*/
/*
打印输出结构体所有元素的值
*/
char
cmd_Func_prints
()
{
printf
(
"basicParam_chn:%s
\n
"
,
daqFMx
->
_basicparam
.
_chn
);;
printf
(
"sample_dfp:%s
\n
"
,
daqFMx
->
_sample
.
_dfp
);;
printf
(
"sample_
samplerate
:%s
\n
"
,
daqFMx
->
_sample
.
_samplerate
);;
printf
(
"sample_
baud
:%s
\n
"
,
daqFMx
->
_baud
.
_baud
);;
printf
(
"
csignal_fre
:%s
\n
"
,
daqFMx
->
_csignal
.
_fre
);;
printf
(
"
csignal_p
p:%s
\n
"
,
daqFMx
->
_csignal
.
_pp
);;
printf
(
"sample_
dfp
:%s
\n
"
,
daqFMx
->
_sample
.
_samplerate
);;
printf
(
"sample_
dfp
:%s
\n
"
,
daqFMx
->
_baud
.
_baud
);;
printf
(
"
sample_dfp
:%s
\n
"
,
daqFMx
->
_csignal
.
_fre
);;
printf
(
"
sample_df
p:%s
\n
"
,
daqFMx
->
_csignal
.
_pp
);;
printf
(
"smethod_gateway:%s
\n
"
,
daqFMx
->
_smethod
.
_gateway
);;
printf
(
"smethod_ipaddr:%s
\n
"
,
daqFMx
->
_smethod
.
_ipaddr
);;
printf
(
"smethod_mask:%s
\n
"
,
daqFMx
->
_smethod
.
_mask
);;
printf
(
"smethod_mode:%s
\n
"
,
daqFMx
->
_smethod
.
_mode
);;
printf
(
"smethod_serverip:%s
\n
"
,
daqFMx
->
_smethod
.
_serverip
);;
printf
(
"smethod_port:%s
\n
"
,
daqFMx
->
_smethod
.
_serverport
);;
printf
(
"basicparam_chn:%s
\n
"
,
daqFMx
->
_basicparam
.
_chn
);;
printf
(
"basicparam_la:%s
\n
"
,
daqFMx
->
_basicparam
.
_la
);;
printf
(
"basicparam_lon:%s
\n
"
,
daqFMx
->
_basicparam
.
_lon
);;
printf
(
"basicparam_model:%s
\n
"
,
daqFMx
->
_basicparam
.
_model
);;
printf
(
"basicparam_sn:%s
\n
"
,
daqFMx
->
_basicparam
.
_sn
);;
return
(
EXIT_SUCCESS
);
}
/*
print the info in ConfigFile (has been written into Configfile)
*/
/*
打印输出配置文件信息
*/
char
cmd_Func_printf
()
{
DaqFileManager
reader
;
pDaqFM
pReader
=
&
reader
;
DaqFM_StrucInit
(
pReader
);
/* read info from config file and save to daq strc */
DaqFM_Read
(
pReader
);
DaqFM_Read
(
daqFMx
);
/* printf vals of all elems of info strct */
printf
(
"sample_dfp:%s
\n
"
,
pReader
->
_sample
.
_dfp
);;
printf
(
"sample_samplerate:%s
\n
"
,
pReader
->
_sample
.
_samplerate
);;
printf
(
"sample_baud:%s
\n
"
,
pReader
->
_baud
.
_baud
);;
printf
(
"csignal_fre:%s
\n
"
,
pReader
->
_csignal
.
_fre
);;
printf
(
"csignal_pp:%s
\n
"
,
pReader
->
_csignal
.
_pp
);;
printf
(
"smethod_gateway:%s
\n
"
,
pReader
->
_smethod
.
_gateway
);;
printf
(
"smethod_ipaddr:%s
\n
"
,
pReader
->
_smethod
.
_ipaddr
);;
printf
(
"smethod_mask:%s
\n
"
,
pReader
->
_smethod
.
_mask
);;
printf
(
"smethod_mode:%s
\n
"
,
pReader
->
_smethod
.
_mode
);;
printf
(
"smethod_serverip:%s
\n
"
,
pReader
->
_smethod
.
_serverip
);;
printf
(
"smethod_port:%s
\n
"
,
pReader
->
_smethod
.
_serverport
);;
printf
(
"basicparam_la:%s
\n
"
,
pReader
->
_basicparam
.
_la
);;
printf
(
"basicparam_lon:%s
\n
"
,
pReader
->
_basicparam
.
_lon
);;
printf
(
"basicparam_model:%s
\n
"
,
pReader
->
_basicparam
.
_model
);;
printf
(
"basicparam_sn:%s
\n
"
,
pReader
->
_basicparam
.
_sn
);;
cmd_Func_prints
();
return
(
EXIT_SUCCESS
);
}
/*
Write the configuration information to the configuration file
*/
/*
把配置信息写入配置文件
*/
char
cmd_Func_save
()
{
DaqFM_Save
(
daqFMx
);
return
EXIT_SUCCESS
;
}
/************************************************************
******************
/************************************************************
Specific options
配置函数
*************************************************************
******************
/
*************************************************************/
/*****************************
The main category
******************************/
/*
Configure the SampleRat
e */
/*****************************
*** 大类配置命令 **
******************************/
/*
配置samlp
e */
char
cmd_Func_sample
()
{
cmd_Func_dfp
();
cmd_Func_samplerate
();
return
EXIT_SUCCESS
;
}
/*
Configure the
baud */
/*
配置
baud */
char
cmd_Func_baud
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -187,13 +141,13 @@ char cmd_Func_baud()
return
EXIT_SUCCESS
;
}
while
(
!
(
strcmp
(
buffer
,
Val_1
)
||
strcmp
(
buffer
,
Val_2
)));
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_baud_baud
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the csin
gnal */
/*
配置csi
gnal */
char
cmd_Func_csignal
()
{
cmd_Func_fre
();
...
...
@@ -201,7 +155,7 @@ char cmd_Func_csignal()
return
EXIT_SUCCESS
;
}
/*
Configure the all options of smethod
*/
/*
配置smethod
*/
char
cmd_Func_smethod
()
{
cmd_Func_mode
();
...
...
@@ -212,7 +166,7 @@ char cmd_Func_smethod()
cmd_Func_serverport
();
return
EXIT_SUCCESS
;
}
/*
Configure the basic params
*/
/*
配置basicparam
*/
char
cmd_Func_basicparam
()
{
cmd_Func_sn
();
...
...
@@ -223,9 +177,9 @@ char cmd_Func_basicparam()
return
EXIT_SUCCESS
;
}
/***************************
Subsidiary categories
****************************/
/***************************
***** 小项配置命令 ****
****************************/
/*
Configure the
dfp */
/*
配置
dfp */
char
cmd_Func_dfp
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -243,7 +197,7 @@ char cmd_Func_dfp()
DaqFM_SetVal_sample_dfp
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the SampleR
ate */
/*
配置samlper
ate */
char
cmd_Func_samplerate
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -255,11 +209,11 @@ char cmd_Func_samplerate()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_sample_samplerate
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the
fre */
/*
配置
fre */
char
cmd_Func_fre
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -271,11 +225,11 @@ char cmd_Func_fre()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_csignal_fre
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the
pp */
/*
配置
pp */
char
cmd_Func_pp
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -287,12 +241,12 @@ char cmd_Func_pp()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_csignal_pp
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the
mode */
/*
配置
mode */
char
cmd_Func_mode
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -307,11 +261,9 @@ char cmd_Func_mode()
return
EXIT_SUCCESS
;
}
while
(
!
(
strcmp
(
buffer
,
Val_1
)
||
strcmp
(
buffer
,
Val_2
)));
/* save to structure daqFMx */
DaqFM_SetVal_smethod_mode
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the
ipaddr */
/*
配置
ipaddr */
char
cmd_Func_ipaddr
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -323,12 +275,12 @@ char cmd_Func_ipaddr()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_smethod_ipaddr
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the
mask */
/*
配置
mask */
char
cmd_Func_mask
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -340,13 +292,13 @@ char cmd_Func_mask()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_smethod_mask
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
/*
Configure the
gateway */
/*
配置
gateway */
char
cmd_Func_gateway
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -358,14 +310,14 @@ char cmd_Func_gateway()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_smethod_gateway
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
/*
Configure the
serverip */
/*
配置
serverip */
char
cmd_Func_serverip
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -377,13 +329,13 @@ char cmd_Func_serverip()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_smethod_serverip
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the
serverport */
/*
配置
serverport */
char
cmd_Func_serverport
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -395,11 +347,11 @@ char cmd_Func_serverport()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_smethod_serverport
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the sn
*/
/*
配置sn
*/
char
cmd_Func_sn
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -411,12 +363,11 @@ char cmd_Func_sn()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_basicparam_sn
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the
lon */
/*
配置
lon */
char
cmd_Func_lon
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -428,11 +379,11 @@ char cmd_Func_lon()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_basicparam_lon
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the
la */
/*
配置
la */
char
cmd_Func_la
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -444,11 +395,11 @@ char cmd_Func_la()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_basicparam_la
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the chn
*/
/*
配置chn
*/
char
cmd_Func_chn
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -460,11 +411,11 @@ char cmd_Func_chn()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_basicparam_chn
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
/*
Configure the model
*/
/*
配置model
*/
char
cmd_Func_model
()
{
char
quit
[]
=
{
"quit"
};
...
...
@@ -476,7 +427,7 @@ char cmd_Func_model()
return
EXIT_SUCCESS
;
}
while
(
strlen
(
buffer
)
==
0
);
/*
save to structure daqFMx
*/
/*
把配置值写入结构体
*/
DaqFM_SetVal_basicparam_model
(
daqFMx
,
buffer
);
return
EXIT_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录