修复bug

main
Matthew 2 years ago
parent 7724d0aa98
commit cd4a79ed87

@ -1,7 +1,7 @@
# CMakeList.txt : CMake project for iec103, include source and define
# CMakeList.txt : CMake project for iec103, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)
cmake_minimum_required (VERSION 2.8)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED On)
set(CMAKE_CXX_EXTENSIONS Off)

@ -0,0 +1,625 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = /usr/bin/ccmake
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/shxy/iec103
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/shxy/iec103
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
/usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/shxy/iec103/CMakeFiles /home/shxy/iec103/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/shxy/iec103/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named iec103
# Build rule for target.
iec103: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 iec103
.PHONY : iec103
# fast build rule for target.
iec103/fast:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/build
.PHONY : iec103/fast
DSFileSystem.o: DSFileSystem.cpp.o
.PHONY : DSFileSystem.o
# target to build an object file
DSFileSystem.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/DSFileSystem.cpp.o
.PHONY : DSFileSystem.cpp.o
DSFileSystem.i: DSFileSystem.cpp.i
.PHONY : DSFileSystem.i
# target to preprocess a source file
DSFileSystem.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/DSFileSystem.cpp.i
.PHONY : DSFileSystem.cpp.i
DSFileSystem.s: DSFileSystem.cpp.s
.PHONY : DSFileSystem.s
# target to generate assembly for a file
DSFileSystem.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/DSFileSystem.cpp.s
.PHONY : DSFileSystem.cpp.s
Inifile.o: Inifile.cpp.o
.PHONY : Inifile.o
# target to build an object file
Inifile.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/Inifile.cpp.o
.PHONY : Inifile.cpp.o
Inifile.i: Inifile.cpp.i
.PHONY : Inifile.i
# target to preprocess a source file
Inifile.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/Inifile.cpp.i
.PHONY : Inifile.cpp.i
Inifile.s: Inifile.cpp.s
.PHONY : Inifile.s
# target to generate assembly for a file
Inifile.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/Inifile.cpp.s
.PHONY : Inifile.cpp.s
Profile_Hash.o: Profile_Hash.cpp.o
.PHONY : Profile_Hash.o
# target to build an object file
Profile_Hash.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/Profile_Hash.cpp.o
.PHONY : Profile_Hash.cpp.o
Profile_Hash.i: Profile_Hash.cpp.i
.PHONY : Profile_Hash.i
# target to preprocess a source file
Profile_Hash.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/Profile_Hash.cpp.i
.PHONY : Profile_Hash.cpp.i
Profile_Hash.s: Profile_Hash.cpp.s
.PHONY : Profile_Hash.s
# target to generate assembly for a file
Profile_Hash.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/Profile_Hash.cpp.s
.PHONY : Profile_Hash.cpp.s
basefunc.o: basefunc.cpp.o
.PHONY : basefunc.o
# target to build an object file
basefunc.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/basefunc.cpp.o
.PHONY : basefunc.cpp.o
basefunc.i: basefunc.cpp.i
.PHONY : basefunc.i
# target to preprocess a source file
basefunc.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/basefunc.cpp.i
.PHONY : basefunc.cpp.i
basefunc.s: basefunc.cpp.s
.PHONY : basefunc.s
# target to generate assembly for a file
basefunc.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/basefunc.cpp.s
.PHONY : basefunc.cpp.s
buban103.o: buban103.cpp.o
.PHONY : buban103.o
# target to build an object file
buban103.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/buban103.cpp.o
.PHONY : buban103.cpp.o
buban103.i: buban103.cpp.i
.PHONY : buban103.i
# target to preprocess a source file
buban103.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/buban103.cpp.i
.PHONY : buban103.cpp.i
buban103.s: buban103.cpp.s
.PHONY : buban103.s
# target to generate assembly for a file
buban103.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/buban103.cpp.s
.PHONY : buban103.cpp.s
buban104.o: buban104.cpp.o
.PHONY : buban104.o
# target to build an object file
buban104.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/buban104.cpp.o
.PHONY : buban104.cpp.o
buban104.i: buban104.cpp.i
.PHONY : buban104.i
# target to preprocess a source file
buban104.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/buban104.cpp.i
.PHONY : buban104.cpp.i
buban104.s: buban104.cpp.s
.PHONY : buban104.s
# target to generate assembly for a file
buban104.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/buban104.cpp.s
.PHONY : buban104.cpp.s
chainlist.o: chainlist.cpp.o
.PHONY : chainlist.o
# target to build an object file
chainlist.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/chainlist.cpp.o
.PHONY : chainlist.cpp.o
chainlist.i: chainlist.cpp.i
.PHONY : chainlist.i
# target to preprocess a source file
chainlist.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/chainlist.cpp.i
.PHONY : chainlist.cpp.i
chainlist.s: chainlist.cpp.s
.PHONY : chainlist.s
# target to generate assembly for a file
chainlist.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/chainlist.cpp.s
.PHONY : chainlist.cpp.s
commport.o: commport.cpp.o
.PHONY : commport.o
# target to build an object file
commport.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/commport.cpp.o
.PHONY : commport.cpp.o
commport.i: commport.cpp.i
.PHONY : commport.i
# target to preprocess a source file
commport.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/commport.cpp.i
.PHONY : commport.cpp.i
commport.s: commport.cpp.s
.PHONY : commport.s
# target to generate assembly for a file
commport.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/commport.cpp.s
.PHONY : commport.cpp.s
conf_close.o: conf_close.cpp.o
.PHONY : conf_close.o
# target to build an object file
conf_close.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_close.cpp.o
.PHONY : conf_close.cpp.o
conf_close.i: conf_close.cpp.i
.PHONY : conf_close.i
# target to preprocess a source file
conf_close.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_close.cpp.i
.PHONY : conf_close.cpp.i
conf_close.s: conf_close.cpp.s
.PHONY : conf_close.s
# target to generate assembly for a file
conf_close.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_close.cpp.s
.PHONY : conf_close.cpp.s
conf_open.o: conf_open.cpp.o
.PHONY : conf_open.o
# target to build an object file
conf_open.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_open.cpp.o
.PHONY : conf_open.cpp.o
conf_open.i: conf_open.cpp.i
.PHONY : conf_open.i
# target to preprocess a source file
conf_open.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_open.cpp.i
.PHONY : conf_open.cpp.i
conf_open.s: conf_open.cpp.s
.PHONY : conf_open.s
# target to generate assembly for a file
conf_open.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_open.cpp.s
.PHONY : conf_open.cpp.s
conf_read_key.o: conf_read_key.cpp.o
.PHONY : conf_read_key.o
# target to build an object file
conf_read_key.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_read_key.cpp.o
.PHONY : conf_read_key.cpp.o
conf_read_key.i: conf_read_key.cpp.i
.PHONY : conf_read_key.i
# target to preprocess a source file
conf_read_key.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_read_key.cpp.i
.PHONY : conf_read_key.cpp.i
conf_read_key.s: conf_read_key.cpp.s
.PHONY : conf_read_key.s
# target to generate assembly for a file
conf_read_key.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_read_key.cpp.s
.PHONY : conf_read_key.cpp.s
conf_write_key.o: conf_write_key.cpp.o
.PHONY : conf_write_key.o
# target to build an object file
conf_write_key.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_write_key.cpp.o
.PHONY : conf_write_key.cpp.o
conf_write_key.i: conf_write_key.cpp.i
.PHONY : conf_write_key.i
# target to preprocess a source file
conf_write_key.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_write_key.cpp.i
.PHONY : conf_write_key.cpp.i
conf_write_key.s: conf_write_key.cpp.s
.PHONY : conf_write_key.s
# target to generate assembly for a file
conf_write_key.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/conf_write_key.cpp.s
.PHONY : conf_write_key.cpp.s
display.o: display.cpp.o
.PHONY : display.o
# target to build an object file
display.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/display.cpp.o
.PHONY : display.cpp.o
display.i: display.cpp.i
.PHONY : display.i
# target to preprocess a source file
display.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/display.cpp.i
.PHONY : display.cpp.i
display.s: display.cpp.s
.PHONY : display.s
# target to generate assembly for a file
display.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/display.cpp.s
.PHONY : display.cpp.s
list_entry.o: list_entry.cpp.o
.PHONY : list_entry.o
# target to build an object file
list_entry.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/list_entry.cpp.o
.PHONY : list_entry.cpp.o
list_entry.i: list_entry.cpp.i
.PHONY : list_entry.i
# target to preprocess a source file
list_entry.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/list_entry.cpp.i
.PHONY : list_entry.cpp.i
list_entry.s: list_entry.cpp.s
.PHONY : list_entry.s
# target to generate assembly for a file
list_entry.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/list_entry.cpp.s
.PHONY : list_entry.cpp.s
netport.o: netport.cpp.o
.PHONY : netport.o
# target to build an object file
netport.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/netport.cpp.o
.PHONY : netport.cpp.o
netport.i: netport.cpp.i
.PHONY : netport.i
# target to preprocess a source file
netport.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/netport.cpp.i
.PHONY : netport.cpp.i
netport.s: netport.cpp.s
.PHONY : netport.s
# target to generate assembly for a file
netport.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/netport.cpp.s
.PHONY : netport.cpp.s
os_heap.o: os_heap.cpp.o
.PHONY : os_heap.o
# target to build an object file
os_heap.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/os_heap.cpp.o
.PHONY : os_heap.cpp.o
os_heap.i: os_heap.cpp.i
.PHONY : os_heap.i
# target to preprocess a source file
os_heap.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/os_heap.cpp.i
.PHONY : os_heap.cpp.i
os_heap.s: os_heap.cpp.s
.PHONY : os_heap.s
# target to generate assembly for a file
os_heap.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/os_heap.cpp.s
.PHONY : os_heap.cpp.s
scadaprotect.o: scadaprotect.cpp.o
.PHONY : scadaprotect.o
# target to build an object file
scadaprotect.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/scadaprotect.cpp.o
.PHONY : scadaprotect.cpp.o
scadaprotect.i: scadaprotect.cpp.i
.PHONY : scadaprotect.i
# target to preprocess a source file
scadaprotect.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/scadaprotect.cpp.i
.PHONY : scadaprotect.cpp.i
scadaprotect.s: scadaprotect.cpp.s
.PHONY : scadaprotect.s
# target to generate assembly for a file
scadaprotect.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/scadaprotect.cpp.s
.PHONY : scadaprotect.cpp.s
widgets.o: widgets.cpp.o
.PHONY : widgets.o
# target to build an object file
widgets.cpp.o:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/widgets.cpp.o
.PHONY : widgets.cpp.o
widgets.i: widgets.cpp.i
.PHONY : widgets.i
# target to preprocess a source file
widgets.cpp.i:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/widgets.cpp.i
.PHONY : widgets.cpp.i
widgets.s: widgets.cpp.s
.PHONY : widgets.s
# target to generate assembly for a file
widgets.cpp.s:
$(MAKE) -f CMakeFiles/iec103.dir/build.make CMakeFiles/iec103.dir/widgets.cpp.s
.PHONY : widgets.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... iec103"
@echo "... rebuild_cache"
@echo "... DSFileSystem.o"
@echo "... DSFileSystem.i"
@echo "... DSFileSystem.s"
@echo "... Inifile.o"
@echo "... Inifile.i"
@echo "... Inifile.s"
@echo "... Profile_Hash.o"
@echo "... Profile_Hash.i"
@echo "... Profile_Hash.s"
@echo "... basefunc.o"
@echo "... basefunc.i"
@echo "... basefunc.s"
@echo "... buban103.o"
@echo "... buban103.i"
@echo "... buban103.s"
@echo "... buban104.o"
@echo "... buban104.i"
@echo "... buban104.s"
@echo "... chainlist.o"
@echo "... chainlist.i"
@echo "... chainlist.s"
@echo "... commport.o"
@echo "... commport.i"
@echo "... commport.s"
@echo "... conf_close.o"
@echo "... conf_close.i"
@echo "... conf_close.s"
@echo "... conf_open.o"
@echo "... conf_open.i"
@echo "... conf_open.s"
@echo "... conf_read_key.o"
@echo "... conf_read_key.i"
@echo "... conf_read_key.s"
@echo "... conf_write_key.o"
@echo "... conf_write_key.i"
@echo "... conf_write_key.s"
@echo "... display.o"
@echo "... display.i"
@echo "... display.s"
@echo "... list_entry.o"
@echo "... list_entry.i"
@echo "... list_entry.s"
@echo "... netport.o"
@echo "... netport.i"
@echo "... netport.s"
@echo "... os_heap.o"
@echo "... os_heap.i"
@echo "... os_heap.s"
@echo "... scadaprotect.o"
@echo "... scadaprotect.i"
@echo "... scadaprotect.s"
@echo "... widgets.o"
@echo "... widgets.i"
@echo "... widgets.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

@ -93,7 +93,7 @@ u_long GetPrivateProString(const char *section, const char *entry, const char *d
result,
len);
}
else //其它情况使用老办法读配置
else //其它情况使用老办法读配置
{
#ifdef _WIN32
GetPrivateProfileString((LPWSTR)section, (LPWSTR)entry, (LPWSTR)defaultstr, (LPWSTR)result, len, (LPWSTR)inifile);
@ -184,7 +184,7 @@ u_long GetPrivateProString2(const char *section, const char *entry, const char *
rlen = (len < MAX_STRING_LEN) ? len : MAX_STRING_LEN;
rlen--;
// 如果缺省值的长度大于返回的最大长度
// 如果缺省值的长度大于返回的最大长度
if(!defaultstr)
{
retstr[0] = 0;
@ -207,7 +207,7 @@ u_long GetPrivateProString2(const char *section, const char *entry, const char *
}
}
// 首先将返回值赋值为缺省值,有且仅有在此赋值缺省值
// 首先将返回值赋值为缺省值,有且仅有在此赋值缺省值
strcpy(result, retstr);
if(NULL == hFile)
@ -217,7 +217,7 @@ u_long GetPrivateProString2(const char *section, const char *entry, const char *
sprintf(istring, "[%s]", section);
// 清除当前文件数据读取计数
// 清除当前文件数据读取计数
DSfseek(hFile, 0, SEEK_CLR_RCNT);
SectionOk = DSHaveSection(istring, hFile);
if(DS_SECTION_SEARCH == SectionOk)
@ -282,7 +282,7 @@ u_long GetPrivateProString2(const char *section, const char *entry, const char *
if(DSfgets(fstring, sizeof(fstring)-1, hFile) == NULL)
{
// 最后一个配置段,不存在[]的边界
// 最后一个配置段,不存在[]的边界
if(DSfeob(hFile) == 0)
{
break;
@ -400,14 +400,14 @@ u_long GetPrivateProString2(const char *section, const char *entry, const char *
}
}
// 找到合适的匹配项,直接退出
// 找到合适的匹配项,直接退出
retstr[rlen] = 0;
strcpy(result, retstr);
goto ExitFlag2;
}
}
// 没有找到合适的项目,使用缺省值
// 没有找到合适的项目,使用缺省值
ExitFlag2:
#if 0
@ -538,16 +538,16 @@ void GetCommMode(int port, u_char *str)
switch(*ptr)
{
case 'o':
case 'O': // 奇校验
case 'O': // 奇校验
SioParam[port].m_psSerial->CommMode &= ~PARITYMASK;
SioParam[port].m_psSerial->CommMode |= PARITYODD;
break;
case 'e':
case 'E': // 奇校验
case 'E': // 奇校验
SioParam[port].m_psSerial->CommMode &= ~PARITYMASK;
SioParam[port].m_psSerial->CommMode |= PARITYEVE;
break;
default: // 无校验
default: // 无校验
SioParam[port].m_psSerial->CommMode &= ~PARITYMASK;
SioParam[port].m_psSerial->CommMode |= PARITYNONE;
break;
@ -665,17 +665,17 @@ void ReadPortConfigInfo(u_short netport)
#endif
memset((char*)SioParam, 0, sizeof(SIO_PARAM_DEF)*MaxPortNum);
// 读端口信息
// 读端口信息
for (i = 0; i < MaxPortNum; i++)
{
// wen test debug
#ifdef _OS_WINDOWS_DEBUG_
//sprintf(szbuf, "初始化端口%d... ...\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d... ...\n", sm.wDay, sm.wHour,
//sprintf(szbuf, "初始化端口%d... ...\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d... ...\n", sm.wDay, sm.wHour,
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
OutputDebugString((LPCWSTR)szbuf);
#elif _DEBUG
printf("初始化端口%d... ...\n", i+1);
printf("初始化端口%d... ...\n", i+1);
#endif
SioParam[i].m_psBaoHu = (SIO_PARAM_BAOHU_DEF *)malloc(sizeof(SIO_PARAM_BAOHU_DEF));
@ -695,7 +695,7 @@ void ReadPortConfigInfo(u_short netport)
StringToUpper(szbuf);
SioParam[i].ByPassFlag = CmpString((u_char*)szbuf, (u_char*)"bypass");
// 串行端口
// 串行端口
if (i < MaxSerialPortNum)
{
SioParam[i].m_psSerial->Baud = DEFAULT_BAUD;
@ -743,9 +743,9 @@ void ReadPortConfigInfo(u_short netport)
SioParam[i].m_psSerial->XonChar2 = SioParam[i].m_psSerial->XonChar1;
SioParam[i].m_psSerial->XoffChar2 = SioParam[i].m_psSerial->XoffChar1;
// 在嵌入式系统中,读、写、数据处理是分离的进程,但是数据处理时会
// 用到波特率,而波特率只有在串口通讯中存在,数据处理进程不含有串
// 口通讯指针信息,所以需要在此重新赋值一次。
// 在嵌入式系统中,读、写、数据处理是分离的进程,但是数据处理时会
// 用到波特率,而波特率只有在串口通讯中存在,数据处理进程不含有串
// 口通讯指针信息,所以需要在此重新赋值一次。
SioParam[i].m_psBaoHu->Baud = SioParam[i].m_psSerial->Baud;
}
else
@ -795,7 +795,7 @@ void ReadPortConfigInfo(u_short netport)
SioParam[i].NetType = TCP_C_COMM;
}
// 读端口测点数量
// 读端口测点数量
GetPrivateProString(entry, "AiNum", "0", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->AiNum = atoi(szbuf);
GetPrivateProString(entry, "DiNum", "0", szbuf, 120, szPortConfig);
@ -803,7 +803,7 @@ void ReadPortConfigInfo(u_short netport)
GetPrivateProString(entry, "PiNum", "0", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->PiNum = atoi(szbuf);
// 读 Poll Command 时间常数
// 读 Poll Command 时间常数
GetPrivateProString(entry, "Retry", "", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->Retry = (u_long)atoi(szbuf);
GetPrivateProString(entry, "RetryTime", "3", szbuf, 120, szPortConfig);
@ -811,7 +811,7 @@ void ReadPortConfigInfo(u_short netport)
GetPrivateProString(entry, "WaitTime", "", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->WaitTime = (u_long)((atof(szbuf) * 1000) / TIMER_CNT);
// wen 2004.10.26 增加数据点的内存分配(先分配成接收规约内存区)
// wen 2004.10.26 增加数据点的内存分配(先分配成接收规约内存区)
//PortMemoryMalloc(i, RECV_PROTOCOL);
GetPrivateProString(entry, "PortType", "0", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->PortType = (u_char)atoi(szbuf);
@ -823,8 +823,8 @@ void ReadPortConfigInfo(u_short netport)
else
SioParam[i].m_psBaoHu->CheckTime = 0;
// wen 2005.03.01 增加遥控遥调转发处理
//"ProvYkYtTimeOut"="转发遥控超时时间"
// wen 2005.03.01 增加遥控遥调转发处理
//"ProvYkYtTimeOut"="转发遥控超时时间"
#ifdef _WIN32
GetPrivateProfileString((LPWSTR)entry, (LPWSTR)"ProvYkYtTimeOut", (LPWSTR)"10", (LPWSTR)szbuf, 120, (LPWSTR)szPortConfig);
#else
@ -834,14 +834,14 @@ void ReadPortConfigInfo(u_short netport)
#ifdef _OS_WINDOWS_DEBUG_
GetLocalTime(&sm);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 内存分配%d开始\n", sm.wDay, sm.wHour,
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 内存分配%d开始\n", sm.wDay, sm.wHour,
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
OutputDebugString((LPCWSTR)szbuf);
#endif
// 数据库点内存分配
// 数据库点内存分配
PortMemoryMalloc(i, SioParam[i].m_psBaoHu->PortType, SioParam[i].m_psBaoHu);
// 读规约配置
// 读规约配置
if (FunCallPtr[SioParam[i].ProtocolIdx].ReadConfig)
{
FunCallPtr[SioParam[i].ProtocolIdx].ReadConfig(i);
@ -850,13 +850,13 @@ void ReadPortConfigInfo(u_short netport)
#ifdef _OS_WINDOWS_DEBUG_
GetLocalTime(&sm);
// wen test debug
//sprintf(szbuf, "初始化端口%d成功\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d成功\n", sm.wDay, sm.wHour,
//sprintf(szbuf, "初始化端口%d成功\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d成功\n", sm.wDay, sm.wHour,
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
OutputDebugString((LPCWSTR)szbuf);
OutputDebugString((LPCWSTR)"\n");
#elif _OS_WINDOWS_DEBUG_
printf("初始化端口%d成功\n", i+1);
printf("初始化端口%d成功\n", i+1);
#endif
}
}
@ -893,17 +893,17 @@ void ReadPortConfigInfoEx(u_short netport)
#endif
memset((char*)SioParam, 0, sizeof(SIO_PARAM_DEF)*MaxPortNum);
// 读端口信息
// 读端口信息
for (i = 0; i < MaxPortNum; i++)
{
// wen test debug
#ifdef _OS_WINDOWS_DEBUG_
//sprintf(szbuf, "初始化端口%d... ...\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d... ...\n", sm.wDay, sm.wHour,
//sprintf(szbuf, "初始化端口%d... ...\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d... ...\n", sm.wDay, sm.wHour,
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
OutputDebugString((LPCWSTR)szbuf);
#elif _OS_WINDOWS_DEBUG_
printf("初始化端口%d... ...\n", i+1);
printf("初始化端口%d... ...\n", i+1);
#endif
SioParam[i].m_psBaoHu = (SIO_PARAM_BAOHU_DEF *)malloc(sizeof(SIO_PARAM_BAOHU_DEF));
@ -923,7 +923,7 @@ void ReadPortConfigInfoEx(u_short netport)
StringToUpper(szbuf);
SioParam[i].ByPassFlag = CmpString((u_char*)szbuf, (u_char*)"bypass");
// 串行端口
// 串行端口
if (i < MaxSerialPortNum)
{
SioParam[i].m_psSerial->Baud = DEFAULT_BAUD;
@ -971,9 +971,9 @@ void ReadPortConfigInfoEx(u_short netport)
SioParam[i].m_psSerial->XonChar2 = SioParam[i].m_psSerial->XonChar1;
SioParam[i].m_psSerial->XoffChar2 = SioParam[i].m_psSerial->XoffChar1;
// 在嵌入式系统中,读、写、数据处理是分离的进程,但是数据处理时会
// 用到波特率,而波特率只有在串口通讯中存在,数据处理进程不含有串
// 口通讯指针信息,所以需要在此重新赋值一次。
// 在嵌入式系统中,读、写、数据处理是分离的进程,但是数据处理时会
// 用到波特率,而波特率只有在串口通讯中存在,数据处理进程不含有串
// 口通讯指针信息,所以需要在此重新赋值一次。
SioParam[i].m_psBaoHu->Baud = SioParam[i].m_psSerial->Baud;
}
else
@ -1034,7 +1034,7 @@ void ReadPortConfigInfoEx(u_short netport)
mallocdbflag:
// 读端口测点数量
// 读端口测点数量
GetPrivateProString(entry, "AiNum", "0", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->AiNum = atoi(szbuf);
GetPrivateProString(entry, "DiNum", "0", szbuf, 120, szPortConfig);
@ -1042,7 +1042,7 @@ mallocdbflag:
GetPrivateProString(entry, "PiNum", "0", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->PiNum = atoi(szbuf);
// 读 Poll Command 时间常数
// 读 Poll Command 时间常数
GetPrivateProString(entry, "Retry", "", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->Retry = (u_long)atoi(szbuf);
GetPrivateProString(entry, "RetryTime", "3", szbuf, 120, szPortConfig);
@ -1050,7 +1050,7 @@ mallocdbflag:
GetPrivateProString(entry, "WaitTime", "", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->WaitTime = (u_long)((atof(szbuf) * 1000) / TIMER_CNT);
// wen 2004.10.26 增加数据点的内存分配(先分配成接收规约内存区)
// wen 2004.10.26 增加数据点的内存分配(先分配成接收规约内存区)
//PortMemoryMalloc(i, RECV_PROTOCOL);
GetPrivateProString(entry, "PortType", "0", szbuf, 120, szPortConfig);
SioParam[i].m_psBaoHu->PortType = (u_char)atoi(szbuf);
@ -1062,8 +1062,8 @@ mallocdbflag:
else
SioParam[i].m_psBaoHu->CheckTime = 0;
// wen 2005.03.01 增加遥控遥调转发处理
//"ProvYkYtTimeOut"="转发遥控超时时间"
// wen 2005.03.01 增加遥控遥调转发处理
//"ProvYkYtTimeOut"="转发遥控超时时间"
#ifdef _WIN32
GetPrivateProfileString((LPWSTR)entry, (LPWSTR)"ProvYkYtTimeOut", (LPWSTR)"10", (LPWSTR)szbuf, 120, (LPWSTR)szPortConfig);
#else
@ -1073,14 +1073,14 @@ mallocdbflag:
#ifdef _OS_WINDOWS_DEBUG_
GetLocalTime(&sm);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 内存分配%d开始\n", sm.wDay, sm.wHour,
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 内存分配%d开始\n", sm.wDay, sm.wHour,
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
OutputDebugString((LPCWSTR)szbuf);
#endif
// 数据库点内存分配
// 数据库点内存分配
PortMemoryMallocEx(i, SioParam[i].m_psBaoHu->PortType, SioParam[i].m_psBaoHu);
// 读规约配置
// 读规约配置
if (FunCallPtr[SioParam[i].ProtocolIdx].ReadConfig)
{
FunCallPtr[SioParam[i].ProtocolIdx].ReadConfig(i);
@ -1089,13 +1089,13 @@ mallocdbflag:
#ifdef _OS_WINDOWS_DEBUG_
GetLocalTime(&sm);
// wen test debug
//sprintf(szbuf, "初始化端口%d成功\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d成功\n", sm.wDay, sm.wHour,
//sprintf(szbuf, "初始化端口%d成功\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d成功\n", sm.wDay, sm.wHour,
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
OutputDebugString((LPCWSTR)szbuf);
OutputDebugString((LPCWSTR)"\n");
#elif _OS_WINDOWS_DEBUG_
printf("初始化端口%d成功\n", i+1);
printf("初始化端口%d成功\n", i+1);
#endif
}
@ -1103,25 +1103,25 @@ mallocdbflag:
for(i = 0; i < MaxPortNum; i++)
{
#ifdef _OS_WINDOWS_DEBUG_
//sprintf(szbuf, "初始化端口%d... ...\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d数据库... ...\n", sm.wDay, sm.wHour,
//sprintf(szbuf, "初始化端口%d... ...\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d数据库... ...\n", sm.wDay, sm.wHour,
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
OutputDebugString((LPCWSTR)szbuf);
#elif _OS_WINDOWS_DEBUG_
printf("初始化端口%d数据库... ...\n", i+1);
printf("初始化端口%d数据库... ...\n", i+1);
#endif
PortDataPntInit(i, SioParam[i].m_psBaoHu->PortType, SioParam[i].m_psBaoHu);
#ifdef _OS_WINDOWS_DEBUG_
GetLocalTime(&sm);
// wen test debug
//sprintf(szbuf, "初始化端口%d成功\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d数据库成功\n", sm.wDay, sm.wHour,
//sprintf(szbuf, "初始化端口%d成功\n", i+1);
sprintf(szbuf, "%02d_%02d:%02d:%02d.%03d 初始化端口%d数据库成功\n", sm.wDay, sm.wHour,
sm.wMinute, sm.wSecond, sm.wMilliseconds, i+1);
OutputDebugString((LPCWSTR)szbuf);
OutputDebugString((LPCWSTR)"\n");
#elif _OS_WINDOWS_DEBUG_
printf("初始化端口%d数据库成功\n", i+1);
printf("初始化端口%d数据库成功\n", i+1);
#endif
}
}
@ -1147,7 +1147,7 @@ void OpenAllPort(void)
{
int i;
// 只打开有效使用的端口,规约为"none"的视为无效端口
// 只打开有效使用的端口,规约为"none"的视为无效端口
for (i = 0; i < MaxPortNum; i++)
{
//commid = ValidPort[i];
@ -1167,7 +1167,7 @@ void OpenAllPort(void)
continue;
}
// 增加端口连续10次连接不上的处理方式如果10次没有连接上则等两分钟之后重新连接
// 增加端口连续10次连接不上的处理方式如果10次没有连接上则等两分钟之后重新连接
/*if ((SioParam[commid].iCreateFailCnt > 10) && (SioParam[commid].iCreateFailCnt < 120))
{
SioParam[commid].iCreateFailCnt++;
@ -1184,7 +1184,7 @@ void CloseOnePort(int commid)
{
SioParam[commid].OpenFlag = 0;
// wen 2004.10.26 删除分配的内存空间
// wen 2004.10.26 删除分配的内存空间
//PortMemoryFree(commid);
PortMemoryFree(commid, &SioParam[commid]);
}
@ -1198,7 +1198,7 @@ void CloseAllPort(void)
}
//*******************************************************************
// 通讯程序 *
// 通讯程序 *
//*******************************************************************
int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
@ -1263,7 +1263,7 @@ int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
{
aiptr[point].RawValue = aipntmsg->RawValue;
aiptr[point].State = 1;
// 定义前置机功能
// 定义前置机功能
#ifdef FUNCTION_FEND
WriteChangeData(port, point, aipntmsg, AI_PNT_TYPE);
#endif
@ -1282,18 +1282,18 @@ int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
{
aiprovptr = (PROV_AI_PNT*)SioParam[j].m_psBaoHu->AiPtr;
aiprovptr[k].ChangeFlag = 1;
// wen 2004.11.19 增加遥测变化数据的处理
// wen 2004.11.19 增加遥测变化数据的处理
SioParam[j].m_psBaoHu->AiChange = TRUE;
}
}
}
// wen 2004.11.19 增加遥测变化数据的处理
// wen 2004.11.19 增加遥测变化数据的处理
SioParam[port].m_psBaoHu->AiChange = TRUE;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
SioParam[port].LineCommCnt = 0;
SioParam[port].Status = TRUE;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -1364,12 +1364,12 @@ int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
case PNT_SOE_TIME:
memmove((char*)&diptr[point].SoeTime, (char*)&dipntmsg->SoeTime,
sizeof(DAY_TIME));
// wen 2004.11.16 增加soe数据的转发存储(是否增加soe点的配置???)
// wen 2004.11.16 增加soe数据的转发存储(是否增加soe点的配置???)
memset((void *)&SoeData, 0, sizeof(SOE_DEF));
memcpy((void *)&SoeData.SoeTime, (void*)&dipntmsg->SoeTime,
sizeof(DAY_TIME));
SoeData.bStatus = dipntmsg->Status;
// 一般为ASDU1, 即扩展字节无意义
// 一般为ASDU1, 即扩展字节无意义
SoeData.u8Type = 1;
for(i=0; i<MAX_PROV_PORT_NUM; i++)
{
@ -1380,13 +1380,13 @@ int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
ProvWriteSoeData(diptr[point].Prov[i].PortNo, &SoeData);
}
// 定义前置机功能
// 定义前置机功能
#ifdef FUNCTION_FEND
SoeData.iPntNo = point;
SetSoeData(port, &SoeData);
#endif
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
SioParam[port].LineCommCnt = 0;
SioParam[port].Status = TRUE;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -1414,13 +1414,13 @@ int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
SoeData.iPntNo = diptr[point].Prov[i].PntNo;
ProvWriteSoeData(diptr[point].Prov[i].PortNo, &SoeData);
}
// 定义前置机功能
// 定义前置机功能
#ifdef FUNCTION_FEND
SoeData.iPntNo = point;
SetSoeData(port, &SoeData);
#endif
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
SioParam[port].LineCommCnt = 0;
SioParam[port].Status = TRUE;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -1449,16 +1449,16 @@ int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
diprovptr = (PROV_DI_PNT*)SioParam[j].m_psBaoHu->DiPtr;
diprovptr[k].ChangeFlag = 1;
// wen 2004.11.19 增加遥信变化数据的处理
// wen 2004.11.19 增加遥信变化数据的处理
SioParam[j].m_psBaoHu->DiChange = TRUE;
}
}
}
// wen 2004.11.19 增加遥信变化数据的处理
// wen 2004.11.19 增加遥信变化数据的处理
SioParam[port].m_psBaoHu->DiChange = TRUE;
// 定义前置机功能
// 定义前置机功能
#ifdef FUNCTION_FEND
WriteChangeData(port, point, dipntmsg, DI_PNT_TYPE);
#endif
@ -1467,7 +1467,7 @@ int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
diptr[point].State = 1;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
SioParam[port].LineCommCnt = 0;
SioParam[port].Status = TRUE;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -1562,20 +1562,20 @@ int SetPntMsg(int port, int point, void *pntmsg, BYTE type, BYTE attr)
piprovptr = (PROV_PI_PNT*)SioParam[j].m_psBaoHu->PiPtr;
piprovptr[k].ChangeFlag = 1;
// wen 2004.11.19 增加电度变化数据的处理
// wen 2004.11.19 增加电度变化数据的处理
// SioParam[j].m_psBaoHu->PiChange = TRUE;
}
}
}
// 定义前置机功能
// 定义前置机功能
#ifdef FUNCTION_FEND
WriteChangeData(port, point, pipntmsg, PI_PNT_TYPE);
#endif
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
// wen 2005.12.15 增加设置点数据值时,可以激活端口状态
SioParam[port].LineCommCnt = 0;
SioParam[port].Status = TRUE;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -1980,7 +1980,7 @@ int PutPollCmdToBuf(int port, int type, WORD wait, char *buf, int len)
if (len == 0)
return 0;
// wen 2004.10.25 如果端口未打开则返回0
// wen 2004.10.25 如果端口未打开则返回0
//if(!SioParam[port].OpenFlag)
if(!ShmGetPortFlag(port, FLAG_OPEN))
return 0;
@ -1991,7 +1991,7 @@ int PutPollCmdToBuf(int port, int type, WORD wait, char *buf, int len)
szbuf[0] = HIBYTE(len+2);
szbuf[1] = LOBYTE(len+2);
// 将等待时间作为命令的一部分存储
// 将等待时间作为命令的一部分存储
szbuf[2] = HIBYTE(wait);
szbuf[3] = LOBYTE(wait);
memmove((char*)&szbuf[4], buf, len);
@ -2003,7 +2003,7 @@ int PutPollCmdToBuf(int port, int type, WORD wait, char *buf, int len)
return false;
}
// wen 2005.09.08 清空指令缓冲区中的所有指令
// wen 2005.09.08 清空指令缓冲区中的所有指令
void ClearAllCmdFromPollCmdBuf(int port)
{
int i;
@ -2038,7 +2038,7 @@ void ClearCmdFormPollCmdBuf(int port)
len = BYTE1(szbuf[0]) + BYTE0(szbuf[1]);
GetDataFormBuf(&SioParam[port].m_psBaoHu->PollCmd[idx], szbuf, len, true);
// wen 2005.09.20 修改清除指令下发标识
// wen 2005.09.20 修改清除指令下发标识
ClearCmdAllFlag(port);
}
@ -2064,7 +2064,7 @@ void ClearCmdFormPollCmdBufEx( int port, char *file, int line )
len = BYTE1(szbuf[0]) + BYTE0(szbuf[1]);
GetDataFormBuf(&SioParam[port].m_psBaoHu->PollCmd[idx], (u_char *)szbuf, len, true);
// wen 2005.09.20 修改清除指令下发标识
// wen 2005.09.20 修改清除指令下发标识
ClearCmdAllFlag(port);
}
@ -2170,7 +2170,7 @@ void SendCmdFormPollCmdBuf(int port)
SioParam[port].m_psBaoHu->ForceWaitCnt--;
if (SioParam[port].m_psBaoHu->ForceWaitCnt == 0)
{
ClearCmdFormPollCmdBuf(port); // 清除当前命令
ClearCmdFormPollCmdBuf(port); // 清除当前命令
//ClearCmdAllFlag(port);
}
}
@ -2202,7 +2202,7 @@ void SendCmdFormPollCmdBuf(int port)
if (SioParam[port].m_psBaoHu->SendCmdFlag
&& SioParam[port].m_psBaoHu->RevCmdFlag)
{
ClearCmdFormPollCmdBuf(port); // 清除当前命令
ClearCmdFormPollCmdBuf(port); // 清除当前命令
//ClearCmdAllFlag(port);
}
@ -2250,8 +2250,8 @@ void SendCmdFormPollCmdBuf(int port)
SioParam[port].m_psBaoHu->ForceWaitFlag = 1;
else
{
ClearCmdFormPollCmdBuf(port); // 清除当前命令
//ClearCmdAllFlag(port); // 清除当前命令
ClearCmdFormPollCmdBuf(port); // 清除当前命令
//ClearCmdAllFlag(port); // 清除当前命令
}
}
#endif
@ -2270,7 +2270,7 @@ void TimerProc(void)
continue;
}
// wen 2004.10.25 以便规约模块控制发送时序
// wen 2004.10.25 以便规约模块控制发送时序
if (FunCallPtr[SioParam[i].ProtocolIdx].Timer)
FunCallPtr[SioParam[i].ProtocolIdx].Timer(i);
else
@ -2309,7 +2309,7 @@ void SystemRtuTime(void)
if (!FunCallPtr[SioParam[i].ProtocolIdx].SendSystemTime)
continue;
// 下对时
// 下对时
if(SioParam[i].m_psBaoHu->CheckTime == 2)
FunCallPtr[SioParam[i].ProtocolIdx].SendSystemTime(i);
}
@ -2329,7 +2329,7 @@ void PortRecvDataProcess(void)
if (FLAG_OPEN == SioParam[i].OpenFlag && (SioParam[i].RecvBuf.MsgCnt > 0))
{
// 严格判断缓冲区长度
// 严格判断缓冲区长度
if (SioParam[i].RecvBuf.MsgCnt > sizeof(SioParam[i].RecvBuf.MsgData))
{
printf("WARN(%04d): RecvBuf is confusional(MsgCnt=%d, MaxLen=%d).\n",
@ -2348,35 +2348,35 @@ void PortRecvDataProcess(void)
FunCallPtr[SioParam[i].ProtocolIdx].RecvData(i,
SioParam[i].RecvBuf.MsgData,
SioParam[i].RecvBuf.MsgCnt);
// 端口接收到数据标志应该在这里清零 yizhonghu 20071029
// 端口接收到数据标志应该在这里清零 yizhonghu 20071029
//SioParam[i].PortNoDataCnt = 0;
// wen 2005.03.22 记录端口读取数据
// wen 2005.03.22 记录端口读取数据
//RecordData(i, RECORD_RO_BUF,SioParam[i].RecvBuf.MsgData,SioParam[i].RecvBuf.MsgCnt);
SioParam[i].RecvCharNum += SioParam[i].RecvBuf.MsgCnt;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.10.14 增加端口状态设置
// wen 2005.10.14 增加端口状态设置
//SioParam[i].Status = TRUE;
//-----------------------------------------------------
// 对于规约为bypass时不标记为运行正常
// 对于规约为bypass时不标记为运行正常
if (SioParam[i].ProtocolIdx > 1)
{
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2006.04.24 如果仅仅是接收到数据,不认为端口状态为正常,
// 必须是修改了数据库点才认为是端口正常。子站除外。
// wen 2006.04.24 如果仅仅是接收到数据,不认为端口状态为正常,
// 必须是修改了数据库点才认为是端口正常。子站除外。
//SioParam[i].Status = TRUE;
//=============================================================
//TimeEx(&SioParam[i].dLineCommTime);
SioParam[i].Status = TRUE;
/*if (SioParam[i].m_psBaoHu)
{
// 如果为子站
// 如果为子站
//if(SioParam[i].m_psBaoHu->PortType)
//{
//if(1 == i)
// printf("设置端口%d端口状态为TRUE\n", i+1);
// printf("设置端口%d端口状态为TRUE\n", i+1);
SioParam[i].Status = TRUE;
//}
}
@ -2408,7 +2408,7 @@ void BaohuLibMain(int netportnum)
msec = 0;
// 读端口配置信息并设置6个网络端口
// 读端口配置信息并设置6个网络端口
//ReadPortConfigInfo(netportnum);
ReadPortConfigInfoEx(netportnum);
@ -2417,7 +2417,8 @@ void BaohuLibMain(int netportnum)
//msec = (msec + TIMER_CNT) % 1000;
struct tm* ptm = localtime(NULL);
time_t stm=time(NULL);
struct tm* ptm = localtime(&stm);
DayTime.Year = ptm->tm_year + 1900;
DayTime.Month = ptm->tm_mon + 1;
@ -2427,17 +2428,17 @@ void BaohuLibMain(int netportnum)
DayTime.Sec = ptm->tm_sec;
DayTime.mSec = 0;
Sleep(100);
// 网络端口写
// 网络端口写
//SetUdpRecv();
// 所有端口定时器处理
// 所有端口定时器处理
TimerProc();
// wen 2004.10.25 以下代码放入timerproc中以便规约模块控制发送时序
// wen 2004.10.25 以下代码放入timerproc中以便规约模块控制发送时序
//for (i = 0; i < MaxPortNum; i++)
//{
// SendCmdFormPollCmdBuf(i);
//}
// 所有端口接收数据处理
// 所有端口接收数据处理
PortRecvDataProcess();
PollAllPort();
@ -2451,7 +2452,7 @@ void BaohuLibMain(int netportnum)
if (tmp1 < 0)
tmp1 += 3600;
// 每300秒RTU对时一次
// 每300秒RTU对时一次
if ((tmp1 > SYSTEM_TIME) && (tmp2 != systimecnt))
{
systimecnt = tmp2;
@ -2466,10 +2467,10 @@ int GetMaxPort()
}
//********************************************************************
//* 存储转发soe数据函数 *
//*参数int provport : 转发端口 *
//* SOE_DEF *ptrSoe : 待存储的soe数据 *
//*返回值int retval : soe数据数量 *
//* 存储转发soe数据函数 *
//*参数int provport : 转发端口 *
//* SOE_DEF *ptrSoe : 待存储的soe数据 *
//*返回值int retval : soe数据数量 *
//********************************************************************
int ProvWriteSoeData(int provport, SOE_DEF *ptrSoe)
{
@ -2507,10 +2508,10 @@ int ProvWriteSoeData(int provport, SOE_DEF *ptrSoe)
}
//********************************************************************
//* 初始化组数据定义函数 *
//*参数int provport : 转发端口 *
//* SOE_DEF *ptrSoe : 获取soe数据的缓冲区 *
//*返回值int retval : 剩余soe数据数量 *
//* 初始化组数据定义函数 *
//*参数int provport : 转发端口 *
//* SOE_DEF *ptrSoe : 获取soe数据的缓冲区 *
//*返回值int retval : 剩余soe数据数量 *
//********************************************************************
int ProvAndDelGetSoeData(int provport, SOE_DEF *ptrSoe)
{
@ -2537,8 +2538,8 @@ int ProvAndDelGetSoeData(int provport, SOE_DEF *ptrSoe)
}
//********************************************************************
//* 转发端口是否含有soe数据函数 *
//*参数int provport : 转发端口 *
//* 转发端口是否含有soe数据函数 *
//*参数int provport : 转发端口 *
//********************************************************************
int ProvHaveSoeData(int provport)
{
@ -2549,16 +2550,16 @@ int ProvHaveSoeData(int provport)
}
//********************************************************************
//* 发送数据函数 *
//*参数: int commid : 端口号 *
//* char *buf : 发送数据缓存区 *
//* int len : 发送数据长度 *
//*返回值:无 *
//* 发送数据函数 *
//*参数: int commid : 端口号 *
//* char *buf : 发送数据缓存区 *
//* int len : 发送数据长度 *
//*返回值:无 *
//********************************************************************
void SendDataToPort(int commid, char *buf, int len)
{
#ifdef FUNCTION_FEND
// 前置机为备用机时,端口下发数据处理方式
// 前置机为备用机时,端口下发数据处理方式
if(!IsSendDatatoPort(commid))
{
return;
@ -2569,39 +2570,39 @@ void SendDataToPort(int commid, char *buf, int len)
AddNode(commid, (char *)buf, len);
#else
// FillAndSendCmd(0, commid, SDS_SIO_SEND_DATA, (u_char*)buf, len);
// wen 2004.12.21 发送计数已经在发送时做了计算
// wen 2004.12.21 发送计数已经在发送时做了计算
SioParam[commid].SendCharNum += len;
#endif
}
//********************************************************************
//* 发送遥控遥调数据函数 *
//*参 数int commid : 端口号 *
//* char *buf : 发送数据缓存区 *
//* int len : 发送数据长度 *
//*返回值:无 *
//*说 明发送来自scada系统(server)的遥控遥调命令 *
//* 发送遥控遥调数据函数 *
//*参 数int commid : 端口号 *
//* char *buf : 发送数据缓存区 *
//* int len : 发送数据长度 *
//*返回值:无 *
//*说 明发送来自scada系统(server)的遥控遥调命令 *
//********************************************************************
void SendYkYtCommand(int commid, char *buf, int len)
{
// buf[0] --- 端口号(=commid)
// buf[0] --- 端口号(=commid)
// buf[1]
// buf[2]
// buf[3]
// buf[4] --- 控点号
// buf[4] --- 控点号
// buf[5]
// buf[6]
// buf[7]
// buf[8] --- 操作类型(遥控:1=选择,2=执行,3=取消,7=直控;
// 遥调:4=选择,5=执行,6=取消,8=急停)
// buf[9] --- 控制状态(1=分到合2=合到分)
// (最高位为1时为返校命令, 1=控合, 2=控分, 3=失败)
// buf[8] --- 操作类型(遥控:1=选择,2=执行,3=取消,7=直控;
// 遥调:4=选择,5=执行,6=取消,8=急停)
// buf[9] --- 控制状态(1=分到合2=合到分)
// (最高位为1时为返校命令, 1=控合, 2=控分, 3=失败)
DAY_TIME stime;
// 串行端口
// 串行端口
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.10.10 修改可以在netport下发
// wen 2005.10.10 修改可以在netport下发
//if(commid < MaxSerialPortNum)
if(commid < MaxPortNum)
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -2616,13 +2617,13 @@ void SendYkYtCommand(int commid, char *buf, int len)
{
if((buf[9] & 0x80) == 0)
{
// 保存遥控参数及环境变量
// 保存遥控参数及环境变量
GetLocalTimeEx(&stime);
memcpy((void *)&SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_sDayTime,
(void *)&stime, sizeof(DAY_TIME));
SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_iYkYtStep = buf[8];
// 该结构成员是用来保存操作类型的(不仅仅针对转发遥控)
// 该结构成员是用来保存操作类型的(不仅仅针对转发遥控)
SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_iYkYtOperate = buf[9];
SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_iCmdFrom = YKYT_CMD_FROM_SCADA;
}
@ -2633,33 +2634,33 @@ void SendYkYtCommand(int commid, char *buf, int len)
}
//********************************************************************
//* 发送遥控遥调数据函数 *
//*参 数int commid : 端口号 *
//* PROV_YKYT_PARAM *pParam : 遥控遥调参数 *
//*返回值BOOL retval : 是否转发端口数据 *
//*说 明:发送来自转发端口的遥控遥调命令 *
//* 发送遥控遥调数据函数 *
//*参 数int commid : 端口号 *
//* PROV_YKYT_PARAM *pParam : 遥控遥调参数 *
//*返回值BOOL retval : 是否转发端口数据 *
//*说 明:发送来自转发端口的遥控遥调命令 *
//********************************************************************
BOOL SendYkYtCommand2(int commid, YKYT_PARAM *pParam)
{
DAY_TIME stime;
char Val[20];
int iRealCommid;
// Val[0] --- 端口号(=commid)
// Val[0] --- 端口号(=commid)
// Val[1]
// Val[2]
// Val[3]
// Val[4] --- 控点号
// Val[4] --- 控点号
// Val[5]
// Val[6]
// Val[7]
// Val[8] --- 操作类型(遥控:1=选择,2=执行,3=取消,7=直控;
// 遥调:4=选择,5=执行,6=取消,8=急停)
// Val[9] --- 控制状态(1=分到合2=合到分)
// (最高位为1时为返校命令, 1=控合, 2=控分, 3=失败)
// Val[8] --- 操作类型(遥控:1=选择,2=执行,3=取消,7=直控;
// 遥调:4=选择,5=执行,6=取消,8=急停)
// Val[9] --- 控制状态(1=分到合2=合到分)
// (最高位为1时为返校命令, 1=控合, 2=控分, 3=失败)
// 串行端口
// 串行端口
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.10.10 修改可以在netport下发
// wen 2005.10.10 修改可以在netport下发
//if(commid >= MaxSerialPortNum)
//{
// return FALSE;
@ -2672,7 +2673,7 @@ BOOL SendYkYtCommand2(int commid, YKYT_PARAM *pParam)
memset(Val, 0, sizeof(Val));
// 非转发数据
// 非转发数据
if(YKYT_SEND_DOWN == pParam->m_iYkYtUpDown)
{
iRealCommid = commid;
@ -2697,7 +2698,7 @@ BOOL SendYkYtCommand2(int commid, YKYT_PARAM *pParam)
if(YKYT_CMD_FROM_SCADA == SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_iCmdFrom)
{
// wen 2005.10.08 非转发数据从而上送给scada服务器
// wen 2005.10.08 非转发数据从而上送给scada服务器
Val[0] = LOBYTE(pParam->m_iYkYtPnt);
Val[1] = HIBYTE(pParam->m_iYkYtPnt);
if(pParam->m_iYkYtOperate == 3)
@ -2717,12 +2718,12 @@ BOOL SendYkYtCommand2(int commid, YKYT_PARAM *pParam)
{
iRealCommid = SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_iProvPortIdx;
// 转发站号
// 转发站号
Val[0] = (BYTE)iRealCommid;
Val[1] = (BYTE)((iRealCommid & 0xFF00) >> 8);
Val[2] = (BYTE)((iRealCommid & 0xFF0000) >> 16);
Val[3] = (BYTE)((iRealCommid & 0xFF000000) >> 24);
// 转发控点号
// 转发控点号
Val[4] = (BYTE)SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_iProvYkYtPointIdx;
Val[5] = (BYTE)((SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_iProvYkYtPointIdx & 0xFF00) >> 8);
Val[6] = (BYTE)((SioParam[commid].m_psBaoHu->ProvYkYtMsg.m_iProvYkYtPointIdx & 0xFF0000) >> 16);
@ -2732,7 +2733,7 @@ BOOL SendYkYtCommand2(int commid, YKYT_PARAM *pParam)
Val[9] = (BYTE)(pParam->m_iYkYtOperate);
Val[9] |= 0x80;
}
else// 异常数据
else// 异常数据
{
return FALSE;
}
@ -2744,7 +2745,7 @@ BOOL SendYkYtCommand2(int commid, YKYT_PARAM *pParam)
{
if(YKYT_SEND_UP != pParam->m_iYkYtUpDown)
{
// 保存遥控参数及环境变量
// 保存遥控参数及环境变量
GetLocalTimeEx(&stime);
memcpy((void *)&SioParam[iRealCommid].m_psBaoHu->ProvYkYtMsg.m_sDayTime,
(void *)&stime, sizeof(DAY_TIME));
@ -2761,11 +2762,11 @@ BOOL SendYkYtCommand2(int commid, YKYT_PARAM *pParam)
}
//********************************************************************
//* 查找转发控点的转发点函数 *
//*参数: int commid : 转发端口号 *
//* int ykytpnt: 转发的遥控遥调点 *
//* SIO_PARAM_BAOHU_DEF *pBaohuParam :转发端口保护参数 *
//*返回值int retval : 对应的实际转发点号 *
//* 查找转发控点的转发点函数 *
//*参数: int commid : 转发端口号 *
//* int ykytpnt: 转发的遥控遥调点 *
//* SIO_PARAM_BAOHU_DEF *pBaohuParam :转发端口保护参数 *
//*返回值int retval : 对应的实际转发点号 *
//********************************************************************
int FindProvPntFromYkYtPnt(int commid, int ykytpnt, SIO_PARAM_BAOHU_DEF *pBaohuParam)
{
@ -3057,7 +3058,7 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
GetPrivateProString(entry, section, "", szbuf, 120, szPortConfig);
if (strlen(szbuf) == 0)
{
// wen 2005.09.28 缺省设置为1
// wen 2005.09.28 缺省设置为1
aipntmsg.Polar = 1;
SetPntMsg(commid, i, (void*)&aipntmsg, AI_PNT_TYPE, PNT_POLAR);
continue;
@ -3066,14 +3067,14 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
aipntmsg.Polar = atoi(szbuf) ? 1 : 0;
SetPntMsg(commid, i, (void*)&aipntmsg, AI_PNT_TYPE, PNT_POLAR);
// wen 2005.09.13 增加顺序增加配置
// wen 2005.09.13 增加顺序增加配置
sprintf(section, "Ai%dInc", i+1);
GetPrivateProString(entry, section, "", szbuf, 120, szPortConfig);
if(strlen(szbuf) == 0)
continue;
increase = atoi(szbuf);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.12.01 修改连续增加的读取
// wen 2005.12.01 修改连续增加的读取
//if(increase > 0)
//{
// for(k=i+1; k<increase; k++)
@ -3376,7 +3377,7 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
diprovpnt.ControlNo = atoi((char*)(ptr+1));
SetPorvPntMsg(commid, i, &diprovpnt, DI_PNT_TYPE, PNT_CTRL_NO);
}
// wen 2005.03.28 增加连续的控点配置
// wen 2005.03.28 增加连续的控点配置
else
{
diprovpnt.ControlNo = -1;
@ -3397,7 +3398,7 @@ void PortMemoryMalloc(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
SetPorvPntMsg(commid, i, &diprovpnt, DI_PNT_TYPE, PNT_PROV_MSG);
k--;
// wen 2005.03.28 增加连续的控点配置
// wen 2005.03.28 增加连续的控点配置
if(diprovpnt.ControlNo >= 0)
{
diprovpnt.ControlNo++;
@ -3793,7 +3794,7 @@ BOOL PortDataPntInit(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
GetPrivateProString(entry, section, "", szbuf, 120, szPortConfig);
if (strlen(szbuf) == 0)
{
// wen 2005.09.28 缺省设置为1
// wen 2005.09.28 缺省设置为1
aipntmsg.Polar = 1;
SetPntMsg(commid, i, (void*)&aipntmsg, AI_PNT_TYPE, PNT_POLAR);
continue;
@ -3802,14 +3803,14 @@ BOOL PortDataPntInit(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
aipntmsg.Polar = atoi(szbuf) ? 1 : 0;
SetPntMsg(commid, i, (void*)&aipntmsg, AI_PNT_TYPE, PNT_POLAR);
// wen 2005.09.13 增加顺序增加配置
// wen 2005.09.13 增加顺序增加配置
sprintf(section, "Ai%dInc", i+1);
GetPrivateProString(entry, section, "", szbuf, 120, szPortConfig);
if(strlen(szbuf) == 0)
continue;
increase = atoi(szbuf);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// wen 2005.12.01 修改连续增加的读取
// wen 2005.12.01 修改连续增加的读取
//if(increase > 0)
//{
// for(k=i+1; k<increase; k++)
@ -3965,7 +3966,7 @@ BOOL PortDataPntInit(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
diprovpnt.ControlNo = atoi((char*)(ptr+1));
SetPorvPntMsg(commid, i, &diprovpnt, DI_PNT_TYPE, PNT_CTRL_NO);
}
// wen 2005.03.28 增加连续的控点配置
// wen 2005.03.28 增加连续的控点配置
else
{
diprovpnt.ControlNo = -1;
@ -3986,7 +3987,7 @@ BOOL PortDataPntInit(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam)
SetPorvPntMsg(commid, i, &diprovpnt, DI_PNT_TYPE, PNT_PROV_MSG);
k--;
// wen 2005.03.28 增加连续的控点配置
// wen 2005.03.28 增加连续的控点配置
if(diprovpnt.ControlNo >= 0)
{
diprovpnt.ControlNo++;
@ -4145,7 +4146,7 @@ void PortMemoryFree(int commid, SIO_PARAM_DEF *pGenParam)
if (pGenParam->ExtInfo)
{
// wen 2005.04.13 规约结束时释放内存
// wen 2005.04.13 规约结束时释放内存
if (FunCallPtr[SioParam[commid].ProtocolIdx].ProtocolExit)
{
FunCallPtr[SioParam[commid].ProtocolIdx].ProtocolExit(commid);
@ -4382,7 +4383,7 @@ int SetDispFlag(int iFlag)
return RealDataDispFlag;
}
// 获取全局变量
// 获取全局变量
SIO_PARAM_DEF *GetSioParamPtr()
{
return SioParam;

@ -669,8 +669,8 @@ void TcpAccept(int commid, int lisfds)
// 多客户端向服务端连接时判断客户端来自的端口号 yizhonghu 20070704
for(i=MaxSerialPortNum; i<MaxPortNum; i++)
{
if((SioParam[i].NetCommIpAddr == addr.sin_addr.s_addr)
&& (SioParam[i].LiSock == lisfds))
//if((SioParam[i].NetCommIpAddr == addr.sin_addr.s_addr) &&
if(SioParam[i].LiSock == lisfds)//)
{
printf("sockport = %d\n", i+1);
commid = i;

@ -1,5 +1,5 @@
[Port1]
Protocol=buban103
Protocol=modbus
CommMode=9600,e,8,1
WorkMode=RS-485
HandshakeMode=NO_HANDSHAKE
@ -13,21 +13,21 @@ WaitTime=0
ykyttimeout=20
PortType=0
CheckTime=NO
#@@规约配置
时间同步过程=60.00
总查询过程=60.00
电度量查询=300.00
通用分类数据模拟量查询=3.00
通用分类数据状态量查询=3.00
链路数量=1
链路1模板文件名称=port103ser.csv
链路2模板文件名称=
链路3模板文件名称=
链路4模板文件名称=
链路5模板文件名称=
链路6模板文件名称=
上送遥信变位=0
#@@测点配置--主站
#@@规约配置
时间同步过程=60.00
总查询过程=60.00
电度量查询=300.00
通用分类数据模拟量查询=3.00
通用分类数据状态量查询=3.00
链路数量=0
链路1模板文件名称=port103ser.csv
链路2模板文件名称=
链路3模板文件名称=
链路4模板文件名称=
链路5模板文件名称=
链路6模板文件名称=
上送遥信变位=0
#@@测点配置--主站
Di2CtrlNo=0
[Port2]
Protocol = modbus
@ -36,32 +36,32 @@ WorkMode = RS-485
AiNum = 128
DiNum = 256
#PiNum = 48
# 轮询指令时间配置
# 轮询指令时间配置
Retry = 1
RetryTime = 1
WaitTime = 0
# 端口类型(=0, 主站端口; =1, 子站端口)
# 端口类型(=0, 主站端口; =1, 子站端口)
PortType = 0
# 时间校正(=no, 不对时(缺省); =up, 上对时; =down, 下对时)
# 时间校正(=no, 不对时(缺省); =up, 上对时; =down, 下对时)
CheckTime = no
装置数量=1
装置状态输入厂站端口号 = 16
装置状态输入厂站起始点号 = 3
是否屏蔽未配置信息事件 = 0
模拟量指令 = 3,0,53
开关量指令 = 3,100,4
遥控项数=1
遥控1配置=1,16,3,0,108,8899,300,110,21930,200,110,43605,0,1,108,8899,300,109,21930,200,109,43605,0
装置数量=1
装置状态输入厂站端口号 = 16
装置状态输入厂站起始点号 = 3
是否屏蔽未配置信息事件 = 0
模拟量指令 = 3,0,53
开关量指令 = 3,100,4
遥控项数=1
遥控1配置=1,16,3,0,108,8899,300,110,21930,200,110,43605,0,1,108,8899,300,109,21930,200,109,43605,0
Di1CtrlNo = 1
寄存器位数 = 16
#装置1配置信息文件名称 = mach300
装置1线路名称 =
装置1寄存器位数=16
装置1型号 = mach300
装置1地址 = 1
#模板文件名称=mach300
指令发送序列=dda
SOE状态即遥信状态=1
寄存器位数 = 16
#装置1配置信息文件名称 = mach300
装置1线路名称 =
装置1寄存器位数=16
装置1型号 = mach300
装置1地址 = 1
#模板文件名称=mach300
指令发送序列=dda
SOE状态即遥信状态=1
[Port3]
Protocol=buban103
CommMode=9600,e,8,1
@ -77,21 +77,21 @@ WaitTime=0
ykyttimeout=20
PortType=0
CheckTime=NO
#@@规约配置
时间同步过程=0
总查询过程=60.00
电度量查询=300.00
通用分类数据模拟量查询=3.00
通用分类数据状态量查询=3.00
链路数量=1
链路1模板文件名称=port103sie.csv
链路2模板文件名称=
链路3模板文件名称=
链路4模板文件名称=
链路5模板文件名称=
链路6模板文件名称=
上送遥信变位=0
#@@测点配置--主站
#@@规约配置
时间同步过程=0
总查询过程=60.00
电度量查询=300.00
通用分类数据模拟量查询=3.00
通用分类数据状态量查询=3.00
链路数量=1
链路1模板文件名称=port103sie.csv
链路2模板文件名称=
链路3模板文件名称=
链路4模板文件名称=
链路5模板文件名称=
链路6模板文件名称=
上送遥信变位=0
#@@测点配置--主站
Di1CtrlNo=0
Di2CtrlNo=1
[Port4]
@ -109,18 +109,18 @@ WaitTime=0
ykyttimeout=20
PortType=0
CheckTime=NO
装置数量 = 1
请求系统运行状态 = 10
请求交流配电信息 = 10
请求电池检测单元信息 = 10
请求馈线检测单元信息 = 10
请求绝缘监察单元信息 = 10
请求整流模块信息 = 10
请求参数设定信息 = 0
装置1地址 = 1
装置1电池数量 = 52
装置1整流模块数量 = 4
装置1名称 = gjb
装置数量 = 1
请求系统运行状态 = 10
请求交流配电信息 = 10
请求电池检测单元信息 = 10
请求馈线检测单元信息 = 10
请求绝缘监察单元信息 = 10
请求整流模块信息 = 10
请求参数设定信息 = 0
装置1地址 = 1
装置1电池数量 = 52
装置1整流模块数量 = 4
装置1名称 = gjb
[Port5]
Protocol = bypass
CommMode = 9600,n,8,1
@ -183,13 +183,13 @@ WaitTime=0
ykyttimeout=20
PortType=1
CheckTime=NO
#@@规约配置
模板文件名称=scada.csv
#@@规约配置
模板文件名称=scada.csv
[Port18]
Protocol=buban104
NetCommMode=TCP,Server
NetPort=2404
NetCommAddr=192.168.111.168
NetPort=50105
NetCommAddr=10.142.247.14
AiNum=128
DiNum=256
PiNum=64
@ -199,22 +199,22 @@ WaitTime=0
ykyttimeout=20
PortType=1
CheckTime=UP
#@@规约配置
站地址=1
总召唤电度数据=120.00
召唤初始化数据=300.00
帧序应答=20.00
超时时间=3.00
转发返校超时时间=0.00
转发是否要求应答=0
超时发送测试帧=0
遥控方式=0
遥测信息体起始地址=1793
遥信信息体起始地址=1
遥脉信息体起始地址=3073
遥控信息体起始地址=2817
版本号=1
#@@测点配置--从站
#@@规约配置
站地址=1
总召唤电度数据=120.00
召唤初始化数据=300.00
帧序应答=20.00
超时时间=3.00
转发返校超时时间=0.00
转发是否要求应答=0
超时发送测试帧=0
遥控方式=0
遥测信息体起始地址=1793
遥信信息体起始地址=1
遥脉信息体起始地址=3073
遥控信息体起始地址=2817
版本号=1
#@@测点配置--从站
ProvAi1=1a1,1
ProvAi1Inc=18
ProvAi20=2a1,1

@ -40,7 +40,8 @@ FUNCTION_CALL FunctionCall[] =
ScadaProtectExit, ScadaProtectBaoHuCmdProcess, ScadaProtectGetBaohuDataBase},
// 添加协议名称及处理程序入口等
{(char*)" ", (char*)" ", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} // 结束标志
//{(char*)"", (char*)"", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}// 结束标志
};
int InitBaohuMainFlag = 0;

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.33423.255
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "widgets", "widgets.vcxproj", "{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}.Debug|x64.ActiveCfg = Debug|x64
{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}.Debug|x64.Build.0 = Debug|x64
{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}.Debug|x86.ActiveCfg = Debug|Win32
{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}.Debug|x86.Build.0 = Debug|Win32
{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}.Release|x64.ActiveCfg = Release|x64
{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}.Release|x64.Build.0 = Release|x64
{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}.Release|x86.ActiveCfg = Release|Win32
{EEA43B07-32A7-4DE8-9E7F-20AE51E2C1A9}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87A56F45-B307-4444-AE64-52AE369D3A42}
EndGlobalSection
EndGlobal
Loading…
Cancel
Save