?? gasclient_bak.cpp
字號:
#include "CB_SysParam.h"
#include "CB_User.h"
#include "CB_Freal.h"
#include "CB_Tools.h"
#include "CB_GasCliInfo.h"
#include <sys/time.h>
#include <sys/timeb.h>
#include "Afx.h"
#include "CB_Info.h"
#include "CB_Unit.h"
#include "CB_Profile.h"
#include "CB_String.h"
#include "CB_Socket.h"
static char *DATATYPE[]={"KJF2000","KJF4"};
bool isSocketEnable = true;
int main(int argc,char *argv[])
{
CB_GasCliInfo *pInfo = new CB_GasCliInfo();
//pInfo ->initalize();
if(argc<2){
printf(pInfo->getHelp());
exit(1);
}
char *argv_1 = argv[1];
CB_Unit::trim(argv_1);
if(strcasecmp(argv_1,"--help")==0){
printf(pInfo->getHelpDetail());
exit(1);
}else if(strcasecmp(argv_1,"--version")==0){
printf(pInfo->getVersion());
exit(1);
}
delete pInfo;
CB_SysParam cSysParam;
if(setSysParam(&cSysParam,argv_1)<0)
{
printf("setSysParam failed.\n");
printf("The System will be restarted after 60 sec.\n");
//sleep(60);
//system("reboot");
}
printf("setSysParam success.\n");
sleep(cSysParam.getDelay());
if(setTimeStamp(&cSysParam)<0){
printf("The System will be restarted after 60 sec.\n");
//sleep(60);
//system("reboot");
}
pid_t pid_real_run;
if((pid_real_run=fork())==0){
isRealRun(&cSysParam);
}else if(pid_real_run>0){
}else{
perror("pid_real_run error.");
}
CB_Socket::m_port = atoi(cSysParam.getPort());
CB_Socket::m_ip = cSysParam.getHost();
CB_User cUser;
cUser.setSocketEnable(isSocketEnable);
if(setUserMsg(&cSysParam,&cUser)<0)
{
printf("setUserMsg failed.\n");
printf("The System will be restarted after 60 sec. \n");
//system("reboot");
}
printf("setUserMsg success.\n");
pid_t pid_ip;
if((pid_ip=fork())==0){
processIP(&cUser);
}else if(pid_ip>0){
}else{
perror("pid_ip error.");
}
if(convertInitdata(&cSysParam,&cUser)<0){
printf("convert initdata.txt error. \n");
printf("The System will be restarted after 60 sec. \n");
//system("reboot");
}
printf("convert initdata.txt success. \n");
pid_t pid_chg_init;
if((pid_chg_init=fork())==0){
checkInitdataChange(&cSysParam,&cUser);
}else if(pid_chg_init>0){
}else{
perror("pid_chg_init error.");
}
pid_t pid_chg_real;
if((pid_chg_real=fork())==0){
checkRealdataChange(&cSysParam,&cUser);
}else if(pid_chg_real>0){
}else{
perror("pid_chg_real error.");
}
/*
pid_t pid_real_stop;
if( (pid_real_stop=fork())==0)
{
checkRealStop(&cSysParam,&cUser);
}else if(pid_real_stop>0){
}
else{
perror("pid_real_stop error.");
}
*/
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -