Przeglądaj źródła

!10767 DeviceControl下线,指纹仪js,http请求重定向
Merge pull request !10767 from 80174847/ST2

杨诗友80174847 4 miesięcy temu
rodzic
commit
8b508801f0
47 zmienionych plików z 1729 dodań i 3584 usunięć
  1. 0 3
      CMakeLists.txt
  2. 0 399
      ChangeLog.in
  3. 2 1
      DevAdapter/simulator/FingerPrint.1.1/FingerPrint_httpans.h
  4. 40 4
      DevAdapter/simulator/FingerPrint.1.1/FingerPrint_impl.cpp
  5. 0 4
      Framework/spbase/SpBase.cpp
  6. 1 0
      Framework/spbase/SpFSM.cpp
  7. 0 2
      Module/CMakeLists.txt
  8. 2 2
      Module/include/CommEntityUtil.hpp
  9. 0 8
      Module/include/EventCode.h
  10. 0 29
      Module/mod_DeviceControl/CMakeLists.txt
  11. 0 209
      Module/mod_DeviceControl/DeviceControl.xml
  12. 0 224
      Module/mod_DeviceControl/DeviceControlFSM.cpp
  13. 0 100
      Module/mod_DeviceControl/DeviceControlFSM.h
  14. 0 619
      Module/mod_DeviceControl/DeviceControl_client_g.h
  15. 0 397
      Module/mod_DeviceControl/DeviceControl_def_g.h
  16. 0 32
      Module/mod_DeviceControl/DeviceControl_msg_g.h
  17. 0 380
      Module/mod_DeviceControl/DeviceControl_server_g.h
  18. 0 161
      Module/mod_DeviceControl/Interface.h
  19. 0 477
      Module/mod_DeviceControl/mod_DeviceControl.cpp
  20. 0 143
      Module/mod_DeviceControl/mod_DeviceControl.h
  21. 0 13
      Module/mod_DeviceControl/test/testGetIpMacAddress.cpp
  22. 79 11
      Module/mod_FingerPrint/FingerPrint.xml
  23. 444 0
      Module/mod_FingerPrint/FingerPrintFSM.cpp
  24. 108 1
      Module/mod_FingerPrint/FingerPrintFSM.h
  25. 15 0
      Module/mod_FingerPrint/FingerPrint_UserErrorCode.h
  26. 147 0
      Module/mod_FingerPrint/FingerPrint_client_g.h
  27. 88 0
      Module/mod_FingerPrint/FingerPrint_def_g.h
  28. 81 0
      Module/mod_FingerPrint/FingerPrint_server_g.h
  29. 27 0
      Module/mod_FingerPrint/mod_FingerPrint.cpp
  30. 64 0
      Module/mod_FingerPrint/mod_FingerPrint.h
  31. 9 30
      Module/mod_HSPScanner/HSPScannerFSM.cpp
  32. 11 6
      Module/mod_HSPScanner/HSPScannerFSM.h
  33. 6 20
      Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp
  34. 0 12
      Module/mod_ScannerSet/ScannerSetFSM.cpp
  35. 77 5
      Module/mod_chromium/CModTools.cpp
  36. 1 1
      Module/mod_chromium/CModTools.h
  37. 5 1
      Module/mod_chromium/CWebsocketServer.cpp
  38. 0 2
      Module/mod_evtconverter/CustomerApproachEvent.hpp
  39. 0 2
      Module/mod_evtconverter/CustomerApproachEventCardStore.hpp
  40. 0 2
      Module/mod_gpio/GpioFSM.cpp
  41. 0 1
      Module/mod_gpio/mod_gpio.cpp
  42. 1 1
      Module/mod_gpio/mod_gpio.h
  43. 0 1
      Module/mod_healthmanager/CMakeLists.txt
  44. 0 5
      Module/mod_vtmloader/VtmLoaderFSM.cpp
  45. 19 0
      addin/res/ManagerDesktop/redirect.html
  46. 497 274
      addin/res/VTMModifyHeaders/background.js
  47. 5 2
      addin/res/VTMModifyHeaders/manifest.json

+ 0 - 3
CMakeLists.txt

@@ -601,9 +601,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
 file(WRITE ${CMAKE_BINARY_DIR}/env.ini "${INI_CONTENT}")
 message("Generated env.ini file in ${CMAKE_BINARY_DIR}")
 
-# Configure files
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog.in" ${CMAKE_BINARY_DIR}/ChangeLog @ONLY)
-
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

+ 0 - 399
ChangeLog.in

@@ -1,399 +0,0 @@
-## 更新记录
-
-*Last Built Day: @BUILD_DATE_STRING@*
-
-## 
-
-* 流水线支持实时更新版本号
-* 同步Windows,支持 DEVOPS_ 前缀的环境变量
-* 去除以前老的UpdateRaw的升级包编译场景
-* 开发测试版本支持本地配置是否需要跳过终端信息的校验
-* 安装流程中不再有分行服务的概念
-* 前置对浏览器安装的必需检查项,没有安装浏览器不让安装
-* 安装流程中去除南天相关的配置信息
-* 安装流程中准入初始化支持ST/SP前缀的账号登录
-* 框架修复实时日志缺失的问题(共享内存实现问题,改动较大,需要观察是否影响到其他功能,但也仅限于日志记录和应用启停这块)
-
-
-## 1.4.5.1
-* 心跳Lost问题修复
-* 卡机非接日志修复
-
-## 1.4.4-rc1
-* 卡机支持非接改造
-* 同步Windows版框架内容
-
-## v1.4.0.1
-
-1.同步心跳实体 windows 功能
-2.改造心跳实体心跳请求直连 ACS 服务功能
-3.心跳实体埋点日志同步更新
-
-4.录像告警信息优化
-5.实时日志实体名称小写化
-6.实时日志时间戳精确到毫秒级别
-
-## v1.3.0-rc1
-
-* 开机吞卡逻辑调整,发现有卡一律吞卡处理
-* 同步Windows,跨机细化
-* 优化播放实体的稳定性,解决存在实体异常问题
-
-## V1.2.1-rc1
-* 初始化准入模块合并优化
-* 媒体告警优化
-
-## V1.2.0-rc1
-* 媒体配置告警上送(终端后置)
-* 广电密码键盘采用硬件提示音
-
-## V0.3.13.4
-* 媒体回显窗口问题缺陷修复
-
-## V0.3.13.3
-*  V0.3.13.1 版本的回滚
-
-## V0.3.13.2
-* 增加识别不到音频设备告警信息
-* 媒体相关实体启动优化
-
-## V0.3.13.1
-
-## V0.3.12.1
-[Vendor][GRG] 广电发卡器Lost问题修复
-[Framework] 框架Http组件同步Windows,兼容非JSON返回格式
-[HSPSCanner] 高拍仪Level3校准
-
-## V0.3.11.3
-[Vendor][BugFix] 厂商日志实时上送,日志等级控制失效问题修复
-
-
-## V0.3.11.2
-
-[Framework] RvcFramework/1.0.8-dev8 Kill指定改成强制杀死进程
-[Vendor] 厂商日志实时上送
-[ResourceWatcher] 输入法安装卸载添加告警
-
-## V0.3.11
-[Audio] 日日宝风险提示音上线
-[SelfChecker] 应用日志改造
-[HSPS] 高拍仪Level3校准
-[Download][UpgradeRun] 实体下线
-[Upload] os_type 字段添加
-[Vendor] 广电日志版本
-
-
-## V0.3.7
-* [Feature] 媒体部分实体应用日志改造
-* [Feature] 硬件实体应用日志改造包括非接、密码键盘、指纹仪和对应的功能集、GPIO和看门狗等
-* [Vendor] 驰卡固件驱动和W高拍仪驱动
-
-
-## V0.3.6
-* [BugFix] 媒体关联实体连接通讯方式优化
-* [Config] 业务硬件故障话术同步
-* [HSPScanner] 兼容硬件打开失败不Lost处理
-
-## V0.3.5
-
-* [Chromium] 浏览器实体重连优化
-* [T22HC281] 录像优化
-* [DevAdapter] 南天错误码更新 nantian/2022.0905.01
-* [BugFix] 删除硬件公共状态机类的埋点日志,解决广电卡机实体Lost问题
-
-## V0.3.4
-* [BugFix] 物料维护
-* [Feature][UpgradeManager] CPU占用优化
-* [HSPScanner] 高拍仪Windows版同步
-* [Chromium] 支持业务故障码
-
-## V0.3.3
-* [GUIConsole] 物料维护去分行化改造
-
-## V0.3.2
-* [Media] 闪电贷提示音资源文件合并
-* [BugFix] 应用日志缺陷修复
-* [Feature] 升级、资源管理、高拍仪等Level2告警修复
-* [Feature] 物料维护服务返回的GBK编码修正,DB监控阈值告警优化
-
-
-## V0.3.1
-* [Feature] 支持远程双录功能
-
-## V0.3.0
-* [Feature]新debian安装包
-* [Feature]支持屏幕信息快照内容的获取
-
-## V0.2.15
-* [Feature] 支持业务端重启和重装搜狗输入法
-* [Feature][Chromium] 同步Windows版本功能,优化不支持Service类型的实体的重复连接逻辑
-* [Feature][Framework] Release版本移除左上角弹窗的显示
-
-## V0.2.14
-
-* [Feature][BugFix] 框架支持互联网化二次上线,同步更新cJSON库文件
-* [Audio] 更新业务提示音和广告文件
-* [BugFix][CardIssuer] 处理一个无效的适配器告警
-
-## V0.2.13
-
-* [Feature] 框架支持互联网日志埋点
-
-## V0.2.12
-
-* [BugFix][CardIssuer] 卡箱无卡不作为故障统计
-* [BugFix][IDCertificate] 读取身份证时去除对Error_DevMedia的特殊判断
-
-## V0.2.11
-
-* [BugFix][Vendor][Keba][HSPSCanner] 解决高拍仪偶发拍照错乱问题
-
-## V0.2.10
-
-* [BugFix][IDCertificate] 身份证实体Lost问题修复,功能回滚
-
-## V0.2.9
-* [BugFix][Heatbeat] 心跳连接卡库时异常Lost问题修复
-* [ContactlessCard] 添加接口报错时的告警
-* [IDCertificate] 去除ReadAndScan接口中对Error_DevMedia的特殊判断
-* [BugFix][GPIO] 提挂机设置一个初始值,避免在上一次未放好话筒后导致当前启动后立马连接坐席
-
-## V0.2.8
-* [BugFix][Feature] 远程双录去分行化
-
-
-## V0.2.7
-* [Feature] 浏览器日志通道(陈良瑜)
-
-## V0.2.6
-
-* [BugFix] Http组件 Get 请求报 500 问题修复
-* [BugFix][PinPad] 告警码校准:取消输入时历史接口异常不抛送告警码
-* 添加安装耗时时长记录,安装版本记录以及安装时间戳,支持终端信息获取URL地址可编辑  
-* [Config] Alarm 启动选项提前,并启动级别调为 0
-* [RVCFramework] 去除 SysLog 本地持久化
-* [Feature] 终端告警服务去分行化
-
-## V0.2.5
-
-* [LocalMaintainDesktop] 添加重启浏览器的操作(针对业务卡住情况,谨慎使用)
-* [CenterSettings] 优化集中配置下载提示内容
-* [Healthmanager] 添加总行新模式升级的标识
-* [ResourceWatcher] CPU实时获取数据校准
-* 坐席回显帧率支持通过集中配置控制
-* 网络断连提示优化
-* 硬件实体错误码等信息告警同步
-* CMBPrint 支持运通卡卡bin(采用源码编译)
-* CPU实时获取监控校准
-* [BugFix] 修复准入不会每天自动更新密钥的问题
-
-## V0.2.4
-
-* [ResourceWatcher][BugFix] 添加屏幕分辨率的告警上传,后后续排查搜狗输入法位置显示异常的问题做参考
-* [AccessAuth] 微服务访问报域名解析失败时添加Dig诊断
-
-
-## V0.2.3
-
-* [BugFix] 使用CPPRestSDK库替换初始化/准入/集中配置/升级(灰度部分)的Http调用请求
-* [ResourceWatcher] 添加屏幕分辨率的告警上传,后后续排查搜狗输入法位置显示异常的问题做参考
-* [BugFix] [ResourceWatcher] 修复获取D2000芯片类型告警数据不全的问题
-* [BugFix][Chromium] 修复错误页重启时间错误的提示
-* [BugFix][Chromium] 调整AD页的打开顺序,修复错误页出现在副屏的问题
-* [BugFix][AccessAuth] 同步EventCode,处理准入报错(TimeSynTask)时不会重启的问题
-* [BugFix][SipPhone] 实体Lost时最后一条告警被冲的问题修复
-* [Feature] sogouime/2.6.1.1539 搜狗输入法版本更新
-
-
-## V0.2.2
-
-* [BugFix][AccessAuth]准入走总行调用分行句柄异常Lost
-* [BugFix][Initializer] 初始分行上送初始化结果异常Lost
-* [BugFix][CenterSetting] 生产集中配置地址配置错误
-* [BugFix] 输入版本号获取添加轮询次数
-* [BugFix][Healthmanager]操作系统版本号上传(之前因代码合并移除)
-* [BugFix][Healthmanager]修复将额外无效MAC地址和IP上传的缺陷
-* [Feature][ResourceWatcher] 支持无升级链条下的版本清理
-* [Feature][UpgradeManage]终端升级去分行化
-* [Feature] 安装向导支持Sogou输入法的卸载
-* [Feature] 通过本地维护桌面切换版本
-* [Feature][Debian] 安装支持对终端录入信息的校验(不吻合则告警)
-* [Feature][Debian] 安装完成后对安装版本告警的上传
-* [Feature][3rdParty] 搜狗输入法更新 2.6.0.9987
-* [Feature][3rdParty] 新版UOS浏览器安装包 uosbrowser_5.3.52-1
-* [Feature][Chromium] 兼容启动新版UOS浏览器
-
-
-## V0.2.1
-* 准入直接走总行,不再访问灰度
-* 集中配置添加下载集中配置失败的详细报错并告警
-* 健康实体开机首次启动时将等待时间延长至30s,并且可配置化
-* 回退使用浏览器组件3.0,尝试解决错误页出现在副屏,无法关闭错误页的问题
-
-## V0.2.0
-
-* 去分行化版本安装包(廖桂发)
-* 优化集中配置下载,将集中配置下载为总行(廖桂发)
-* [BugFix] 修复初始化实体中文返回为空的缺陷 (廖桂发)
-* 搜狗输入法更新 sogouime/2.6.0.9987 (廖桂发)
-
-## V0.1.9
-* 集中配置去分行化
-* 初始化实体去分行化
-* 准入实体去分行化
-* 上传去分行化
-
-
-## V0.1.8
-
-* 网络探测终端功能上线 (陈纪林)
-* 健康实体添加对连线实体重启事件的订阅(陈礼鹏)
-* SIP连线收发包告警(陈礼鹏)
-* 去除长城硬件厂商适配器相关内容(廖桂发)
-* 移除OSD程序文件以屏蔽桌面唤起的通知中心(廖桂发)
-* 添加非接读卡异常的告警
-* 解决座席端发送内容到终端乱码问题(廖桂发)
-* UOS浏览器启动添加额外参数,以去除各项Bubble提示(廖桂发)
-* 从悬浮图标进入本地维护桌面,添加菜单移除的提示(廖桂发)
-
-## V0.1.7
-
-* 全部更换为使用UOS自带浏览器打开业务页和广告页(廖桂发)
-* 支持通过本地维护界面控制广告的播放(陈礼鹏)
-* 支持通过本地维护界面清理浏览器缓存(廖桂发)
-* 调整CPU占用率和内存占用率的告警数据格式(陈纪林)
-
-## V0.1.6
-
-* 支持通过本地UOS浏览器打开业务页和广告页(廖桂发)
-* 临时下线播放广告功能(陈礼鹏),并在维护页面提供打开开关(廖桂发)
-* 细化CPU占用率和内存占用率高的进程信息(陈纪林)
-* 本地维护桌面优化重启搜狗输入法的操作(廖桂发)
-* 本地维护桌面添加对搜狗输入法版本的获取(廖桂发)
-
-## V0.1.5
-
-* 浏览器固定打开首页和广告页(陈良瑜)
-
-## V0.1.4
-
-* 优化媒体相关,同步Windows版本音量调节(陈礼鹏)
-* 支持本地配置适配器日志(廖桂发)
-* 支持终端号切换和业务链接切换(廖桂发)
-* 支持通过本地维护桌面重启搜狗输入法,备不时之需(廖桂发)
-
-## V0.1.3
-
-*上线时间:2021年12月2日*
-
-* 支持业务故障告警上送(陈良瑜)
-* 业务浏览器支持多Tab页面(陈纪林)
-* 添加搜狗输入法诊断信息打印(廖桂发)
-
-## V0.1.2
-
-* 修改编译脚本,直接生成更新安装包(廖桂发)
-* [mod_PinPad]密码键盘添加按键报错的报错日志(廖桂发)
-* T21HX401_运通卡改造相关上线(翟俊伟)
-* 优化媒体库,同步音量调节到信创版本(陈礼鹏)
-* [mod_Healthmanager]添加厂商信息告警上送(廖桂发)
-* [mod_Healthmanager]添加Gateway接口(廖桂发)
-* 框架支持UserCode字段传送到业务(廖桂发)
-
-## V0.1.1
-
-* 优化音频采集功能
-* 添加第一次开机启动告警
-* 添加CPU类型信息告警
-
-## V0.1.0
-
-* 实体集成终端安装功能上线
-* 修复业务提示音中断后后续不会再播放的缺陷
-
-## V0.0.12
-
-* [ResourceWatcher] 添加对搜狗输入法版本号和安装路径获取
-* [LocalMediaPlayer]优化实体出现Lost的异常问题
-
-## V0.0.11
-
-* [DeviceControl]简易离线桌面添加浏览器缓存清理操作
-* [DeviceControl]简易离线桌面添加搜狗输入法服务重启操作
-* [CardIssuser]调整回收箱满告警话术
-* [sipphone]连线过程音频设备增加告警信息
-* [sipphone]解决连线过程中音频引擎部分存在卡住问题
-* [ResourceWatcher] 启动时杀死dde-osd 进程,以此屏蔽右侧通知中心
-
-## V0.0.10
-* 升级告警状态上送(mod_UpgradeMgr/Run 实体合并4.9.0部分功能)(廖桂发)
-* 实体兼容上下摄像头根据设备名称识别(陈礼鹏)
-* 1031及以下版本支持恢复剪贴板(廖桂发)
-* 媒体优化图像渲染延迟问题(陈礼鹏)
-* 授权功能集不再更新指纹数据(翟俊伟)
-* 密码键盘添加验密告警码(廖桂发)
-* 物料维护乱码问题处理(廖桂发)
-* 密码键盘启动顺序前置(廖桂发)
-
-## V0.0.9
-
-* 填充终端系统信息上送字段(廖桂发)
-* 坐席连接创建和销毁添加告警日志(陈礼鹏)
-* 删除StructConfig文件夹,通过安装时从每个实体文件夹下拷贝到StructConfig,避免多份存留(廖桂发)
-
-## V0.0.8
-
-* 添加编译选项 UNDER_PRODUCT_ENV(廖桂发)
-* CommEntityUtili 公共文件添加 ShellExecute 接口用于获取Shell执行的返回内容(廖桂发)
-* 屏蔽掉TODO告警,污染日报数据(廖桂发)
-* 优化身份证实体读证期间的报错,徒增无效的告警(廖桂发)
-* 去除健康实体重复上送的终端信息,污染日报数据(廖桂发)
-* 媒体模块添加未释放文件关闭操作(陈礼鹏)
-
-## V0.0.7
-
-
-## V0.0.6
-
-* [Improve] 去除bin下面多余的文件(廖桂发,2021年8月20日)
-* T21FN361_(H)可视柜台国产化迁移改造功能优化迭代一期
-	* 可视柜台终端国产化媒体性能优化
-	* 业务浏览器支持特定字体渲染
-	* 高拍仪拍照限制大小
-	* 手势唤起常用功能菜单
-	* 修复试运行发现告警数据后台查看时乱码
-
-## V0.0.5-dev1
-* [Feature] 指纹比对后端项目 T21DR951
-* [Vendor] 科堡首次试运行版本
-
-## V0.0.4-dev1
-
-* 将依赖库的声明语句(Conan)全部迁移到 addin/cmake/DepencyConanFiles.cmake (廖桂发,何粤超,2021年5月10日)
-* 更新Module Other Tool 文件夹内容为 utf8,更新UOS的root.ini为UTF8,更新 DevAdapter/cmbsz 为utf8
-
-* 支持rvc/Audio的拷贝和打包(廖桂发,2020年12月30日)
-* 适应Jekins,添加WITH_CI_NUMBER宏标识(廖桂发,2020年12月22日)
-* 更新诗友给的CMPPrint.so(廖桂发,2020年12月11日)
-
-* 健康实体添加GPIO的启动,并修改Demo适配器保证接口调用成功(廖桂发,2020年12月8日)
-* 整合厂商的代码到码云和Conan,修改CMake脚本,做适应性改造(廖桂发,2020年12月8日)
-* 跟恒银要了GPIO的代码,因一期礼鹏的实体严重依赖GPIO,同时打开GPIO的编译(廖桂发,2020年12月8日)
-
-## V0.0.2-dev1
-
-* 所有要迁移改造的实体均添加到Module/CMakeLists.txt中,没达到100%的已注释(廖桂发,2020年12月2日)
-* 实体依赖无源码非外部厂商的共享库已经打包在`Misc/YYYY.MMDD.TT@LR04.02_ModuleDep/UOS`,新增需按照规则提交(廖桂发,2020年12月2日)
-
-* 添加 DevAdapter/res 文件夹,用于放置dep下的资源文件,如身份证的背景照片,该目录下的文件均会拷贝到dep下(廖桂发,2020年12月1日)
-* 添加5家厂商的测试 root.ini  文件并改动顶层CMakeLists.txt(廖桂发,2020年11月26日)
-* [cmake] 添加 PrecompiledHeader.cmake 用于 Windows 下预编译头文件(陈礼鹏,2020年11月14日)
-
-* 2020年9月16日:合并基于终端4.3.0的Module Other Tool 下的代码,以及DevAdapter部分的头文件
-* 基线分支为:[430_for_linux](http://mayun.itc.cmbchina.cn/QD_RemoteBankArea/LR04_RvcTerminal/tree/430_for_linux/)
-
-
-## V0.0.1-dev1
-
-* 2020-08-19: 将对框架的引用从全局引用的方式改成Target的方式调用
-

+ 2 - 1
DevAdapter/simulator/FingerPrint.1.1/FingerPrint_httpans.h

@@ -4,8 +4,9 @@
 typedef struct Image2FeatureAns {
     string lpbFeature;
     int iLength;
+    int bGenerateFile;
 
-    JSONCONVERT2OBJECT_MEMEBER_REGISTER(lpbFeature, iLength)
+    JSONCONVERT2OBJECT_MEMEBER_REGISTER(lpbFeature, iLength, bGenerateFile)
 }Image2FeatureAns;
 
 typedef struct Image2TemplateAns {

+ 40 - 4
DevAdapter/simulator/FingerPrint.1.1/FingerPrint_impl.cpp

@@ -98,10 +98,46 @@ ErrorCodeEnum FingerPrintImpl::Image2Feature(const char* imageName, LPBYTE lpbFe
 
 	if (err == Error_Succeed)
 	{
-		//imageName写入的文件,lpbFeature 特征码,iLength特征码长度
-		string imgName(imageName);
-		string imgPath = GetCurrentDirectory() + SPLIT_SLASH_STR + imgName;
-		writeFile(imgPath.c_str());
+		if (ans.bGenerateFile == 1) {
+			//imageName写入的文件,lpbFeature 特征码,iLength特征码长度
+			string imgName(imageName);
+			string imgPath = GetCurrentDirectory() + SPLIT_SLASH_STR + imgName;
+			writeFile(imgPath.c_str());
+		}
+		else if (ans.bGenerateFile == 2) {
+#ifdef _MSC_VER
+			char exePath[MAX_PATH] = { 0 };
+			if (GetModuleFileName(NULL, exePath, MAX_PATH) == 0) {
+				LOG4VTM(INFO, "Failed to get executable path.");
+				return Error_Interact;
+			}
+			char* lastSlash = strrchr(exePath, '\\');
+			if (lastSlash != NULL) {
+				*lastSlash = '\0';  // 将最后一个反斜杠替换为字符串终止符,得到目录路径
+			}
+			else {
+				LOG4VTM(INFO, "Executable path does not contain directory.");
+				return Error_Interact;
+			}
+			lastSlash = strrchr(exePath, '\\');
+			if (lastSlash != NULL) {
+				*lastSlash = '\0';  // 将最后一个反斜杠替换为字符串终止符,得到目录路径
+			}
+			else {
+				LOG4VTM(INFO, "Executable path does not contain directory2.");
+				return Error_Interact;
+			}
+			LOG4VTM(INFO, "path: " << exePath);
+
+			string imgName(imageName);
+			string newPath(exePath);
+			string imgPath = newPath + SPLIT_SLASH_STR + "dep" + SPLIT_SLASH_STR + imgName;
+			LOG4VTM(INFO, "dep path: " << imgPath);
+			writeFile(imgPath.c_str());
+#else
+			return Error_NotSupport;
+#endif
+		}
 
 #ifdef _MSC_VER
 		strcpy_s((char*)lpbFeature, 1024, ans.lpbFeature.c_str());

+ 0 - 4
Framework/spbase/SpBase.cpp

@@ -77,11 +77,7 @@ SpModule *GetSpModule()
 static LONG WINAPI SuppressError(struct _EXCEPTION_POINTERS* ExceptionInfo)
 {
 	//get active ver
-	char szIniPath[MAX_PATH] = { 0 };
 	sp_version_t active_version = { 0 };
-
-	auto rc = sp_dir_get_path(sp_get_env()->dir, SP_DIR_INSTALL_INI, NULL, szIniPath, MAX_PATH);
-	TOOLKIT_ASSERT(rc == 0);
 	sscanf(strrchr(sp_get_env()->dir->base_path, '\\') + 1, "%d.%d.%d.%d",
 		&active_version.major, &active_version.minor, &active_version.revision, &active_version.build);
 	

+ 1 - 0
Framework/spbase/SpFSM.cpp

@@ -283,6 +283,7 @@ ErrorCodeEnum FSMBase::ScheduleTimer(int iTimerId, unsigned int timeout)
 	FSMTimer *pos;
 	ListEntry_ForEach(pos, &m_timerlist, FSMTimer, entry) {
 		if (pos->iTimerId == iTimerId) {
+			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("ScheduleTimer Duplication");
 			return Error_Duplication;
 		}
 	}

+ 0 - 2
Module/CMakeLists.txt

@@ -163,7 +163,6 @@ add_subdirectory(mod_ScannerSet)
 add_subdirectory(mod_HSPScanner)
 add_subdirectory(mod_ContactlessCard)
 add_subdirectory(mod_gpio)
-add_subdirectory(mod_DeviceControl)
 #zhaohu
 add_subdirectory(mod_facetracking)
 #zhaohu
@@ -224,7 +223,6 @@ add_subdirectory(mod_ScannerSet)
 add_subdirectory(mod_HSPScanner)
 add_subdirectory(mod_ContactlessCard)
 add_subdirectory(mod_gpio)
-add_subdirectory(mod_DeviceControl)
 add_subdirectory(mod_facetracking)
 add_subdirectory(mod_initiativetransfer)
 add_subdirectory(mod_interactioncontext)

+ 2 - 2
Module/include/CommEntityUtil.hpp

@@ -115,7 +115,7 @@ namespace Module
 				SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
 				sprintf_s(temp, 22, "%d-%02d-%02d %02d:%02d:%02d",
 					stLocal.wYear, stLocal.wMonth, stLocal.wDay, stLocal.wHour, stLocal.wMinute, stLocal.wSecond);
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("OSStartTime: %s", temp);
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("OSStartTime: %s", temp);
 				systemBootTime.FromSystemTime(stLocal);
 				fSuc = TRUE;
 			}
@@ -160,7 +160,7 @@ namespace Module
 			systemTime.wMilliseconds = (WORD)(ticks % 1000);
 
 			systemBootTime.FromSystemTime(systemTime);
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("OSStartTime: %s", systemBootTime.ToTimeString().GetData());
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("OSStartTime: %s", systemBootTime.ToTimeString().GetData());
 			return TRUE;
 #endif //_MSC_VER
 		}

+ 0 - 8
Module/include/EventCode.h

@@ -469,18 +469,10 @@ ERROR_ACCESSAUTH_CONNECT_ACS_x}
 #define LOG_WARN_CONTACTLESS_CARD_FORGET_FETCH		(ContactlessCard_Public_Start + 4)
 #define LOG_ERR_CONTACTLESS_CARD_FAILED				(ContactlessCard_Public_Start + 5)
 
-#define LOG_DEVICECONTROL_SOGOU_SCRIPTS_NOT_EXISTS 0x21400007
-#define LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_SUCC 0x21400008
-#define LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_FAILED 0x21400009
-#define LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_TIMEOUT 0x2140000A
-
 //公有引用
 #define LOG_EVT_HSPS_LIGHT_ON 0x21700002
 #define LOG_EVT_HSPS_LIGHT_OFF 0x21700003
 
-//#define LOG_ERR_DEVICECONTROL_RESTART 0x21480001
-
-
 
 #define LOG_EVT_HEALTH_FIRST_ENTER_MAINPADE_FROM_HEALTH_START 0x50100002	//健康启动以来首次进首页
 #define LOG_WARN_HEALTH_INSTALL_FINISHED 0x50100004		//安装成功的标识

+ 0 - 29
Module/mod_DeviceControl/CMakeLists.txt

@@ -1,29 +0,0 @@
-define_module("DeviceControl")
-
-file(GLOB ${MODULE_PREFIX}_SRCS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
-    "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
-    "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp")
-
-set(MOD_VERSION_STRING "0.0.1-dev1")
-add_module_libraries(${MODULE_PREFIX} ${MODULE_NAME} ${MOD_VERSION_STRING})
-
-target_include_directories(${MODULE_NAME} PRIVATE
-	${DevHeadPath}
-    ${MODULE_BASE_DIR}/mod_gpio
-    ${OTHER_LIB_BASE_DIR}/libRestfulFunc
-)
-
-set(${MODULE_PREFIX}_LIBS ${MODULE_BASE_LIBS})
-if(MSVC)
-    list(APPEND ${MODULE_PREFIX}_LIBS Iphlpapi ws2_32)
-else()
-    list(APPEND ${MODULE_PREFIX}_LIBS RestfulFunc)
-endif(MSVC)
-target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})  
-
-target_include_directories(${MODULE_NAME} PRIVATE 
-${CMAKE_CURRENT_SOURCE_DIR}
-${MODULE_BASE_DIR}/mod_CenterSetting
-)
-
-deploy_module(${MODULE_PREFIX} ${MODULE_NAME})

+ 0 - 209
Module/mod_DeviceControl/DeviceControl.xml

@@ -1,209 +0,0 @@
-<?xml version="1.0" encoding="gb2312" ?>
-<entity name="DeviceControl">
-  
-	<class name="DeviceControlService" overlap="true" exclusive="false">
-		<twoway name="USB" overlap="true">
-			<req>
-				<param name="open" type="bool" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</req>
-			<res>
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</res>			
-		</twoway>
-		<twoway name="GetUkeyID" overlap="true">
-			<req>
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</req>
-			<res>
-				<param name="UkeyID" type="string" />
-				<param name="UkeyIDLen" type="int" />				
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</res>			
-		</twoway>
-		<twoway name="InitToken" overlap="true">
-			<req>
-				<param name="CertType" type="string" />
-				<param name="OldSuperPwd" type="string" />
-				<param name="UserName" type="string" />
-				<param name="UserIDType" type="string" />
-				<param name="UserIDNo" type="string" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</req>
-			<res>
-				<param name="TokenSn" type="string" />
-				<param name="PKCS10" type="string" />
-				<param name="Msg" type="string" />
-				<param name="TokenType" type="int" />
-				<param name="TokenSnLen" type="int" />
-				<param name="PKCS10Len" type="int" />
-				<param name="MsgLen" type="int" />	
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</res>			
-		</twoway>
-		<twoway name="QueryUSBStatus" overlap="true">
-			<req>
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</req>
-			<res>
-				<param name="flag" type="int" />			
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</res>			
-		</twoway>								
-		<twoway name="QueryHardwareInfo" overlap="true">
-			<req>
-			</req>
-			<res>
-				<param name="machineType" type="string" />
-				<param name="terminalNo" type="string" />
-				<param name="site" type="string" />
-				<param name="termLimit" type="string" />
-				<param name="termVersion" type="string" />
-				<param name="ip" type="array_string" />
-				<param name="mac" type="array_string" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</res>			
-		</twoway>
-		<twoway name="ReadCenterConfigStr" overlap="true">
-			<req>
-				<param name="entityName" type="string" />
-				<param name="key" type="string" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</req>
-			<res>
-				<param name="value" type="string" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</res>			
-		</twoway>
-		<twoway name="ReadConfigValue" overlap="true">
-			<req>
-				<!--0:Custom, 1:Config_Hardware,2:Config_Software, 3:Config_Run, 4:Config_Shell, 5:Config_Root, 6:Config_CenterSetting, 7:Config_Cache-->
-				<param name="configType" type="int" />
-				<param name="section" type="string" />
-				<!-- true: write; false: read -->
-				<param name="option" type="bool" />
-				<param name="key" type="string" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />				
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</req>
-			<res>
-				<param name="value" type="string" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />		
-				<param name="reserved3" type="string" />
-				<param name="reserved4" type="string" />
-			</res>			
-		</twoway>
-    <twoway name="TestConnectivity" overlap="true">
-      <req>
-        <!--1: ping;2:socket connect;3: telnet,4: http-->
-        <param name="protocol" type="int" />
-        <param name="ip" type="string" />
-        <param name="port" type="int" />
-        <param name="reserved1" type="int" />
-        <param name="reserved2" type="string" />
-      </req>
-      <res>
-        <param name="result" type="int" />
-        <param name="additionalMsg" type="string" />
-      </res>
-    </twoway>
-    <twoway name="GetVendorFileList" overlap="true">
-      <req>
-        <!--过滤信息是否从root.ini里借鉴,如果是则忽略掉后面的参数过滤-->
-        <param name="root" type="bool" />
-        <param name="adapter" type="string" />
-        <param name="vendor" type="string" />
-        <param name="version" type="string" />
-        <param name="batch" type="string" />
-      </req>
-      <res>
-        <param name="result" type="int" />
-        <param name="msg" type="string" />
-        <param name="filenames" type="array_string"/>
-        <!--0x1:exist; 0x2: root current config-->
-        <param name="status" type="array_int"/>
-        <param name="port" type="array_int"/>
-        <param name="baudrate" type="array_int" />
-        <param name="param1" type="array_string"/>
-        <param name="param2" type="array_string"/>
-
-      </res>
-    </twoway>
-    <twoway name="TestAdapterFileAvailable" overlap="true">
-      <req>
-        <!--默认在Dep下面,所以这里仅是文件名,根据文件名判断适配类型-->
-        <param name="filename" type="string" />
-        <param name="type" type="int" />
-        <param name="options" type="int" />
-        <param name="port" type="int"/>
-        <param name="baudrate" type="int" />
-        <param name="param1" type="int"/>
-        <param name="param2" type="int" />
-        <param name="param3" type="string" />
-        <param name="param4" type="string" />
-        <param name="param5" type="array_int" />
-        <param name="param6" type="array_string" />
-      </req>
-      <res>
-        <!--0x1: not exists; 0x2: load failed; 0x3: open failed-->
-        <param name="status" type="uint" />
-        <param name="msg" type="string" />
-        <param name="reserved1" type="array_int" />
-        <param name="reserved2" type="array_string"/>
-        <param name="reserved3" type="array_string"/>
-      </res>
-    </twoway>
-    <twoway name="GetDevInfo" overlap="true" method_id="65535">
-			<req>
-			</req>
-			<res>
-				<param name="type" type="string" />
-				<param name="model" type="string" />
-				<param name="version" type="string" />
-				<param name="state" type="int" />
-			</res>			
-		</twoway>													
-	</class>
-
-  <message name="AdapterTestResult">
-    <param name="result" type="int"/>
-    <param name="adapterInfo" type="string" />
-    <param name="errMsg" type="string" />
-  </message>
-</entity>

+ 0 - 224
Module/mod_DeviceControl/DeviceControlFSM.cpp

@@ -1,224 +0,0 @@
-#include "stdafx.h"
-#include "DeviceControlFSM.h"
-#include "EventCode.h"
-#include "fileutil.h"
-#include "toolkit.h"
-#include "osutil.h"
-#include "CommEntityUtil.hpp"
-
-
-ErrorCodeEnum CDeviceControlFSM::OnInit()
-{
-    LOG_FUNCTION();
-    return Error_Succeed;
-}
-
-
-ErrorCodeEnum CDeviceControlFSM::RestartSogouServices()
-{
-    LOG_FUNCTION();
-
-    ErrorCodeEnum result(Error_Succeed);
-
-    CSimpleStringA shellScriptPath;
-    GetEntityBase()->GetFunction()->GetPath("Base", shellScriptPath);
-    shellScriptPath += SPLIT_SLASH_STR;
-    shellScriptPath += "res" SPLIT_SLASH_STR "RunScript" SPLIT_SLASH_STR;
-
-    std::string startup_service(shellScriptPath.GetData());
-    startup_service += "startup_sogouservice.sh";
-    std::string shutdown_service(shellScriptPath.GetData());
-    shutdown_service += "shutdown_sogouservice.sh";
-
-    std::string shutdown_service_without_monitor(shellScriptPath.GetData());
-    shutdown_service_without_monitor += "shutdown_sogouservice_without_monitor.sh";
-
-    const BOOL s1 = ExistsFileA(startup_service.c_str());
-    const BOOL s2 = ExistsFileA(shutdown_service.c_str());
-    const BOOL s3 = ExistsFileA(shutdown_service_without_monitor.c_str());
-
-    if (s3) {
-        DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to shutdown sogou service except monitor...");
-        char* relate_processes[3] = { "sogouImeWebSrv", "sogouImeService", "sogoumonitor.sh" };
-        int count = 4;
-        alive_process_info old_processes[4];
-        memset(old_processes, 0, sizeof(old_processes));
-        osutil_detect_unique_app(relate_processes, array_size(relate_processes), &count, old_processes);
-
-        int sogouImeWebSrv_PID(0), sogouImeServicePID(0);
-
-        bool monitor_exist(false), other_exists(false);
-
-        /** ��Ϊ�ӿ���ʱ��ȡ���������е����ݣ�ֻ����ʱ���˽ӿ���Ϊ�ɹ� [Gifur@2022110]*/
-        monitor_exist = true;
-
-        for (int i = 0; i < count; ++i) {
-            if (strcmp(old_processes[i].name, relate_processes[2]) == 0) {
-                monitor_exist = true;
-            } else {
-                other_exists = true;
-            }
-            if (strcmp(old_processes[i].name, relate_processes[0]) == 0) {
-                sogouImeWebSrv_PID = old_processes[i].pid;
-            } else if (strcmp(old_processes[i].name, relate_processes[1]) == 0) {
-                sogouImeServicePID = old_processes[i].pid;
-            }
-        }
-
-        if (!monitor_exist) {
-            return Error_InvalidState;
-        } else if(!other_exists){
-            return Error_NotExist;
-        } else {
-
-            std::string succStr, errStr;
-            std::string runStr("bash ");
-            runStr += shutdown_service_without_monitor;
-            if (!SP::Module::Util::ShellExecute(runStr, succStr, errStr)) {
-                LogWarn(Severity_Middle, Error_Unexpect, LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_FAILED,
-                        CSimpleStringA::Format("%s: %s, %s", shutdown_service_without_monitor.c_str(), succStr.c_str(), errStr.c_str()));
-                return Error_Unexpect;
-            } else {
-                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("execute {%s} suc: %s", shutdown_service_without_monitor.c_str(), succStr.c_str());
-
-                /**�ȴ���������˳� */
-                Sleep(300);
-
-                /** Sogou�ļ໤����ÿ��5s�����ѹ������Ƿ���ڣ�����������Ϊʲô���Լ��������Ϊ�ѹ������������ͨ�û�Ȩ���� [Gifur@20211230]*/
-                const DWORD defaultInterval = 3000;
-                const int maxtIntervalTimes(3);
-                int intervalTimes(0);
-
-                char* relate_processes2[2] = { "sogouImeWebSrv", "sogouImeService" };
-                
-                bool succ_flag(false);
-                int sogouImeWebSrv_newPID(0), sogouImeService_newPID(0);
-
-                int count2 = 3;
-                alive_process_info new_processes[3];
-                memset(new_processes, 0, sizeof(new_processes));
-                osutil_detect_unique_app(relate_processes2, array_size(relate_processes2), &count2, new_processes);
-
-                do {
-
-                    if (count2 == 2/*normal process count*/) {
-                        int exit_flag(0);
-                        for (int i = 0; i < count2; ++i) {
-                            if (strcmp(new_processes[i].name, relate_processes2[0]) == 0 && sogouImeWebSrv_PID != new_processes[i].pid) {
-                                sogouImeWebSrv_newPID = new_processes[i].pid;
-                                exit_flag += 1;
-                            } else if (strcmp(new_processes[i].name, relate_processes2[1]) == 0 && sogouImeServicePID != new_processes[i].pid) {
-                                exit_flag += 1;
-                                sogouImeService_newPID = new_processes[i].pid;
-                            }
-                        }
-
-                        if (exit_flag == 2) {
-                            succ_flag = true;
-                            break;
-                        }
-                    }
-
-                    if (++intervalTimes >= maxtIntervalTimes) {
-                        break;
-                    }
-
-                    Sleep(defaultInterval);
-                    count2 = 3;
-                    memset(new_processes, 0, sizeof(new_processes));
-                    osutil_detect_unique_app(relate_processes2, array_size(relate_processes2), &count2, new_processes);
-
-                } while (true);
-
-                if (succ_flag) {
-                    LogWarn(Severity_Middle, Error_Debug, LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_SUCC,
-                            CSimpleStringA::Format("auto restart sogou services succ: WebSrv pid: %u, Service pid: %u", sogouImeWebSrv_newPID, sogouImeService_newPID));
-                    result = Error_Succeed;
-                } else {
-                    LogWarn(Severity_Middle, Error_TimeOut, LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_TIMEOUT, "wait sogou auto restart timeout");
-                    result = Error_TimeOut;
-                }
-            }
-        }
-    }
-
-    else if (s1 && s2) {
-
-        do {
-            std::string succStr, errStr;
-            std::string runStr("bash ");
-            runStr += shutdown_service;
-            if (!SP::Module::Util::ShellExecute(runStr, succStr, errStr)) {
-                LogWarn(Severity_Middle, Error_Unexpect, LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_FAILED,
-                        CSimpleStringA::Format("%s: %s, %s", shutdown_service.c_str(), succStr.c_str(), errStr.c_str()));
-                return Error_Unexpect;
-            } else {
-                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("execute {%s} suc: %s", shutdown_service.c_str(), succStr.c_str());
-            }
-        } while (false);
-
-        Sleep(3000);
-
-        do {
-            char app[MAX_PATH] = { '\0' };
-            tk_process_t* process = NULL;
-            tk_process_option_t option;
-            option.exit_cb = NULL;
-            option.file = NULL;
-            option.flags = 0;
-
-            sprintf(app, "bash %s", startup_service.c_str());
-            option.params = app;
-
-            const int res = process_spawn(&option, &process);
-            if (0 == res) {
-                FREE(process);
-                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("execute {%s} suc", startup_service.c_str());
-            } else {
-                LogWarn(Severity_Middle, Error_Unexpect, LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_FAILED,
-                        CSimpleStringA::Format("%s: %d", startup_service.c_str(), res));
-                return Error_Unexpect;
-            }
-
-        } while (false);
-
-        LogWarn(Severity_Middle, Error_Unexpect, LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_SUCC, "sogou restart succ.");
-
-    } else {
-
-        LogWarn(Severity_Middle, Error_NotExist, LOG_DEVICECONTROL_SOGOU_SCRIPTS_NOT_EXISTS,
-                CSimpleStringA::Format("%s=%d, %s=%d", startup_service.c_str(), s1, shutdown_service.c_str(), s2));
-        result = Error_NotExist;
-    }
-
-    return result;
-}
-
-ErrorCodeEnum CDeviceControlFSM::OnExit()
-{
-    return Error_Succeed;
-}
-
-unsigned int CDeviceControlFSM::s0_on_event(FSMEvent* pEvt)
-{
-    DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s0 event %d,%d", pEvt->iEvt, pEvt->param1);
-    return 0;
-}
-
-unsigned int CDeviceControlFSM::s1_on_event(FSMEvent* pEvt)
-{
-    DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s1 %d,%d", pEvt->iEvt, pEvt->param1);
-    return 0;
-}
-
-unsigned int CDeviceControlFSM::s3_on_event(FSMEvent* pEvt)
-{
-    DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s3 %d,%d", pEvt->iEvt, pEvt->param1);
-    return 0;
-}
-
-unsigned int CDeviceControlFSM::s4_on_event(FSMEvent* pEvt)
-{
-    DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s4 %d,%d", pEvt->iEvt, pEvt->param1);
-    return 0;
-}

+ 0 - 100
Module/mod_DeviceControl/DeviceControlFSM.h

@@ -1,100 +0,0 @@
-#ifndef _DEVICE_CONTROL_FSM_H
-#define _DEVICE_CONTROL_FSM_H
-
-#pragma once
-
-#include "stdafx.h"
-#include "SpFSM.h"
-
-#include "DeviceControl_def_g.h"
-#include "DeviceControl_server_g.h"
-#include "DeviceControlClass.h"
-#include "DevFSMCommBase.hpp"
-
-#include "Interface.h"
-
-using namespace DeviceControl;
-
-enum EvtType
-{
-	USER_EVT_TEST = EVT_USER+1,
-	USER_EVT_QUIT,
-	USER_EVT_USB,
-	USER_EVT_USB_FINISHED,
-	USER_EVT_GET_UKEYID,
-	USER_EVT_GET_UKEYID_FINISHED,
-	USER_EVT_INIT_TOKEN,
-	USER_EVT_INIT_TOKEN_FINISHED,
-	USER_EVT_QUERY_USB,
-	USER_EVT_QUERY_USB_FINISHED,
-	USER_EVT_WORKING_OP,
-
-};
-
-class CDeviceControlFSM : public CCommDevFSM<CDeviceControlFSM, DeviceControlClass>
-{
-public:
-	enum {s0,s1,s2,s3,s4};
-
-	BEGIN_FSM_STATE(CDeviceControlFSM)
-		FSM_STATE_ENTRY(s0,"Idle",s0_on_entry,s0_on_exit,s0_on_event)
-		FSM_STATE_ENTRY(s1,"USB",s1_on_entry,s1_on_exit,s1_on_event)
-		FSM_STATE_ENTRY(s2,"Failed",s2_on_entry,s2_on_exit,s2_on_event)
-		FSM_STATE_ENTRY(s3,"GetUkeyID",s3_on_entry,s3_on_exit,s3_on_event)
-		FSM_STATE_ENTRY(s4,"InitToken",s4_on_entry,s4_on_exit,s4_on_event)
-		END_FSM_STATE()
-
-		BEGIN_FSM_RULE(CDeviceControlFSM, s0)
-		FSM_RULE_ENTRY(s0, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
-		FSM_RULE_ENTRY(s0, s1, USER_EVT_USB, 0)
-		FSM_RULE_ENTRY(s0, s1, USER_EVT_QUERY_USB, 0)
-		FSM_RULE_ENTRY(s0, s3, USER_EVT_GET_UKEYID, 0)
-		FSM_RULE_ENTRY(s0, s4, USER_EVT_INIT_TOKEN, 0)
-		FSM_RULE_ENTRY(s1, s0, USER_EVT_USB_FINISHED, 0)
-		FSM_RULE_ENTRY(s1, s2, USER_EVT_USB_FINISHED, 1)
-		FSM_RULE_ENTRY(s1, s0, USER_EVT_QUERY_USB_FINISHED, 0)
-		FSM_RULE_ENTRY(s1, s2, USER_EVT_QUERY_USB_FINISHED, 1)
-		FSM_RULE_ENTRY(s3, s0, USER_EVT_GET_UKEYID_FINISHED, 0)
-		FSM_RULE_ENTRY(s3, s0, USER_EVT_GET_UKEYID_FINISHED, 1)
-		FSM_RULE_ENTRY(s4, s0, USER_EVT_INIT_TOKEN_FINISHED, 0)
-		FSM_RULE_ENTRY(s4, s0, USER_EVT_INIT_TOKEN_FINISHED, 1)
-		END_FSM_RULE()
-
-		CDeviceControlFSM():m_testResult(Error_Succeed){};
-	virtual ~CDeviceControlFSM() {};
-
-	virtual ErrorCodeEnum OnInit();
-	virtual ErrorCodeEnum OnExit();
-
-	virtual void s0_on_entry() {}
-	virtual void s0_on_exit() {}
-	virtual unsigned int s0_on_event(FSMEvent* e);
-
-	virtual void s1_on_entry() {}
-	virtual void s1_on_exit() {}
-	virtual unsigned int s1_on_event(FSMEvent* e);
-
-	virtual void s2_on_entry() {}
-	virtual void s2_on_exit() {}
-	virtual unsigned int s2_on_event(FSMEvent* e) { return 0; }
-
-	virtual void s3_on_entry() {}
-	virtual void s3_on_exit() {}
-	virtual unsigned int s3_on_event(FSMEvent* e);
-
-	virtual void s4_on_entry() {}
-	virtual void s4_on_exit() {}
-	virtual unsigned int s4_on_event(FSMEvent* e);
-
-	void SelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext)
-	{
-		pTransactionContext->SendAnswer(Error_Succeed);
-	}
-	ErrorCodeEnum RestartSogouServices();
-	
-private:
-	ErrorCodeEnum m_testResult;
-	CSimpleStringA m_csMachineType;
-};
-
-#endif //_DEVICE_CONTROL_FSM_H

+ 0 - 619
Module/mod_DeviceControl/DeviceControl_client_g.h

@@ -1,619 +0,0 @@
-
-#ifndef __DEVICECONTROL_CLIENT_G_H
-#define __DEVICECONTROL_CLIENT_G_H
-
-#pragma once
-
-// This code is generated by spgen tool!
-
-#include "DeviceControl_def_g.h"
-
-namespace DeviceControl {
-class DeviceControlService_ClientBase : public CClientSessionBase {
-public:
-	explicit DeviceControlService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {}
-
-	DeviceControlService_ClientBase* operator () (const linkContext &curLink) 
-	{
-		m_context = curLink;
-		return this;
-	}
-
-protected:
-	virtual ~DeviceControlService_ClientBase()
-	{
-		/// override by user
-	}
-public:
-
-	void OnConnectSucceed()
-	{
-		bSessionClosed = false;
-	}
-	void OnClose(ErrorCodeEnum)
-	{
-		bSessionClosed = true;
-	}
-	bool QuerySessionClosed()
-	{
-		return bSessionClosed;
-	}
-	ErrorCodeEnum Connect(CSmartPointer<IAsynWaitSp> &spAsyncWait)
-	{
-		CSmartPointer<IEntityFunction> pFunc = m_pEntityBase->GetFunction();
-		ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "DeviceControl", "DeviceControlService", spAsyncWait);
-		if (Error == Error_Succeed) {
-			m_bSysManaged = true;
-			bSessionClosed = false;
-		}
-		return Error;
-	}
-	ErrorCodeEnum Connect()
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = Connect(spAsyncWait);
-		if (Error == Error_Succeed) {
-			Error = spAsyncWait->WaitAnswer();
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum USB(DeviceControlService_USB_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_USB, DeviceControlService_MethodSignature_USB, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum USB(DeviceControlService_USB_Req &Req, DeviceControlService_USB_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = USB(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum USB(DeviceControlService_USB_Req &Req, DeviceControlService_USB_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = USB(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum USB(DeviceControlService_USB_Req &Req, DeviceControlService_USB_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = USB(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum GetUkeyID(DeviceControlService_GetUkeyID_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_GetUkeyID, DeviceControlService_MethodSignature_GetUkeyID, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum GetUkeyID(DeviceControlService_GetUkeyID_Req &Req, DeviceControlService_GetUkeyID_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetUkeyID(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetUkeyID(DeviceControlService_GetUkeyID_Req &Req, DeviceControlService_GetUkeyID_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetUkeyID(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetUkeyID(DeviceControlService_GetUkeyID_Req &Req, DeviceControlService_GetUkeyID_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetUkeyID(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum InitToken(DeviceControlService_InitToken_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_InitToken, DeviceControlService_MethodSignature_InitToken, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum InitToken(DeviceControlService_InitToken_Req &Req, DeviceControlService_InitToken_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = InitToken(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum InitToken(DeviceControlService_InitToken_Req &Req, DeviceControlService_InitToken_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = InitToken(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum InitToken(DeviceControlService_InitToken_Req &Req, DeviceControlService_InitToken_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = InitToken(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum QueryUSBStatus(DeviceControlService_QueryUSBStatus_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_QueryUSBStatus, DeviceControlService_MethodSignature_QueryUSBStatus, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum QueryUSBStatus(DeviceControlService_QueryUSBStatus_Req &Req, DeviceControlService_QueryUSBStatus_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = QueryUSBStatus(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum QueryUSBStatus(DeviceControlService_QueryUSBStatus_Req &Req, DeviceControlService_QueryUSBStatus_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = QueryUSBStatus(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum QueryUSBStatus(DeviceControlService_QueryUSBStatus_Req &Req, DeviceControlService_QueryUSBStatus_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = QueryUSBStatus(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum QueryHardwareInfo(DeviceControlService_QueryHardwareInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_QueryHardwareInfo, DeviceControlService_MethodSignature_QueryHardwareInfo, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum QueryHardwareInfo(DeviceControlService_QueryHardwareInfo_Req &Req, DeviceControlService_QueryHardwareInfo_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = QueryHardwareInfo(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum QueryHardwareInfo(DeviceControlService_QueryHardwareInfo_Req &Req, DeviceControlService_QueryHardwareInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = QueryHardwareInfo(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum QueryHardwareInfo(DeviceControlService_QueryHardwareInfo_Req &Req, DeviceControlService_QueryHardwareInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = QueryHardwareInfo(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum ReadCenterConfigStr(DeviceControlService_ReadCenterConfigStr_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_ReadCenterConfigStr, DeviceControlService_MethodSignature_ReadCenterConfigStr, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum ReadCenterConfigStr(DeviceControlService_ReadCenterConfigStr_Req &Req, DeviceControlService_ReadCenterConfigStr_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ReadCenterConfigStr(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum ReadCenterConfigStr(DeviceControlService_ReadCenterConfigStr_Req &Req, DeviceControlService_ReadCenterConfigStr_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ReadCenterConfigStr(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum ReadCenterConfigStr(DeviceControlService_ReadCenterConfigStr_Req &Req, DeviceControlService_ReadCenterConfigStr_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ReadCenterConfigStr(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum ReadConfigValue(DeviceControlService_ReadConfigValue_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_ReadConfigValue, DeviceControlService_MethodSignature_ReadConfigValue, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum ReadConfigValue(DeviceControlService_ReadConfigValue_Req &Req, DeviceControlService_ReadConfigValue_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ReadConfigValue(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum ReadConfigValue(DeviceControlService_ReadConfigValue_Req &Req, DeviceControlService_ReadConfigValue_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ReadConfigValue(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum ReadConfigValue(DeviceControlService_ReadConfigValue_Req &Req, DeviceControlService_ReadConfigValue_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ReadConfigValue(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum TestConnectivity(DeviceControlService_TestConnectivity_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_TestConnectivity, DeviceControlService_MethodSignature_TestConnectivity, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum TestConnectivity(DeviceControlService_TestConnectivity_Req &Req, DeviceControlService_TestConnectivity_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TestConnectivity(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum TestConnectivity(DeviceControlService_TestConnectivity_Req &Req, DeviceControlService_TestConnectivity_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TestConnectivity(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum TestConnectivity(DeviceControlService_TestConnectivity_Req &Req, DeviceControlService_TestConnectivity_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TestConnectivity(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum GetVendorFileList(DeviceControlService_GetVendorFileList_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_GetVendorFileList, DeviceControlService_MethodSignature_GetVendorFileList, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum GetVendorFileList(DeviceControlService_GetVendorFileList_Req &Req, DeviceControlService_GetVendorFileList_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVendorFileList(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetVendorFileList(DeviceControlService_GetVendorFileList_Req &Req, DeviceControlService_GetVendorFileList_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVendorFileList(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetVendorFileList(DeviceControlService_GetVendorFileList_Req &Req, DeviceControlService_GetVendorFileList_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetVendorFileList(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum TestAdapterFileAvailable(DeviceControlService_TestAdapterFileAvailable_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_TestAdapterFileAvailable, DeviceControlService_MethodSignature_TestAdapterFileAvailable, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum TestAdapterFileAvailable(DeviceControlService_TestAdapterFileAvailable_Req &Req, DeviceControlService_TestAdapterFileAvailable_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TestAdapterFileAvailable(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum TestAdapterFileAvailable(DeviceControlService_TestAdapterFileAvailable_Req &Req, DeviceControlService_TestAdapterFileAvailable_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TestAdapterFileAvailable(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum TestAdapterFileAvailable(DeviceControlService_TestAdapterFileAvailable_Req &Req, DeviceControlService_TestAdapterFileAvailable_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = TestAdapterFileAvailable(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum GetDevInfo(DeviceControlService_GetDevInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(DeviceControlService_Method_GetDevInfo, DeviceControlService_MethodSignature_GetDevInfo, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum GetDevInfo(DeviceControlService_GetDevInfo_Req &Req, DeviceControlService_GetDevInfo_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetDevInfo(DeviceControlService_GetDevInfo_Req &Req, DeviceControlService_GetDevInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetDevInfo(DeviceControlService_GetDevInfo_Req &Req, DeviceControlService_GetDevInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetDevInfo(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-
-	bool SafeDelete()
-	{
-		if (!m_bSysManaged) {
-			delete this;
-		}
-		return m_bSysManaged;
-	}
-
-protected:
-	bool m_bSysManaged;
-	CEntityBase *m_pEntityBase;
-	linkContext m_context;
-	bool bSessionClosed;
-};
-
-///////////////////////////
-
-} // namespace DeviceControl
-#endif // __DEVICECONTROL_CLIENT_G_H

+ 0 - 397
Module/mod_DeviceControl/DeviceControl_def_g.h

@@ -1,397 +0,0 @@
-#ifndef __DEVICECONTROL_DEF_G_H
-#define __DEVICECONTROL_DEF_G_H
-
-#pragma once
-
-// This code is generated by spgen tool!
-
-#include "SpHelper.h"
-
-namespace DeviceControl {
-//
-// const goes here
-//
-
-#define DeviceControlService_Method_USB 0
-#define DeviceControlService_Method_GetUkeyID 1
-#define DeviceControlService_Method_InitToken 2
-#define DeviceControlService_Method_QueryUSBStatus 3
-#define DeviceControlService_Method_QueryHardwareInfo 4
-#define DeviceControlService_Method_ReadCenterConfigStr 5
-#define DeviceControlService_Method_ReadConfigValue 6
-#define DeviceControlService_Method_TestConnectivity 7
-#define DeviceControlService_Method_GetVendorFileList 8
-#define DeviceControlService_Method_TestAdapterFileAvailable 9
-#define DeviceControlService_Method_GetDevInfo 65535
-
-#define DeviceControlService_MethodSignature_USB 109707598
-#define DeviceControlService_MethodSignature_GetUkeyID -339019147
-#define DeviceControlService_MethodSignature_InitToken 2087976810
-#define DeviceControlService_MethodSignature_QueryUSBStatus -1166010722
-#define DeviceControlService_MethodSignature_QueryHardwareInfo 1706767096
-#define DeviceControlService_MethodSignature_ReadCenterConfigStr -673154017
-#define DeviceControlService_MethodSignature_ReadConfigValue 730234720
-#define DeviceControlService_MethodSignature_TestConnectivity -42627632
-#define DeviceControlService_MethodSignature_GetVendorFileList 1902033390
-#define DeviceControlService_MethodSignature_TestAdapterFileAvailable 1059104594
-#define DeviceControlService_MethodSignature_GetDevInfo 296205965
-
-#define DeviceControlService_LogCode_USB "QLR040221400"
-#define DeviceControlService_LogCode_GetUkeyID "QLR040221401"
-#define DeviceControlService_LogCode_InitToken "QLR040221402"
-#define DeviceControlService_LogCode_QueryUSBStatus "QLR040221403"
-#define DeviceControlService_LogCode_QueryHardwareInfo "QLR040221404"
-#define DeviceControlService_LogCode_ReadCenterConfigStr "QLR040221405"
-#define DeviceControlService_LogCode_ReadConfigValue "QLR040221406"
-#define DeviceControlService_LogCode_TestConnectivity "QLR040221407"
-#define DeviceControlService_LogCode_GetVendorFileList "QLR040221408"
-#define DeviceControlService_LogCode_TestAdapterFileAvailable "QLR040221409"
-#define DeviceControlService_LogCode_GetDevInfo "QLR040221499"
-
-struct DeviceControlService_USB_Req
-{
-	bool open;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & open & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_USB_Ans
-{
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_GetUkeyID_Req
-{
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_GetUkeyID_Ans
-{
-	CSimpleStringA UkeyID;
-	int UkeyIDLen;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & UkeyID & UkeyIDLen & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_InitToken_Req
-{
-	CSimpleStringA CertType;
-	CSimpleStringA OldSuperPwd;
-	CSimpleStringA UserName;
-	CSimpleStringA UserIDType;
-	CSimpleStringA UserIDNo;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & CertType & OldSuperPwd & UserName & UserIDType & UserIDNo & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_InitToken_Ans
-{
-	CSimpleStringA TokenSn;
-	CSimpleStringA PKCS10;
-	CSimpleStringA Msg;
-	int TokenType;
-	int TokenSnLen;
-	int PKCS10Len;
-	int MsgLen;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & TokenSn & PKCS10 & Msg & TokenType & TokenSnLen & PKCS10Len & MsgLen & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_QueryUSBStatus_Req
-{
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_QueryUSBStatus_Ans
-{
-	int flag;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & flag & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_QueryHardwareInfo_Req
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct DeviceControlService_QueryHardwareInfo_Ans
-{
-	CSimpleStringA machineType;
-	CSimpleStringA terminalNo;
-	CSimpleStringA site;
-	CSimpleStringA termLimit;
-	CSimpleStringA termVersion;
-	CAutoArray<CSimpleStringA> ip;
-	CAutoArray<CSimpleStringA> mac;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & machineType & terminalNo & site & termLimit & termVersion & ip & mac & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_ReadCenterConfigStr_Req
-{
-	CSimpleStringA entityName;
-	CSimpleStringA key;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & entityName & key & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_ReadCenterConfigStr_Ans
-{
-	CSimpleStringA value;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & value & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_ReadConfigValue_Req
-{
-	int configType;
-	CSimpleStringA section;
-	bool option;
-	CSimpleStringA key;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & configType & section & option & key & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_ReadConfigValue_Ans
-{
-	CSimpleStringA value;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserved3;
-	CSimpleStringA reserved4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & value & reserved1 & reserved2 & reserved3 & reserved4;
-	}
-
-};
-
-struct DeviceControlService_TestConnectivity_Req
-{
-	int protocol;
-	CSimpleStringA ip;
-	int port;
-	int reserved1;
-	CSimpleStringA reserved2;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & protocol & ip & port & reserved1 & reserved2;
-	}
-
-};
-
-struct DeviceControlService_TestConnectivity_Ans
-{
-	int result;
-	CSimpleStringA additionalMsg;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & result & additionalMsg;
-	}
-
-};
-
-struct DeviceControlService_GetVendorFileList_Req
-{
-	bool root;
-	CSimpleStringA adapter;
-	CSimpleStringA vendor;
-	CSimpleStringA version;
-	CSimpleStringA batch;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & root & adapter & vendor & version & batch;
-	}
-
-};
-
-struct DeviceControlService_GetVendorFileList_Ans
-{
-	int result;
-	CSimpleStringA msg;
-	CAutoArray<CSimpleStringA> filenames;
-	CAutoArray<int> status;
-	CAutoArray<int> port;
-	CAutoArray<int> baudrate;
-	CAutoArray<CSimpleStringA> param1;
-	CAutoArray<CSimpleStringA> param2;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & result & msg & filenames & status & port & baudrate & param1 & param2;
-	}
-
-};
-
-struct DeviceControlService_TestAdapterFileAvailable_Req
-{
-	CSimpleStringA filename;
-	int type;
-	int options;
-	int port;
-	int baudrate;
-	int param1;
-	int param2;
-	CSimpleStringA param3;
-	CSimpleStringA param4;
-	CAutoArray<int> param5;
-	CAutoArray<CSimpleStringA> param6;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & filename & type & options & port & baudrate & param1 & param2 & param3 & param4 & param5 & param6;
-	}
-
-};
-
-struct DeviceControlService_TestAdapterFileAvailable_Ans
-{
-	unsigned int status;
-	CSimpleStringA msg;
-	CAutoArray<int> reserved1;
-	CAutoArray<CSimpleStringA> reserved2;
-	CAutoArray<CSimpleStringA> reserved3;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & status & msg & reserved1 & reserved2 & reserved3;
-	}
-
-};
-
-struct DeviceControlService_GetDevInfo_Req
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct DeviceControlService_GetDevInfo_Ans
-{
-	CSimpleStringA type;
-	CSimpleStringA model;
-	CSimpleStringA version;
-	int state;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & type & model & version & state;
-	}
-
-};
-
-
-///////////////////////////
-
-} // namespace DeviceControl
-
-#endif // __DEVICECONTROL_DEF_G_H

+ 0 - 32
Module/mod_DeviceControl/DeviceControl_msg_g.h

@@ -1,32 +0,0 @@
-
-#ifndef __DEVICECONTROL_MSG_G_H
-#define __DEVICECONTROL_MSG_G_H
-
-#pragma once
-
-// This code is generated by spgen tool!
-
-#include "SpHelper.h"
-
-namespace DeviceControl {
-#define eMsg_AdapterTestResult 0
-
-#define eMsgSig_AdapterTestResult -208286610
-
-struct AdapterTestResult
-{
-	int result;
-	CSimpleStringA adapterInfo;
-	CSimpleStringA errMsg;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & result & adapterInfo & errMsg;
-	}
-
-};
-
-///////////////////////////
-
-} // namespace DeviceControl
-#endif // __DEVICECONTROL_MSG_G_H

+ 0 - 380
Module/mod_DeviceControl/DeviceControl_server_g.h

@@ -1,380 +0,0 @@
-
-#ifndef __DEVICECONTROL_SERVER_G_H
-#define __DEVICECONTROL_SERVER_G_H
-
-#pragma once
-
-// This code is generated by spgen tool!
-
-#include "DeviceControl_def_g.h"
-
-namespace DeviceControl {
-class DeviceControlService_ServerSessionBase : public CServerSessionBase
-{
-public:
-	DeviceControlService_ServerSessionBase()
-	{
-		/// override by user
-	}
-
-	virtual ~DeviceControlService_ServerSessionBase()
-	{
-		/// override by user
-	}
-
-	virtual bool IsExclusive() { return false; }
-
-	virtual bool IsSessionOverlap() { return true; }
-
-	virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
-	{
-		ErrorCodeEnum Error = Error_Succeed;
-		switch (dwMessageID) {
-		case DeviceControlService_Method_USB:
-			if (dwSignature == DeviceControlService_MethodSignature_USB) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_GetUkeyID:
-			if (dwSignature == DeviceControlService_MethodSignature_GetUkeyID) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_InitToken:
-			if (dwSignature == DeviceControlService_MethodSignature_InitToken) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_QueryUSBStatus:
-			if (dwSignature == DeviceControlService_MethodSignature_QueryUSBStatus) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_QueryHardwareInfo:
-			if (dwSignature == DeviceControlService_MethodSignature_QueryHardwareInfo) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_ReadCenterConfigStr:
-			if (dwSignature == DeviceControlService_MethodSignature_ReadCenterConfigStr) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_ReadConfigValue:
-			if (dwSignature == DeviceControlService_MethodSignature_ReadConfigValue) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_TestConnectivity:
-			if (dwSignature == DeviceControlService_MethodSignature_TestConnectivity) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_GetVendorFileList:
-			if (dwSignature == DeviceControlService_MethodSignature_GetVendorFileList) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_TestAdapterFileAvailable:
-			if (dwSignature == DeviceControlService_MethodSignature_TestAdapterFileAvailable) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_GetDevInfo:
-			if (dwSignature == DeviceControlService_MethodSignature_GetDevInfo) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		default:
-			Error = Error_MethodNotFound;
-			break;
-		}
-		return Error;
-	}
-
-	int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
-	{
-		ErrorCodeEnum Error = Error_Succeed;
-		switch (dwMessageID) {
-		case DeviceControlService_Method_USB:
-			if (dwSignature != DeviceControlService_MethodSignature_USB) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_GetUkeyID:
-			if (dwSignature != DeviceControlService_MethodSignature_GetUkeyID) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_InitToken:
-			if (dwSignature != DeviceControlService_MethodSignature_InitToken) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_QueryUSBStatus:
-			if (dwSignature != DeviceControlService_MethodSignature_QueryUSBStatus) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_QueryHardwareInfo:
-			if (dwSignature != DeviceControlService_MethodSignature_QueryHardwareInfo) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_ReadCenterConfigStr:
-			if (dwSignature != DeviceControlService_MethodSignature_ReadCenterConfigStr) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_ReadConfigValue:
-			if (dwSignature != DeviceControlService_MethodSignature_ReadConfigValue) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_TestConnectivity:
-			if (dwSignature != DeviceControlService_MethodSignature_TestConnectivity) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_GetVendorFileList:
-			if (dwSignature != DeviceControlService_MethodSignature_GetVendorFileList) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_TestAdapterFileAvailable:
-			if (dwSignature != DeviceControlService_MethodSignature_TestAdapterFileAvailable) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case DeviceControlService_Method_GetDevInfo:
-			if (dwSignature != DeviceControlService_MethodSignature_GetDevInfo) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		default:
-			Error = Error_MethodNotFound;
-			break;
-		}
-		return Error;
-	}
-
-	virtual void Handle_USB(SpReqAnsContext<DeviceControlService_USB_Req, DeviceControlService_USB_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_GetUkeyID(SpReqAnsContext<DeviceControlService_GetUkeyID_Req, DeviceControlService_GetUkeyID_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_InitToken(SpReqAnsContext<DeviceControlService_InitToken_Req, DeviceControlService_InitToken_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_QueryUSBStatus(SpReqAnsContext<DeviceControlService_QueryUSBStatus_Req, DeviceControlService_QueryUSBStatus_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_QueryHardwareInfo(SpReqAnsContext<DeviceControlService_QueryHardwareInfo_Req, DeviceControlService_QueryHardwareInfo_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_ReadCenterConfigStr(SpReqAnsContext<DeviceControlService_ReadCenterConfigStr_Req, DeviceControlService_ReadCenterConfigStr_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_ReadConfigValue(SpReqAnsContext<DeviceControlService_ReadConfigValue_Req, DeviceControlService_ReadConfigValue_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_TestConnectivity(SpReqAnsContext<DeviceControlService_TestConnectivity_Req, DeviceControlService_TestConnectivity_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_GetVendorFileList(SpReqAnsContext<DeviceControlService_GetVendorFileList_Req, DeviceControlService_GetVendorFileList_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_TestAdapterFileAvailable(SpReqAnsContext<DeviceControlService_TestAdapterFileAvailable_Req, DeviceControlService_TestAdapterFileAvailable_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_GetDevInfo(SpReqAnsContext<DeviceControlService_GetDevInfo_Req, DeviceControlService_GetDevInfo_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
-	{
-		CAutoBuffer Buf;
-		DWORD dwMessageID;
-		DWORD dwMessageSignature;
-		ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
-		if (Error == Error_Succeed) {
-#ifdef DEBUG
-			assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
-#else
-			if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
-				pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
-				return;
-			}
-#endif
-			switch (dwMessageID) {
-				case DeviceControlService_Method_USB:
-					{
-						SpReqAnsContext<DeviceControlService_USB_Req,DeviceControlService_USB_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_USB_Req,DeviceControlService_USB_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_USB(ctx);
-					}
-					break;
-				case DeviceControlService_Method_GetUkeyID:
-					{
-						SpReqAnsContext<DeviceControlService_GetUkeyID_Req,DeviceControlService_GetUkeyID_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_GetUkeyID_Req,DeviceControlService_GetUkeyID_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_GetUkeyID(ctx);
-					}
-					break;
-				case DeviceControlService_Method_InitToken:
-					{
-						SpReqAnsContext<DeviceControlService_InitToken_Req,DeviceControlService_InitToken_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_InitToken_Req,DeviceControlService_InitToken_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_InitToken(ctx);
-					}
-					break;
-				case DeviceControlService_Method_QueryUSBStatus:
-					{
-						SpReqAnsContext<DeviceControlService_QueryUSBStatus_Req,DeviceControlService_QueryUSBStatus_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_QueryUSBStatus_Req,DeviceControlService_QueryUSBStatus_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_QueryUSBStatus(ctx);
-					}
-					break;
-				case DeviceControlService_Method_QueryHardwareInfo:
-					{
-						SpReqAnsContext<DeviceControlService_QueryHardwareInfo_Req,DeviceControlService_QueryHardwareInfo_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_QueryHardwareInfo_Req,DeviceControlService_QueryHardwareInfo_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_QueryHardwareInfo(ctx);
-					}
-					break;
-				case DeviceControlService_Method_ReadCenterConfigStr:
-					{
-						SpReqAnsContext<DeviceControlService_ReadCenterConfigStr_Req,DeviceControlService_ReadCenterConfigStr_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_ReadCenterConfigStr_Req,DeviceControlService_ReadCenterConfigStr_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_ReadCenterConfigStr(ctx);
-					}
-					break;
-				case DeviceControlService_Method_ReadConfigValue:
-					{
-						SpReqAnsContext<DeviceControlService_ReadConfigValue_Req,DeviceControlService_ReadConfigValue_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_ReadConfigValue_Req,DeviceControlService_ReadConfigValue_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_ReadConfigValue(ctx);
-					}
-					break;
-				case DeviceControlService_Method_TestConnectivity:
-					{
-						SpReqAnsContext<DeviceControlService_TestConnectivity_Req,DeviceControlService_TestConnectivity_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_TestConnectivity_Req,DeviceControlService_TestConnectivity_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_TestConnectivity(ctx);
-					}
-					break;
-				case DeviceControlService_Method_GetVendorFileList:
-					{
-						SpReqAnsContext<DeviceControlService_GetVendorFileList_Req,DeviceControlService_GetVendorFileList_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_GetVendorFileList_Req,DeviceControlService_GetVendorFileList_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_GetVendorFileList(ctx);
-					}
-					break;
-				case DeviceControlService_Method_TestAdapterFileAvailable:
-					{
-						SpReqAnsContext<DeviceControlService_TestAdapterFileAvailable_Req,DeviceControlService_TestAdapterFileAvailable_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_TestAdapterFileAvailable_Req,DeviceControlService_TestAdapterFileAvailable_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_TestAdapterFileAvailable(ctx);
-					}
-					break;
-				case DeviceControlService_Method_GetDevInfo:
-					{
-						SpReqAnsContext<DeviceControlService_GetDevInfo_Req,DeviceControlService_GetDevInfo_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<DeviceControlService_GetDevInfo_Req,DeviceControlService_GetDevInfo_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_GetDevInfo(ctx);
-					}
-					break;
-				default:
-					assert(0);
-					break;
-			}
-			
-		} else {
-			pTransactionContext->SendAnswer(Error);
-		}
-	}
-
-};
-
-
-///////////////////////////
-
-} // namespace DeviceControl
-#endif // __DEVICECONTROL_SERVER_G_H

+ 0 - 161
Module/mod_DeviceControl/Interface.h

@@ -1,161 +0,0 @@
-//---------------------------------------------------------------------------
-
-#ifndef InterfaceH
-#define InterfaceH
-//---------------------------------------------------------------------------
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-#define TOKEN_TYPE_MW21   0x21     //"类型21"
-#define TOKEN_TYPE_GD31   0x31     //"类型31"
-#define TOKEN_TYPE_GD33   0x33     //"类型33"
-#define TOKEN_TYPE_MW23   0x23     //"类型23"
-#define TOKEN_TYPE_GD35   0x35     //"类型35"
-
-
-//错误
-#define OK_FORMAT_COMPLETE   0
-#define ERR_ALREADY_PROCESSING  -1
-#define ERR_PARAM_EMPTY      -2
-#define ERR_BUFFER_TOO_SMALL -3
-#define ERR_NAME_TOO_LONG    -4
-#define ERR_MULTI_TOKENS     -5
-#define ERR_FIND_TOKEN       -6
-#define ERR_CONNECT_TOKEN    -7
-#define ERR_VERIFY_SUPER_PWD -8
-#define ERR_VERIFY_USER_PWD  -9
-#define ERR_BLANK_TOKEN      -10
-#define ERR_READ_SN          -11
-#define ERR_MW21DRV_NOTEXIST -12
-#define ERR_GD31DRV_NOTEXIST -13
-#define ERR_SET_USER_PWD     -14
-
-//以下错误发生,会重新尝试格式化key
-#define ERR_FORMAT_TOKEN     -20
-#define ERR_CREATE_CONTAINER -21
-#define ERR_GENERATE_RSAKEY  -22
-#define ERR_EXPORT_PUBKEY    -23
-#define ERR_GENERATE_CERTREQ -24
-#define ERR_REQ_SINGATURE    -25
-
-#define ERR_CREATE_V0        -26
-#define ERR_CREATE_P0        -27
-#define ERR_CREATE_P2        -28
-
-#define ERR_WRITE_V0         -29
-#define ERR_WRITE_P0         -30
-#define ERR_WRITE_P2         -31
-
-#define ERR_READ_V0          -32
-#define ERR_READ_P0          -33
-#define ERR_READ_P2          -34
-
-#define ERR_VERIFY_V0        -35
-#define ERR_VERIFY_P0        -36
-#define ERR_VERIFY_P2        -37
-
-#define ERR_WRITE_BACK       -38
-
-#define ERR_UNKNOWN_EXCEPTION -39
-
-
-#define ERR_STR_ALREADY_PROCESSING  "有其他的格式化操作正在进行。"
-#define ERR_STR_PARAM_EMPTY      "输入变量为空。"
-#define ERR_STR_BUFFER_TOO_SMALL "输出缓冲太小。"
-#define ERR_STR_NAME_TOO_LONG    "申请人姓名太长。"
-#define ERR_STR_MULTI_TOKENS     "电脑上有多个USBKEY。"
-#define ERR_STR_FIND_TOKEN       "搜索USBKEY失败。请确认是否插好。"
-#define ERR_STR_CONNECT_TOKEN    "连接USBKEY出错。请插拔后再试。"
-#define ERR_STR_VERIFY_SUPER_PWD "验证USBKEY超级口令失败。"
-#define ERR_STR_VERIFY_USER_PWD  "验证USBKEY用户口令失败。"
-#define ERR_STR_SET_USER_PWD     "修改用户口令失败。"
-#define ERR_STR_BLANK_TOKEN      "清空USBKEY失败。"
-#define ERR_STR_READ_SN          "读取USBKEY序列号失败。请更换设备。"
-#define ERR_STR_MW21DRV_NOTEXIST "21型驱动尚未安装。请安装驱动。"
-#define ERR_STR_GD31DRV_NOTEXIST "31型驱动尚未安装。请安装驱动。"
-#define ERR_STR_FORMAT_TOKEN     "格式化失败。请插拔后再试或者更换设备。"
-#define ERR_STR_CREATE_CONTAINER "创建容器失败。请更换设备。"
-#define ERR_STR_GENERATE_RSAKEY  "生成密钥对失败。请更换设备。"
-#define ERR_STR_EXPORT_PUBKEY    "导出公钥失败。请更换设备。"
-#define ERR_STR_GENERATE_CERTREQ "生成证书请求失败。请更换设备。"
-#define ERR_STR_REQ_SINGATURE    "证书请求的签名验证失败。请更换设备。"
-#define ERR_STR_CREATE_V0        "创建文件v0失败。请更换设备。"
-#define ERR_STR_CREATE_P0        "创建文件p0失败。请更换设备。"
-#define ERR_STR_CREATE_P2        "创建文件p2失败。请更换设备。"
-#define ERR_STR_WRITE_V0         "写入文件v0失败。请更换设备。"
-#define ERR_STR_WRITE_P0         "写入文件p0失败。请更换设备。"
-#define ERR_STR_WRITE_P2         "写入文件p2失败。请更换设备。"
-#define ERR_STR_READ_V0          "读取文件v0失败。请更换设备。"
-#define ERR_STR_READ_P0          "读取文件p0失败。请更换设备。"
-#define ERR_STR_READ_P2          "读取文件p2失败。请更换设备。"
-#define ERR_STR_VERIFY_V0        "校验文件v0失败。请更换设备。"
-#define ERR_STR_VERIFY_P0        "校验文件p0失败。请更换设备。"
-#define ERR_STR_VERIFY_P2        "校验文件p2失败。请更换设备。"
-#define ERR_STR_WRITE_BACK       "回写标志失败"
-#define ERR_STR_UNKNOWN_EXCEPTION "发生未知异常"
-
-
-/*
-证书系统:
-"身份证"        A
-"护照"          B
-"军人证"        C
-"户口簿"        D
-"居住证"        E
-"监护人证件"    F
-"武警身份证"    G
-"通行证"        H
-"暂住证"        I
-"其他"          Z
-
-主机:
-居民身份证      P01
-学生证          P02
-临时居民身份证  P03
-军人证          P04
-武警身份证      P08
-居民户口簿      P16
-通行证          P18
-回乡证          P19
-护照            P31
-*/
-
-__declspec(dllexport)
-int __stdcall CalcCheckValue(char* pszTokenNum , int nTokenNum);
-
-
-#define CERTTYPE_RSA1024  6
-#define CERTTYPE_RSA2048  7
-#define CERTTYPE_SM2_256  8
-
-__declspec(dllexport)
-int __stdcall InitToken(char* pszCertType,
-						int& nTokenType,  //char* pszTokenType, int& nTokenType,
-                        char* pszOldSuperPwd,
-                        char* pszUserName,
-                        char* pszUserIDType,
-                        char* pszUserIDNo,
-                        char* pszTokenSn, int& nTokenSn,   //至少16字节
-                        char* pszPKCS10,  int& nPKCS10,    //建议大小1024字节
-                        char* pszMsg,     int& nMsg          //建议至少100字节
-);
-
-
-__declspec(dllexport)
-int __stdcall EndInitToken();
-
-// add by wr 20151019
-__declspec(dllexport)
-int __stdcall GetUKeyID(char *pUKeyID, int &nUKeyID);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif

+ 0 - 477
Module/mod_DeviceControl/mod_DeviceControl.cpp

@@ -1,477 +0,0 @@
-// mod_DeviceControl.cpp : Defines the exported functions for the DLL application.
-//
-
-#include "stdafx.h"
-#include "mod_DeviceControl.h"
-#include "DeviceControl_msg_g.h"
-#include "toolkit.h"
-#include "CommEntityUtil.hpp"
-#include <string>
-#include <map>
-#include "array.h"
-#include "fileutil.h"
-#include <vector>
-#include <iostream>
-#include <memory>
-
-#include "EventCode.h"
-
-#if defined(RVC_OS_WIN)
-#include<windows.h>
-#else
-#include <regex.h>
-#include <sys/utsname.h>
-#include "RestfulFunc.h"
-
-#define NOT_SUPPOT_X11
-#ifndef NOT_SUPPOT_X11
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#endif //NOT_SUPPOT_X11
-#endif //RVC_OS_WIN
-
-#define DeviceControl_MouseMove  0x21400301	//鼠标移动
-
-void CDeviceControlServerSession::Handle_USB(SpReqAnsContext<DeviceControlService_USB_Req, DeviceControlService_USB_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_USB).setAPI(__FUNCTION__)(__FUNCTION__);
-    m_pEntity->USB(ctx);
-}
-void CDeviceControlServerSession::Handle_GetUkeyID(SpReqAnsContext<DeviceControlService_GetUkeyID_Req, DeviceControlService_GetUkeyID_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_GetUkeyID).setAPI(__FUNCTION__)(__FUNCTION__);
-    m_pEntity->GetUkeyID(ctx);
-}
-void CDeviceControlServerSession::Handle_InitToken(SpReqAnsContext<DeviceControlService_InitToken_Req, DeviceControlService_InitToken_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_InitToken).setAPI(__FUNCTION__)(__FUNCTION__);
-    m_pEntity->InitToken(ctx);
-}
-void CDeviceControlServerSession::Handle_QueryUSBStatus(SpReqAnsContext<DeviceControlService_QueryUSBStatus_Req, DeviceControlService_QueryUSBStatus_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_QueryUSBStatus).setAPI(__FUNCTION__)(__FUNCTION__);
-
-    m_pEntity->QueryUSBStatus(ctx);
-}
-/** 无交易量  [Gifur@20241210]*/
-void CDeviceControlServerSession::Handle_QueryHardwareInfo(SpReqAnsContext<DeviceControlService_QueryHardwareInfo_Req, DeviceControlService_QueryHardwareInfo_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_QueryHardwareInfo).setAPI(__FUNCTION__)(__FUNCTION__);
-
-    m_pEntity->QueryHardwareInfo(ctx);
-}
-void CDeviceControlServerSession::Handle_ReadCenterConfigStr(SpReqAnsContext<DeviceControlService_ReadCenterConfigStr_Req, DeviceControlService_ReadCenterConfigStr_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_ReadCenterConfigStr).setAPI(__FUNCTION__)(__FUNCTION__);
-
-    m_pEntity->ReadCenterConfigStr(ctx);
-}
-
-void CDeviceControlServerSession::Handle_ReadConfigValue(SpReqAnsContext<DeviceControlService_ReadConfigValue_Req, DeviceControlService_ReadConfigValue_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_ReadConfigValue).setAPI(__FUNCTION__)(__FUNCTION__);
-
-    m_pEntity->ReadConfigValue(ctx);
-}
-
-void CDeviceControlServerSession::Handle_GetDevInfo(SpReqAnsContext<DeviceControlService_GetDevInfo_Req, DeviceControlService_GetDevInfo_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_GetDevInfo).setAPI(__FUNCTION__)(__FUNCTION__);
-
-    m_pEntity->GetDevInfo(ctx);
-}
-
-void CDeviceControlServerSession::Handle_TestConnectivity(SpReqAnsContext<DeviceControlService_TestConnectivity_Req, DeviceControlService_TestConnectivity_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_TestConnectivity).setAPI(__FUNCTION__)(__FUNCTION__);
-
-    m_pEntity->TestConnectivity(ctx);
-}
-
-void CDeviceControlServerSession::Handle_GetVendorFileList(SpReqAnsContext<DeviceControlService_GetVendorFileList_Req, DeviceControlService_GetVendorFileList_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_GetVendorFileList).setAPI(__FUNCTION__)(__FUNCTION__);
-
-    m_pEntity->GetVendorFileList(ctx);
-}
-
-void CDeviceControlServerSession::Handle_TestAdapterFileAvailable(SpReqAnsContext<DeviceControlService_TestAdapterFileAvailable_Req, DeviceControlService_TestAdapterFileAvailable_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(DeviceControlService_LogCode_TestAdapterFileAvailable).setAPI(__FUNCTION__)(__FUNCTION__);
-
-    m_pEntity->TestAdapterFileAvailable(ctx);
-}
-
-void CDeviceControlEntity::QueryHardwareInfo(SpReqAnsContext<DeviceControlService_QueryHardwareInfo_Req, DeviceControlService_QueryHardwareInfo_Ans>::Pointer ctx)
-{
-    CSystemStaticInfo info;
-    GetFunction()->GetSystemStaticInfo(info);
-	CAutoArray<SP::Module::Net::NetworkAdapterItem> netList;
-	SP::Module::Net::GetINETMacAddresses(netList);
-
-	CAutoArray<CSimpleStringA> ipAddrs, macAddrs;
-	for (int i = 0; i < netList.GetCount(); i++) {
-		CSimpleStringA tmpip = netList[i].ip.c_str();
-		CSimpleStringA tmpmac = netList[i].mac.c_str();
-		ipAddrs.Append(&tmpip, 0, 1);
-		macAddrs.Append(&tmpmac, 0, 1);
-	}
-    //获取操作系统版本信息
-#if defined(_MSC_VER)
-        //获取windows系统版本
-    DWORD dwMajorVer, dwMinorVer, dwBuildNumber;
-    BOOL bRet = FALSE;
-    HMODULE hModNtdll = NULL;
-    if (hModNtdll = ::LoadLibraryW(L"ntdll.dll")) {
-        typedef void (WINAPI* pfRTLGETNTVERSIONNUMBERS)(DWORD*, DWORD*, DWORD*);
-        pfRTLGETNTVERSIONNUMBERS pfRtlGetNtVersionNumbers;
-        pfRtlGetNtVersionNumbers = (pfRTLGETNTVERSIONNUMBERS)::GetProcAddress(hModNtdll, "RtlGetNtVersionNumbers");
-        if (pfRtlGetNtVersionNumbers) {
-            pfRtlGetNtVersionNumbers(&dwMajorVer, &dwMinorVer, &dwBuildNumber);
-            dwBuildNumber &= 0x0ffff;
-            bRet = TRUE;
-        }
-
-        ::FreeLibrary(hModNtdll);
-        hModNtdll = NULL;
-    }
-
-    char buffer[1024];
-    sprintf(buffer, "%d.%d.%d", dwMajorVer, dwMinorVer, dwBuildNumber);
-    CSimpleStringA sysVer = (string("Windows ver[") + string(buffer) + "]").c_str();
-#else
-    utsname sysInfo;
-    uname(&sysInfo);
-    CSimpleStringA sysVer("UOS ");
-    sysVer.Append(sysInfo.release);
-#endif //_MSC_VER
-
-    if (ctx != NULL) {
-        ctx->Ans.ip = ipAddrs;
-        ctx->Ans.mac = macAddrs;
-        ctx->Ans.machineType = info.strMachineType;
-        ctx->Ans.site = info.strSite;
-        ctx->Ans.terminalNo = info.strTerminalID;
-        ctx->Ans.termLimit = "";
-        ctx->Ans.termVersion = info.InstallVersion.ToString();
-#ifdef DEVOPS_ON_ST /*DevOps流水线编译,ST环境*/
-        ctx->Ans.reserved1 = 1;
-#elif defined(DEVOPS_ON_UAT)/*DevOps流水线编译,UAT环境*/
-        ctx->Ans.reserved1 = 2;
-#elif defined(DEVOPS_ON_PRD)/*DevOps流水线编译,PRD环境*/
-        ctx->Ans.reserved1 = 3;
-#elif defined(DEVOPS_ON_DEV)/*DevOps流水线编译,Dev环境*/
-        ctx->Ans.reserved1 = 0;
-#else/*本地编译等非DevOps环境编译的版本*/
-        ctx->Ans.reserved1 = 0;
-#endif	
-        ctx->Ans.reserved3 = sysVer;
-        ctx->Ans.reserved4 = "";
-
-        ctx->Answer(Error_Succeed);
-    }
-}
-
-
-bool get_current_cursorPos(int& x, int& y)
-{
-#if (defined _WIN32 || defined _WIN64)
-    POINT p;
-    if (GetCursorPos(&p)) {
-        x = p.x;
-        y = p.y;
-        return true;
-    }
-
-#else
-
-#ifndef NOT_SUPPOT_X11
-    std::shared_ptr<Display> display(XOpenDisplay(NULL), [](Display* p) {
-        XCloseDisplay(p);
-});
-    XEvent event;
-    if (XQueryPointer(display.get(), XDefaultRootWindow(display), &event.xbutton.root, &event.xbutton.window, &event.xbutton.x_root, &event.xbutton.y_root,
-                      &event.xbutton.x, &event.xbutton.y, &event.xbutton.state)) {
-        x = event.xbutton.x_root;
-        y = event.xbutton.y_root;
-        return true;
-    }
-#endif // !NOT_SUPPOT_X11
-
-#endif
-
-    return false;
-}
-
-
-DWORD cursorPosUpdate(void* param)
-{
-    int curX = 0, curY = 0;
-    while (true) {
-        int tmpX = 0, tmpY = 0;
-        get_current_cursorPos(tmpX, tmpY);
-        if (tmpX != curX || tmpY != curY) {
-            LogEvent(Severity_Low, DeviceControl_MouseMove,
-                     CSimpleString::Format("cursor move from (%d, %d) to (%d, %d)", curX, curY, tmpX, tmpY));
-            curX = tmpX;
-            curY = tmpY;
-        }
-        Sleep(20000);
-    }
-    return 0;
-}
-
-void CDeviceControlEntity::ReadCenterConfigStr(SpReqAnsContext<DeviceControlService_ReadCenterConfigStr_Req, DeviceControlService_ReadCenterConfigStr_Ans>::Pointer ctx)
-{
-    auto ret = __ReadCenterConfigStr(ctx->Req.key, ctx->Req.entityName);
-    ctx->Ans.value = ret.second;
-    ctx->Ans.reserved1 = ctx->Ans.reserved2 = 0;
-    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s: ReadCenterConfigStr key:%s, entityName:%s: %s",
-        SpStrError(ret.first),
-        ctx->Req.key.GetData(), ctx->Req.entityName.GetData(), ctx->Ans.value.GetData());
-    ctx->Answer(ret.first);
-}
-
-void CDeviceControlEntity::ReadConfigValue(SpReqAnsContext<DeviceControlService_ReadConfigValue_Req, DeviceControlService_ReadConfigValue_Ans>::Pointer ctx)
-{
-    if (ctx->Req.configType < 0 || ctx->Req.configType > Config_Cache + 1) {
-        ctx->Answer(Error_Param);
-        return;
-    }
-
-    if (ctx->Req.configType == 0) {
-
-        if (ctx->Req.section.Compare("SougouInput") == 0) {
-
-            if (ctx->Req.key.Compare("Snapshot") == 0) {
-                CSimpleStringA shellScriptPath;
-                GetFunction()->GetPath("Base", shellScriptPath);
-                shellScriptPath += SPLIT_SLASH_STR;
-                shellScriptPath += "res" SPLIT_SLASH_STR "RunScript" SPLIT_SLASH_STR;
-                std::string fetch_scripts(shellScriptPath.GetData());
-                fetch_scripts += "sogouime-info-cmb.sh";
-                if (!ExistsFileA(fetch_scripts.c_str())) {
-                    ctx->Answer(Error_NotExist);
-                    return;
-                } else {
-
-                    do {
-                        char app[MAX_PATH] = { '\0' };
-                        tk_process_t* process = NULL;
-                        tk_process_option_t option;
-                        option.exit_cb = NULL;
-                        option.file = NULL;
-                        option.flags = 0;
-
-                        sprintf(app, "bash %s", fetch_scripts.c_str());
-                        option.params = app;
-                        const int res = process_spawn(&option, &process);
-                        if (0 == res) {
-                            FREE(process);
-                            LogWarn(Severity_Middle, Error_Debug, LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_SUCC,
-                                    CSimpleStringA::Format("%s", fetch_scripts.c_str()));
-                        } else {
-                            LogWarn(Severity_Middle, Error_Unexpect, LOG_DEVICECONTROL_SOGOU_SCRIPTS_EXECUTE_FAILED,
-                                    CSimpleStringA::Format("%s: %d", fetch_scripts.c_str(), res));
-                            ctx->Answer(Error_NotExist);
-                            return;
-                        }
-
-                    } while (false);
-
-                    Sleep(5000);
-
-                    do {
-
-                        std::string succStr, errStr;
-                        SYSTEMTIME curTime = CSmallDateTime::GetNow().ToSystemTime();
-                        CSimpleStringA logFileName = CSimpleStringA::Format("/opt/rvc/dbg/sogouinfo/%04d%02d%02d.log", curTime.wYear, curTime.wMonth, curTime.wDay);
-                        std::string runStr("cat ");
-                        if (ExistsFileA(logFileName)) {
-                            runStr += logFileName.GetData();
-                            if (SP::Module::Util::ShellExecute(runStr, succStr, errStr)) {
-                                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("execute {%s} suc: %s", runStr.c_str(), succStr.c_str());
-                                ctx->Ans.reserved3 = succStr.c_str();
-                            }
-                        }
-                    } while (false);
-
-                    ctx->Answer(Error_Succeed);
-                    return;
-                }
-            
-            } else if (ctx->Req.key.Compare("SogouRestart") == 0) {
-                ctx->Answer(m_fsm.RestartSogouServices());
-                return;
-            }
-            else {
-                ctx->Answer(Error_NotImpl);
-                return;
-            }
-        } else {
-            ctx->Answer(Error_NotImpl);
-            return;
-        }
-    }
-
-    ConfigTypeEnum type = static_cast<ConfigTypeEnum>(ctx->Req.configType - 1);
-    CSmartPointer<IConfigInfo> spConfig;
-    ErrorCodeEnum err = GetFunction()->OpenConfig(type, spConfig);
-    if (err == Error_Succeed) {
-
-        CSimpleStringA str(true);
-        CSimpleStringA section(ctx->Req.section);
-        CSimpleStringA key(ctx->Req.key);
-#ifndef DEVOPS_ON_PRD
-        /** 被逼的,方便测试环境验证,并且在只读的情况下 [Gifur@2022127]*/
-        if (ctx->Req.reserved1 == 1 && !ctx->Req.option) {
-#ifdef DEVOPS_ON_ST
-            section.Append("_ST");
-#else defined(DEVOPS_ON_UAT)
-            section.Append("_UAT");
-#endif // DEVOPS_ON_ST
-        }
-#endif
-        err = spConfig->ReadConfigValue(section, key, str);
-        if (err == Error_Succeed) ctx->Ans.value = str;
-
-        if (ctx->Req.option && ctx->Req.reserved3.Compare(str) != 0) {
-            DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("save value: %s", ctx->Req.reserved3.GetData());
-            err = spConfig->WriteConfigValue(section, key, ctx->Req.reserved3);
-        } else if (ctx->Req.option) {
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("stored value is the same as the coming one: %s", str.GetData());
-        }
-    }
-    ctx->Answer(err);
-    return;
-}
-
-void CDeviceControlEntity::TestConnectivity(SpReqAnsContext<DeviceControlService_TestConnectivity_Req, DeviceControlService_TestConnectivity_Ans>::Pointer ctx)
-{
-    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%d: %s:%d", ctx->Req.protocol, ctx->Req.ip.GetData(), ctx->Req.port);
-
-#if defined(_MSC_VER)
-    ctx->Answer(Error_NotImpl);
-#else
-	ErrorCodeEnum result(Error_NotInit);
-
-	if (ctx->Req.protocol == 0) {
-		result = Error_Param;
-	} else if (ctx->Req.protocol == 1) { //Ping
-		if (ctx->Req.ip.IsNullOrEmpty()) {
-			result = Error_Param;
-		} else {
-			const int res = PingTest(std::string(ctx->Req.ip));
-			if (res == 0) {
-				ctx->Ans.result = 0;
-				ctx->Ans.additionalMsg.Clear();
-			} else {
-				ctx->Ans.result = -1;
-				ctx->Ans.additionalMsg = CSimpleStringA::Format("Ping %s failed: %d", ctx->Req.ip.GetData(), res);
-			}
-			result = Error_Succeed;
-		}
-	} else if (ctx->Req.protocol == 2) { //Normal socket connect Test
-		if (ctx->Req.ip.IsNullOrEmpty() || ctx->Req.port <= 0) {
-			result = Error_Param;
-		} else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Test socket connect available: %s:%d", ctx->Req.ip.GetData(), ctx->Req.port);
-			std::string errMsg("");
-			const int ret = SocketConnectTest(ctx->Req.ip.GetData(), ctx->Req.port, errMsg);
-			ctx->Ans.result = ret;
-			ctx->Ans.additionalMsg = errMsg.c_str();
-			result = Error_Succeed;
-		}
-	} else if (ctx->Req.protocol == 4) { //Http Test
-		if (ctx->Req.ip.IsNullOrEmpty()) {
-			result = Error_Param;
-		} else {
-			std::string msg;
-			const int res = HttpProbe(std::string(ctx->Req.ip), msg);
-			ctx->Ans.result = res;
-			ctx->Ans.additionalMsg = msg.c_str();
-			result = Error_Succeed;
-		}
-	} else {
-		result = Error_NotSupport;
-	}
-	ctx->Answer(result);
-#endif //_MSC_VER
-
-}
-
-void CDeviceControlEntity::GetVendorFileList(SpReqAnsContext<DeviceControlService_GetVendorFileList_Req, DeviceControlService_GetVendorFileList_Ans>::Pointer ctx)
-{
-	ctx->Answer(Error_NotSupport);
-}
-
-void CDeviceControlEntity::TestAdapterFileAvailable(
-    SpReqAnsContext<DeviceControlService_TestAdapterFileAvailable_Req, DeviceControlService_TestAdapterFileAvailable_Ans>::Pointer ctx)
-{
-    ctx->Answer(Error_NotSupport);
-    return;
-}
-
-std::pair<ErrorCodeEnum, CSimpleStringA> CDeviceControlEntity::__ReadCenterConfigStr(CSimpleStringA key, CSimpleStringA entityName = "")
-{
-    CSimpleStringA str = "";
-    CSmartPointer<IConfigInfo> spCerConfig;
-    ErrorCodeEnum err = GetFunction()->OpenConfig(Config_CenterSetting, spCerConfig);
-    if (err != Error_Succeed)
-        DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("OpenConfig failed: %s", SpStrError(err));
-    else
-        err = spCerConfig->ReadConfigValue(
-            entityName == CSimpleStringA("") ? "IEBrowser" : (const char*)entityName.GetData()
-            , (const char*)key.GetData(), str);
-
-    if (str.IsNullOrEmpty() && key.Compare("CenterConfigUrl") == 0 && entityName.Compare("CenterSetting") == 0) {
-        DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Try to read CenterSettings download url from shell.ini again");
-        CSmartPointer<IConfigInfo> pConfigShell;
-        GetFunction()->OpenConfig(Config_Shell, pConfigShell);
-        CSimpleStringA section("CenterSettingsDownloadUrl");
-        pConfigShell->ReadConfigValue(section, "LAN", str);
-        if (Error_Succeed != err && !str.IsNullOrEmpty()) {
-            err = Error_Succeed;
-        }
-    }
-
-    return std::make_pair(err, str);
-}
-
-void CDeviceControlEntity::BroadcastAdapterTestResult(const CSimpleStringA& adapterName, ErrorCodeEnum result, const CSimpleStringA& strErrMsg)
-{
-    DeviceControl::AdapterTestResult evt;
-    evt.result = result;
-    evt.adapterInfo = adapterName;
-    evt.errMsg = strErrMsg;
-    SpSendBroadcast(GetFunction(), SP_MSG_OF(AdapterTestResult), SP_MSG_SIG_OF(AdapterTestResult), evt);
-}
-
-void CDeviceControlEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext)
-{
-    LOG_FUNCTION();
-    ErrorCodeEnum rt = m_fsm.Init(this);
-    ///**TODO(Gifur@9/28/2023): UOS 下需要监控鼠标移动状态吗? */
-#if defined(_MSC_VER)
-    CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&cursorPosUpdate, NULL, 0, NULL));
-#endif //_MSC_VER
-    pTransactionContext->SendAnswer(rt);
-}
-
-SP_BEGIN_ENTITY_MAP()
-SP_ENTITY(CDeviceControlEntity)
-SP_END_ENTITY_MAP()
-
-
-

+ 0 - 143
Module/mod_DeviceControl/mod_DeviceControl.h

@@ -1,143 +0,0 @@
-#ifndef _MOD_DEVICECONTROL_H
-#define _MOD_DEVICECONTROL_H
-
-#pragma once
-
-#include "modVer.h"
-
-#include "DeviceControlFSM.h"
-#include "DevEntityCommBase.hpp"
-
-// to get mac address
-#include <string>
-#include <vector>
-
-#ifdef RVC_OS_WIN
-#include <Winsock2.h>
-#include <WS2tcpip.h>
-#include <Iphlpapi.h>
-#include "IHttpFunc.h"
-#else
-#include "SpTest.h"
-
-#endif // RVC_OS_WIN
-
-#pragma warning( disable : 4996 )
-
-#define MACSESION 6
-
-using namespace DeviceControl;
-
-class CDeviceControlEntity;
-
-class CDeviceControlServerSession : public DeviceControlService_ServerSessionBase
-{
-public:
-    CDeviceControlServerSession(CDeviceControlEntity* pEntity) :m_pEntity(pEntity) {}
-    virtual ~CDeviceControlServerSession() {}
-    virtual void Handle_USB(SpReqAnsContext<DeviceControlService_USB_Req, DeviceControlService_USB_Ans>::Pointer ctx);
-    virtual void Handle_GetUkeyID(SpReqAnsContext<DeviceControlService_GetUkeyID_Req, DeviceControlService_GetUkeyID_Ans>::Pointer ctx);
-    virtual void Handle_InitToken(SpReqAnsContext<DeviceControlService_InitToken_Req, DeviceControlService_InitToken_Ans>::Pointer ctx);
-    virtual void Handle_QueryUSBStatus(SpReqAnsContext<DeviceControlService_QueryUSBStatus_Req, DeviceControlService_QueryUSBStatus_Ans>::Pointer ctx);
-    virtual void Handle_QueryHardwareInfo(SpReqAnsContext<DeviceControlService_QueryHardwareInfo_Req, DeviceControlService_QueryHardwareInfo_Ans>::Pointer ctx);
-    virtual void Handle_ReadCenterConfigStr(SpReqAnsContext<DeviceControlService_ReadCenterConfigStr_Req, DeviceControlService_ReadCenterConfigStr_Ans>::Pointer ctx);
-    virtual void Handle_ReadConfigValue(SpReqAnsContext<DeviceControlService_ReadConfigValue_Req, DeviceControlService_ReadConfigValue_Ans>::Pointer ctx);
-    virtual void Handle_GetDevInfo(SpReqAnsContext<DeviceControlService_GetDevInfo_Req, DeviceControlService_GetDevInfo_Ans>::Pointer ctx);
-    virtual void Handle_TestConnectivity(SpReqAnsContext<DeviceControlService_TestConnectivity_Req, DeviceControlService_TestConnectivity_Ans>::Pointer ctx);
-    virtual void Handle_GetVendorFileList(SpReqAnsContext<DeviceControlService_GetVendorFileList_Req, DeviceControlService_GetVendorFileList_Ans>::Pointer ctx);
-    virtual void Handle_TestAdapterFileAvailable(SpReqAnsContext<DeviceControlService_TestAdapterFileAvailable_Req, DeviceControlService_TestAdapterFileAvailable_Ans>::Pointer ctx);
-
-private:
-    CDeviceControlEntity* m_pEntity;
-};
-
-class CDeviceControlEntity : public CDevAdptEntityBase
-{
-public:
-    CDeviceControlEntity(){}
-    virtual ~CDeviceControlEntity()
-    {
-
-    }
-    virtual const char* GetEntityName() const { return "DeviceControl"; }
-
-    const char* GetEntityVersion() const { return MODULE_VERSION_FULL; }
-
-#if defined(RVC_OS_LINUX)
-	ON_ENTITYT_TEST()
-#endif //RVC_OS_LINUX
-
-	virtual void OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext);
-
-    virtual void OnPrePause(CSmartPointer<ITransactionContext> pTransactionContext)
-    {
-        pTransactionContext->SendAnswer(Error_Succeed);
-    }
-    virtual void OnPreContinue(CSmartPointer<ITransactionContext> pTransactionContext)
-    {
-        pTransactionContext->SendAnswer(Error_Succeed);
-    }
-
-    virtual void OnPreClose(EntityCloseCauseEnum eCloseCause, CSmartPointer<ITransactionContext> pTransactionContext)
-    {
-        m_fsm.OnExit();
-        pTransactionContext->SendAnswer(Error_Succeed);
-    }
-
-    virtual CServerSessionBase* OnNewSession(const char*, const char*)
-    {
-        return new CDeviceControlServerSession(this);
-    }
-
-    void USB(SpReqAnsContext<DeviceControlService_USB_Req, DeviceControlService_USB_Ans>::Pointer ctx)
-    {
-        ctx->Answer(Error_NotSupport);
-    }
-
-    void GetUkeyID(SpReqAnsContext<DeviceControlService_GetUkeyID_Req, DeviceControlService_GetUkeyID_Ans>::Pointer ctx)
-    {
-        ctx->Answer(Error_NotSupport);
-    }
-
-    void InitToken(SpReqAnsContext<DeviceControlService_InitToken_Req, DeviceControlService_InitToken_Ans>::Pointer ctx)
-    {
-        ctx->Answer(Error_NotSupport);
-    }
-
-    void QueryUSBStatus(SpReqAnsContext<DeviceControlService_QueryUSBStatus_Req, DeviceControlService_QueryUSBStatus_Ans>::Pointer ctx)
-    {
-        ctx->Answer(Error_NotSupport);
-    }
-
-    void QueryHardwareInfo(SpReqAnsContext<DeviceControlService_QueryHardwareInfo_Req, DeviceControlService_QueryHardwareInfo_Ans>::Pointer ctx);
-    void ReadCenterConfigStr(SpReqAnsContext<DeviceControlService_ReadCenterConfigStr_Req, DeviceControlService_ReadCenterConfigStr_Ans>::Pointer ctx);
-
-    void ReadConfigValue(SpReqAnsContext<DeviceControlService_ReadConfigValue_Req, DeviceControlService_ReadConfigValue_Ans>::Pointer ctx);
-
-    void GetDevInfo(SpReqAnsContext<DeviceControlService_GetDevInfo_Req, DeviceControlService_GetDevInfo_Ans>::Pointer ctx)
-    {
-        ctx->Answer(Error_NotImpl);
-    }
-
-    void TestConnectivity(SpReqAnsContext<DeviceControlService_TestConnectivity_Req, DeviceControlService_TestConnectivity_Ans>::Pointer ctx);
-
-    void GetVendorFileList(SpReqAnsContext<DeviceControlService_GetVendorFileList_Req, DeviceControlService_GetVendorFileList_Ans>::Pointer ctx);
-    void TestAdapterFileAvailable(SpReqAnsContext<DeviceControlService_TestAdapterFileAvailable_Req, DeviceControlService_TestAdapterFileAvailable_Ans>::Pointer ctx);
-
-    void OnSelfTest(EntityTestEnum eTestType, CSmartPointer<ITransactionContext> pTransactionContext)
-    {
-        m_fsm.SelfTest(eTestType, pTransactionContext);
-    }
-
-    virtual bool IsService()const { return true; }
-
-    virtual bool IsMultiThread()const { return true; }
-
-private:
-    std::pair<ErrorCodeEnum, CSimpleStringA> __ReadCenterConfigStr(CSimpleStringA key, CSimpleStringA entityName);
-    void BroadcastAdapterTestResult(const CSimpleStringA& adapterName, ErrorCodeEnum result, const CSimpleStringA& strErrMsg);
-private:
-    CDeviceControlFSM m_fsm;
-};
-
-#endif //_MOD_DEVICECONTROL_H

+ 0 - 13
Module/mod_DeviceControl/test/testGetIpMacAddress.cpp

@@ -1,13 +0,0 @@
-#ifndef TEST_MOD_DEVICECONTROL_IPMAC
-#define TEST_MOD_DEVICECONTROL_IPMAC
-
-#include "mod_DeviceControl.h"
-
-TEST_CASE_ENTITY_CONTEXT(CDeviceControlEntity, DeviceControlService, QueryHardwareInfo, "QueryHardwareInfo", "Description or TAG")
-{
-    ANSWER_CHECK(Ans.ip.GetCount() > 0);
-    ANSWER_CHECK(Ans.mac.GetCount() > 0);
-}
-
-#endif
-

+ 79 - 11
Module/mod_FingerPrint/FingerPrint.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="gb2312" ?>
 <entity name="FingerPrint">
 	<class name="FingerPrintService" overlap="true" exclusive="false">			
-		<twoway name="GetImageAndFeature" overlap="true">
+		<twoway name="GetImageAndFeature" overlap="true" method_id="0">
 			<req>
 				<param name="times" type="int"/>
 			</req>
@@ -10,13 +10,13 @@
 				<param name="feature" type="string" />
 			</res>			
 		</twoway>
-		<oneway name="CancelRegister" overlap="true">		
+		<oneway name="CancelRegister" overlap="true" method_id="1">		
 		</oneway>
-		<oneway name="CancelMatch" overlap="true">		
+		<oneway name="CancelMatch" overlap="true" method_id="2">		
 		</oneway>
-		<oneway name="Exit" overlap="true">		
+		<oneway name="Exit" overlap="true" method_id="3">		
 		</oneway>
-		<twoway name="Match" overlap="true">
+		<twoway name="Match" overlap="true" method_id="4">
 			<req>
 				<param name="templates" type="array_string"/>
 				<param name="templateLen" type="array_int"/>
@@ -29,24 +29,28 @@
 				<param name="result" type="array_int" />	
 			</res>			
 		</twoway>
-		<twoway name="GetDevStatus" overlap="true">
+		<twoway name="GetDevStatus" overlap="true" method_id="5">
 			<req>
 			</req>
 			<res>
 				<param name="status" type="int" />
 			</res>
 		</twoway>
-		<twoway name="GetDevInfo" overlap="true" method_id="65535">
+		<!--查询指纹仪设备状态接口 -->
+		<!--1、指纹仪打开失败, errorCode为Error_DevNotAvailable(2050),rtaCode为RTA2429-->
+		<!--2、指纹仪正在打开中,errorCode为Error_NotInit(769) ,rtaCode为RTA2429-->	
+		<twoway name="GetDevInfo" overlap="true" method_id="65535" jsflag="true">
 			<req>
 			</req>
 			<res>
 				<param name="type" type="string" />
 				<param name="model" type="string" />
 				<param name="version" type="string" />
+				<!--0:设备未打开 1:正常运行 3:异常不可工作-->
 				<param name="state" type="int" />
 			</res>			
 		</twoway>
-		<twoway name="GetImageAndFeatureEx" overlap="true">
+		<twoway name="GetImageAndFeatureEx" overlap="true" method_id="6">
 			<req>
 				<param name="times" type="int"/>
 			</req>
@@ -57,7 +61,7 @@
 				<param name="reserved2" type="array_string" />
 			</res>			
 		</twoway>
-		<twoway name="GetFingerPrint" overlap="true">
+		<twoway name="GetFingerPrint" overlap="true" method_id="7">
 			<req>
 				<param name="times" type="int"/>
 				<param name="reserved1" type="array_int" />
@@ -71,7 +75,7 @@
 			</res>			
 		</twoway>	
 		<!-- 合成特征模板 -->
-		<twoway name="GenerateTemplate" overlap="true">
+		<twoway name="GenerateTemplate" overlap="true" method_id="8">
 			<req>
 				<param name="FingerIDList" type="array_int"/>
 				<param name="reserved1" type="array_int"/>
@@ -82,6 +86,70 @@
 				<param name="reserved1" type="array_int"/>
 				<param name="reserved2" type="array_string"/>
 			</res>			
-		</twoway>	
+		</twoway>
+		<!--js接口-->
+		<!--扫描指纹接口 -->
+		<!--1、指纹仪打开失败, errorCode为Error_DevNotAvailable(2050),rtaCode为RTA2422-->
+		<!--2、指纹扫描取消, errorCode为Error_Unexpect(2147483646),rtaCode为RTA2426-->
+		<!--3、指纹扫描超时, errorCode为Error_Unexpect(2147483646),rtaCode为RTA2411-->
+		<!--4、指纹仪扫描失败,获取dep路径失败, errorCode为Error_Unexpect(2147483646),rtaCode为RTA2424-->
+		<!--5、指纹仪扫描失败,未生成指纹信息文件, errorCode为Error_Unexpect(2147483646),rtaCode为RTA2416-->
+		<!--6、指纹仪扫描失败,获取指纹特征值长度不对, errorCode为Error_Unexpect(2147483646),rtaCode为RTA2413-->
+		<!--7、指纹仪扫描失败,获取指纹特征值为空, errorCode为Error_Unexpect(2147483646),rtaCode为RTA2414-->
+		<!--8、指纹扫描失败,获取指纹图片内容失败, errorCode为Error_Unexpect(2147483646),rtaCode为RTA242A-->
+		<twoway name="GetFingerPrintJS" overlap="true" method_id="9" jsflag="true">
+			<req>
+				<!--指纹序号 0:授权扫描使用 1、2、3...等注册扫描使用-->
+				<param name="fingerSN" type="int"/>
+				<!--指纹扫描超时时间 单位秒-->
+				<param name="scanTimeOut" type="int"/>
+				<param name="reserved1" type="array_int" />
+				<param name="reserved2" type="array_string" />
+			</req>
+			<res>
+				<!-- 指纹特征码-->
+				<param name="feature" type="string"/>
+				<!-- 指纹内容-->
+				<param name="fingerImg" type="blob"/>
+				<param name="fingerImgLen" type="int"/>
+				<param name="reserved1" type="array_int" />
+				<param name="reserved2" type="array_string" />
+			</res>			
+		</twoway>
+		
+		<!--生成指纹模版接口 -->
+		<!--1、指纹仪打开失败, errorCode为Error_DevNotAvailable(2050),rtaCode为RTA2425-->
+		<!--2、指纹扫描已被取消, errorCode为Error_Unexpect(2147483646),rtaCode为RTA2427-->
+		<!--3、指纹模版生成失败,模版特征值长度不正确 errorCode为Error_Unexpect(2147483646),rtaCode为RTA2428-->	
+		<!--4、指纹模版生成失败,指纹文件不存在 errorCode为Error_Unexpect(2147483646),rtaCode为RTA242C-->
+		<!--5、指纹模版生成失败,输入参数错误 errorCode为Error_Unexpect(2147483646),rtaCode为RTA242B-->
+		<!--6、指纹模版生成失败,errorCode为Error_Unexpect(2147483646),rtaCode为RTA2418-->
+		<twoway name="GenerateTemplateJS" overlap="true" method_id="10" jsflag="true">
+			<req>
+				<!-- 指纹序号集合,合成模版的指纹序号 -->
+				<param name="fingerSNList" type="array_int"/>
+				<param name="reserved1" type="array_int" />
+				<param name="reserved2" type="array_string" />
+			</req>
+			<res>
+				<!-- 指纹模版特征码 -->
+				<param name="templateFeature" type="string"/>
+				<param name="reserved1" type="array_int" />
+				<param name="reserved2" type="array_string" />
+			</res>			
+		</twoway>
+		<!--取消扫描接口 -->
+		<!--1、指纹仪打开失败, errorCode为Error_DevNotAvailable(2050),rtaCode为RTA242D-->
+		<twoway name="CancelScanJS" overlap="true" method_id="11" jsflag="true">	
+			<req>
+				<param name="reserved1" type="array_int" />
+				<param name="reserved2" type="array_string" />
+			</req>
+			<res>
+				<param name="reserved1" type="array_int" />
+				<param name="reserved2" type="array_string" />
+			</res>		
+		</twoway>
+		
 	</class>	
 </entity>

+ 444 - 0
Module/mod_FingerPrint/FingerPrintFSM.cpp

@@ -30,6 +30,7 @@ void CFingerPrintFSM::s0_on_entry()
 {
 	LOG_FUNCTION();
 	SetDevState(DEVICE_STATUS_NORMAL);
+	m_bCancelScan = false;
 }
 
 void CFingerPrintFSM::s0_on_exit()
@@ -43,6 +44,45 @@ unsigned int CFingerPrintFSM::s0_on_event(FSMEvent* e)
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s0 evt %d", e->iEvt);
 	switch(e->iEvt)
 	{
+		case USER_EVT_JS_GET_FINGERPRINT:
+			{
+				e->SetHandled();
+				GetFingerPrintJSEvent* getFingerPrintEvt = dynamic_cast<GetFingerPrintJSEvent*>(e);
+				GetFingerPrintJSTask* getFingerPrintTask = new GetFingerPrintJSTask(this);
+				getFingerPrintTask->ctx = getFingerPrintEvt->ctx;
+				GetEntityBase()->GetFunction()->PostThreadPoolTask(getFingerPrintTask);
+			}
+			break;
+		case USER_EVT_JS_GENERATE_TEMPLATE:
+			{
+				e->SetHandled();
+				GenerateTemplateJSEvent* gtEvt = dynamic_cast<GenerateTemplateJSEvent*>(e);
+				GenerateTemplateJSTask* gtTask = new GenerateTemplateJSTask(this);
+				gtTask->ctx = gtEvt->ctx;
+				GetEntityBase()->GetFunction()->PostThreadPoolTask(gtTask);
+			}
+			break;
+		case USER_EVT_JS_CANCEL_SCAN:
+			{
+				e->SetHandled();
+				CancelScanJSEvent* pCSE = dynamic_cast<CancelScanJSEvent*>(e);
+				//清理遗留的指纹文件
+				if (m_fingerPrintFileSet.size() > 0) {
+					DeleteRegisterFingerBmp();
+				}
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("扫描取消成功");
+				pCSE->ctx->Answer(Error_Succeed);
+			}
+			break;
+		case EVT_MAINPAGE_DISPLAY:
+			{
+				e->SetHandled();
+				//清理遗留的指纹文件
+				if (m_fingerPrintFileSet.size() > 0) {
+					DeleteRegisterFingerBmp();
+				}
+			}
+			break;
 		case USER_EVT_ERROR:
 			{
 				e->SetHandled();
@@ -173,6 +213,27 @@ unsigned int CFingerPrintFSM::s1_on_event(FSMEvent* e)
 	int ret = 0;
 	switch (e->iEvt)
 	{
+	case USER_EVT_JS_GET_FINGERPRINT_FINISHED:
+		e->SetHandled();
+		ret = e->param1;
+		break;
+	case USER_EVT_JS_GENERATE_TEMPLATE_FINISHED:
+		e->SetHandled();
+		ret = e->param1;
+		break;
+	case USER_EVT_JS_CANCEL_SCAN:
+		{
+			e->SetHandled();
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("扫描取消成功");
+			m_bCancelScan = true;
+			CancelScanJSEvent* pCSE = dynamic_cast<CancelScanJSEvent*>(e);
+			pCSE->ctx->Answer(Error_Succeed);
+		}
+		break;
+	case EVT_MAINPAGE_DISPLAY:
+		e->SetHandled();
+		m_bCancelScan = true;
+		break;
 	case USER_EVT_SCAN_FINISHED:
 		e->SetHandled();
 		ret = e->param1;
@@ -402,6 +463,309 @@ void CFingerPrintFSM::SelfTest(EntityTestEnum eTestType, CSmartPointer<ITransact
 	pTransactionContext->SendAnswer(m_testResult);
 }
 
+int CFingerPrintFSM::GetFingerPrintJS(SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req, FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx)
+{
+	LOG_FUNCTION();
+	ErrorCodeEnum eErr;
+	CSimpleStringA strPath;//指纹图片路径
+	eErr = m_pEntity->GetFunction()->GetPath("Dep", strPath);
+	if (eErr != Error_Succeed)
+	{
+		LogWarn(Severity_Middle, Error_Unexpect, FingerPrint_UserErrorCode_GET_DEP_PATH_FAILED_MATCH, "GetFingerPrintJS::Get dep Path is fail");
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Scan_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_GET_DEP_PATH_FAILED_MATCH))("GetFingerPrintJS::Get dep Path is fail");
+		ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_GET_DEP_PATH_FAILED_MATCH);//RTA2424
+		return 0;
+	}
+
+	int scanTimeOut = 0;
+	if (ctx->Req.scanTimeOut > 0) {
+		scanTimeOut = ctx->Req.scanTimeOut*1000;
+	}
+	else {
+		CSimpleStringA errMsg = CSimpleStringA::Format("GetFingerPrintJS::Param is error,scanTimeOut[%d] is invalid", ctx->Req.scanTimeOut);
+		LogWarn(Severity_Middle, Error_Unexpect, FingerPrint_UserErrorCode_GET_FINGERPRINT_PARAM_FAIL, errMsg.GetData());
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Scan_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_GET_FINGERPRINT_PARAM_FAIL))("GetFingerPrintJS::Param is error,scanTimeOut[%d] is invalid", ctx->Req.scanTimeOut);
+		ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_GET_FINGERPRINT_PARAM_FAIL);//RTA242F
+		return 0;
+	}
+
+	bool bIsRegister = false;//判定是否注册
+	bIsRegister = (ctx->Req.fingerSN == 0) ? false : true;
+
+	//循环扫描
+
+	LPBYTE lpbFeature = new BYTE[MAX_FEATURE_LEN];
+	memset(lpbFeature, 0, sizeof(lpbFeature));
+	int lpbLength = MAX_FEATURE_LEN;
+
+	CSimpleStringA fileName = CSimpleStringA::Format("finger%d.bmp", ctx->Req.fingerSN);
+	strPath = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s", strPath.GetData(), fileName.GetData());//图片位置
+
+	DeleteFingerBmp(strPath);
+	
+	bool bGetFingerPrintSuc = false;
+	bool bNotFindImage = false;
+	bool bLenIsNotRight = false;
+	bool bFeatureIsNull = false;
+	bool bExit = false;
+	bool bTimeOut = true;
+	ULLINT l_beginTime, l_endTime;
+	ULLINT elapsed = 0;
+	ULONGLONG dwStart = SP::Module::Comm::RVCGetTickCount();
+	ULONGLONG dwEnd = SP::Module::Comm::RVCGetTickCount();
+
+
+	LogEvent(Severity_Middle, LOG_EVT_FINGERPRINT_GREEN_ON, "FingerPrint warning on");
+	while (elapsed < scanTimeOut && !bGetFingerPrintSuc)
+	{
+		if (m_bExit) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("Exit the process.");
+			bTimeOut = false;
+			bExit = true;
+			break;
+		}
+		if (m_bCancelScan) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("CancelScan the process.");
+			bTimeOut = false;
+			break;
+		}
+
+		Sleep(FINGERPRINT_SCAN_INTERNAL);
+
+		lpbLength = MAX_FEATURE_LEN;
+		l_beginTime = SP::Module::Comm::RVCGetTickCount();
+		eErr = m_hDevHelper->Image2Feature(fileName, lpbFeature, lpbLength);
+		l_endTime = SP::Module::Comm::RVCGetTickCount();
+		if (eErr == Error_Succeed) {
+			UpdateAndWarnFileFindInDepBak(strPath, fileName, FingerPrint_UserErrorCode_FindFile_in_DepBak);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::Image2Feature").setCostTime(l_endTime - l_beginTime)("GetFingerPrint::Image2Feature succ ,strPath:%s, lpbLength:%d", strPath.GetData(), lpbLength);
+
+			Sleep(200);
+
+			if (!ExistsFile(strPath)) {
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("<GetFingerPrint>, Cannot find the fingerprint image %s", strPath.GetData());
+				bNotFindImage = true;
+				bTimeOut = false;
+				break;
+			}
+			else if(lpbLength != STANDARD_FEATURE_LEN) {
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("<GetFingerPrint>, vendor returned feature length is not right.");
+				bTimeOut = false;
+				bLenIsNotRight = true;
+				break;
+			}
+			else if (lpbFeature == NULL) {
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("<GetFingerPrint>, Fingerprint feature is NULL.");
+				bTimeOut = false;
+				bFeatureIsNull = true;
+				break;
+			}else {
+				//成功
+				lpbFeature[STANDARD_FEATURE_LEN] = '\0';
+				ctx->Ans.feature = (LPCTSTR)lpbFeature;
+				bGetFingerPrintSuc = true;
+				bTimeOut = false;
+				break;
+			}
+
+		}
+
+		dwEnd = SP::Module::Comm::RVCGetTickCount();
+		elapsed = dwEnd - dwStart;
+	}
+	LogEvent(Severity_Middle, LOG_EVT_FINGERPRINT_GREEN_OFF, CSimpleStringA::Format("FingerPrint warning off,elapse = %d", elapsed));
+
+	//if (bGetFingerPrintSuc && bIsRegister) {
+	//	//临时注册的文件进行缓存
+	//	m_fingerPrintFileSet.insert(strPath);
+	//}
+
+	if (m_bCancelScan || bExit) {
+		//主动取消
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(FingerPrint_Scan_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_CANCEL_SCAN))("指纹扫描失败,扫描已取消");
+		ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_CANCEL_SCAN);//RTA2426
+	}
+	else if (bGetFingerPrintSuc) {
+		//成功
+		CBlob data;
+		ErrorCodeEnum imgErrCode = GetImgBlob(data, strPath);
+		if (imgErrCode != Error_Succeed){	
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode(FingerPrint_Scan_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_GET_FINGERBLOB_FAIL))("Failed to load image(%s)", strPath.GetData());
+			ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_GET_FINGERBLOB_FAIL);//RTA242A
+		}
+		else {
+			ctx->Ans.fingerImg = data;
+			ctx->Ans.fingerImgLen = data.m_iLength;
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(FingerPrint_Scan_ID)("指纹仪扫描成功");
+			ctx->Answer(Error_Succeed);
+		}
+	}
+	else if(bTimeOut){
+		//超时
+		CSimpleStringA addMsg = CSimpleStringA::Format("Invoke routine 'Image2Feature' timeout, fileName:%s, lpbLength:%d failed while GetFingerPrint.", fileName.GetData(), lpbLength);
+		CSimpleStringA contxtStr = CSimpleStringA::Format("{\"addition\": \"%s\"}", addMsg.GetData());
+		SetErrorAndLog(eErr, MEC_DEVAPI_FINGERPRINT_Image2Feature, "DevAdapter::Image2Feature", __FUNCTION__, false, l_endTime - l_beginTime, FingerPrint_Scan_ID, contxtStr.GetData());
+		
+		LogWarn(Severity_Middle, Error_Unexpect, FingerPrint_UserErrorCode_Match_Timeout, "GetFingerPrint timeout");
+		ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_Match_Timeout);//RTA2411
+	}
+	else {
+		if (bNotFindImage) {
+			//未发现文件
+			LogWarn(Severity_Middle, Error_Unexpect, FingerPrint_UserErrorCode_NO_IMAGE_IN_DEP_MATCH, "not find fingerprint image in dep while match");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Scan_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_NO_IMAGE_IN_DEP_MATCH))("指纹扫描失败,采集接口调用成功,但未在dep中找到图片文件");
+			ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_NO_IMAGE_IN_DEP_MATCH);//RTA2416
+			
+		}
+		else if (bLenIsNotRight) {
+			//长度不对
+			LogWarn(Severity_High, Error_Unexpect, FingerPrint_UserErrorCode_FEATURELEN_ISNOTRIGHT_MATCH, "fingerprint feature len is not right while match");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Scan_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_FEATURELEN_ISNOTRIGHT_MATCH))("指纹扫描失败,返回的指纹特征长度错误");
+			ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_FEATURELEN_ISNOTRIGHT_MATCH);//RTA2413
+			
+		}
+		else if (bFeatureIsNull) {
+			//长度为空
+			LogWarn(Severity_Middle, Error_Unexpect, FingerPrint_UserErrorCode_GETFEATURE_FAILED_MATCH, "fingerprint feature is null");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Scan_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_GETFEATURE_FAILED_MATCH))("指纹扫描失败,采集接口调用成功,但返回的特征值为空");
+			ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_GETFEATURE_FAILED_MATCH);//RTA2414
+		
+		}
+	}
+
+	//清理非注册的指纹文件
+	if (!bIsRegister) {
+		DeleteFingerBmp(strPath);
+	}
+	else {
+		//临时注册的文件进行缓存
+		insertRegisterFingerBmp(strPath);
+	}
+
+	//主动和异常退出清理之前的缓存指纹文件
+	if (m_bCancelScan || bExit) {
+		DeleteRegisterFingerBmp();
+	}
+
+	delete[] lpbFeature;
+	lpbFeature = NULL;
+	return 0;
+
+}
+
+int CFingerPrintFSM::GenerateTemplateJS(SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req, FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx)
+{
+	LOG_FUNCTION();
+	
+	std::vector<CSimpleStringA> imagePaths;
+	CSimpleStringA strPath;
+	m_pEntity->GetFunction()->GetPath("Dep", strPath);
+
+	//主动和异常退出清理之前的缓存指纹文件
+	if (m_bCancelScan || m_bExit) {		
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(FingerPrint_Generate_Template_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_CANCEL_GETTEMPLATE))("指纹模版生成失败,已取消");
+		ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_CANCEL_GETTEMPLATE);//RTA2427
+		DeleteRegisterFingerBmp();
+		return 0;
+	}
+
+	if (ctx->Req.fingerSNList.GetCount() != 3) {	
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Generate_Template_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_GETTEMPLATE_PARAM_FAIL))("指纹模版生成失败,输入参数错误");
+		ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_GETTEMPLATE_PARAM_FAIL);//RTA242B
+		DeleteRegisterFingerBmp();
+		return 0;
+	}
+
+	for (int i = 0; i < ctx->Req.fingerSNList.GetCount(); ++i)
+	{
+		CSimpleStringA tempStr = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "finger%d.bmp", strPath.GetData(), ctx->Req.fingerSNList[i]);
+
+		UpdateAndWarnFileFindInDepBak(tempStr, CSimpleStringA::Format("finger%d.bmp", ctx->Req.fingerSNList[i]), FingerPrint_UserErrorCode_FindFile_in_DepBak);
+
+		if (!ExistsFileA(tempStr.GetData()))
+		{
+			CSimpleStringA errMsg = CSimpleStringA::Format("<GenerateTemplateJS>, image <%s> not exist.", tempStr.GetData());
+			LogWarn(Severity_Middle, Error_Hardware, FingerPrint_UserErrorCode_GETTEMPLATE_NO_FILE, errMsg.GetData());
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Generate_Template_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_GETTEMPLATE_NO_FILE))("指纹模版生成失败,指纹图片不存在");
+			ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_GETTEMPLATE_NO_FILE);//RTA242C
+			DeleteRegisterFingerBmp();
+			return 0;
+		}
+		else {
+			imagePaths.push_back(tempStr);
+			insertRegisterFingerBmp(tempStr);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<GenerateTemplateJS>,imagePaths[%d]=%s", i, tempStr.GetData());
+		}
+		
+	}
+	
+
+	ErrorCodeEnum errCode;
+	LPBYTE lpbTemplate = new BYTE[MAX_FEATURE_LEN];
+	int lpbLength = MAX_FEATURE_LEN;
+
+	ULLINT l_beginTime, l_endTime;
+	l_beginTime = SP::Module::Comm::RVCGetTickCount();
+	errCode = m_hDevHelper->Image2Template(imagePaths[0], imagePaths[1], imagePaths[2], lpbTemplate, lpbLength);
+	l_endTime = SP::Module::Comm::RVCGetTickCount();
+
+	DWORD dwTmpUserErrCode = 0;
+	if (Error_Succeed == errCode)
+	{
+		if (lpbTemplate != NULL && lpbLength == STANDARD_FEATURE_LEN) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::Image2Template").setLogCode(FingerPrint_Generate_Template_ID).setCostTime(l_endTime - l_beginTime)("指纹仪模板生成成功 , template length is %d", lpbLength);
+			lpbTemplate[lpbLength] = '\0';
+			ctx->Ans.templateFeature = (LPCTSTR)lpbTemplate;
+		}
+		else {
+			CSimpleStringA errMsg = CSimpleStringA::Format("template is NULL or template length is not right(%d)", lpbLength);
+			LogWarn(Severity_Middle, Error_Hardware, FingerPrint_UserErrorCode_TEMPLATELEN_ISNOTRIGHT, errMsg.GetData());
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI("DevAdapter::Image2Template").setLogCode(FingerPrint_Generate_Template_ID).setCostTime(l_endTime - l_beginTime).setResultCode(getRTACode(FingerPrint_UserErrorCode_TEMPLATELEN_ISNOTRIGHT))("指纹仪模板生成失败,%s", errMsg.GetData());
+			dwTmpUserErrCode = FingerPrint_UserErrorCode_TEMPLATELEN_ISNOTRIGHT;//RTA2428
+			errCode = Error_Unexpect;
+		}
+	}
+	else {
+		dwTmpUserErrCode = SetErrorAndLog(errCode, MEC_DEVAPI_FINGERPRINT_Image2Template, "DevAdapter::Image2Template", __FUNCTION__, false, l_endTime - l_beginTime, "", "指纹仪模板生成失败");//RTA2418
+		errCode = Error_Unexpect;
+	}
+
+	DeleteRegisterFingerBmp();
+
+	if (errCode == Error_Succeed) {
+		ctx->Answer(Error_Succeed);
+	}
+	else {
+		ctx->Answer(errCode, dwTmpUserErrCode);
+	}
+
+	delete[] lpbTemplate;
+	lpbTemplate = NULL;
+
+	return 0;
+}
+
+ErrorCodeEnum CFingerPrintFSM::GetImgBlob(CBlob& data, CSimpleStringA imgPath)
+{
+	ErrorCodeEnum eErr;
+	FILE* fp = fopen(imgPath, "rb");
+	if (fp) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetImgBlob %s succeed", imgPath.GetData());
+		fseek(fp, 0, SEEK_END);
+		long flen = ftell(fp);
+		fseek(fp, 0, SEEK_SET);
+		data.Alloc(flen);
+		fread(data.m_pData, 1, flen, fp);
+		fclose(fp);
+		eErr = Error_Succeed;
+	}
+	else {
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetImgBlob %s failed!", imgPath.GetData());
+		eErr = Error_IO;
+	}
+	return eErr;
+}
+
 #pragma region register interface - not use anymore in uos
 
 
@@ -789,6 +1153,86 @@ void CFingerPrintFSM::DeleteBmp(int type)
 	}
 }
 
+ErrorCodeEnum CFingerPrintFSM::DeleteFingerBmp(CSimpleStringA imgPath)
+{
+	if (ExistsFileA(imgPath))
+	{
+		if (RemoveFileA(imgPath))
+		{
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DeleteFile(%s) success.", imgPath.GetData());
+			return Error_Succeed;
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("DeleteFile(%s) failed LastError(%d).", imgPath.GetData(), errno);
+			return Error_Unexpect;
+		}
+	}
+	else {
+		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("file %s not exist.", imgPath);
+		return Error_Succeed;
+	}
+}
+
+ErrorCodeEnum CFingerPrintFSM::DeleteRegisterFingerBmp()
+{
+	m_fingerfileMtx.lock();
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("execute DeleteRegisterFinger begin,imgPathSet count: %d", m_fingerPrintFileSet.size());
+	auto it = m_fingerPrintFileSet.begin();
+	while (it != m_fingerPrintFileSet.end()) {
+		CSimpleStringA imgPath = *it;
+		if (ExistsFileA(imgPath))
+		{
+			if (RemoveFileA(imgPath))
+			{
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DeleteFile(%s) success.", imgPath.GetData());
+				it = m_fingerPrintFileSet.erase(it);
+			}
+			else
+			{
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("DeleteFile(%s) failed LastError(%d).", imgPath.GetData(), errno);
+				m_fingerfileMtx.unlock();
+				return Error_Unexpect;
+			}
+		}
+		else {
+			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("file %s not exist.", imgPath);
+			it = m_fingerPrintFileSet.erase(it);
+		}
+	}
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("execute DeleteRegisterFinger after,imgPathSet count: %d", m_fingerPrintFileSet.size());
+	m_fingerfileMtx.unlock();
+	return Error_Succeed;
+}
+
+void CFingerPrintFSM::insertRegisterFingerBmp(CSimpleStringA bmpPath)
+{
+	m_fingerfileMtx.lock();
+	m_fingerPrintFileSet.insert(bmpPath);
+	m_fingerfileMtx.unlock();
+}
+
+DWORD CFingerPrintFSM::GetFsmStateErrCode()
+{
+	CSimpleStringA currStateName = GetCurrStateName();
+
+	if (currStateName.Compare("Normal") == 0) {
+		return FingerPrint_UserErrorCode_PROCESS_NORMAL;
+	}
+	else if (currStateName.Compare("Scan") == 0) {
+		return FingerPrint_UserErrorCode_PROCESS_SCAN;
+	}
+	else if (currStateName.Compare("Fail") == 0) {
+		return FingerPrint_UserErrorCode_PROCESS_FAIL;
+	}
+	else  if (currStateName.Compare("Init") == 0) {
+		return FingerPrint_UserErrorCode_PROCESS_INIT;
+	}
+	else {
+		return FingerPrint_UserErrorCode_PROCESS_CANNOT_PROCESS;
+	}
+}
+
 ErrorCodeEnum CFingerPrintFSM::DeleteFileIfExisted(const char* fileName)
 {
 	if (strlen(fileName) == 0 || strchr(fileName, (int)'*') != NULL)

+ 108 - 1
Module/mod_FingerPrint/FingerPrintFSM.h

@@ -5,6 +5,8 @@
 #include "DevFSMCommBase.hpp"
 #include "FingerPrintClass.h"
 #include "FingerPrint_UserErrorCode.h"
+#include <set>
+#include <mutex>
 
 #include "CommEntityUtil.hpp"
 
@@ -37,6 +39,13 @@ enum EvtType
 	USER_EVT_EXIT,
 	USER_EVT_FWB_OPEN_SUC,
 	USER_EVT_FWB_OPEN_SUC_FINISHED,
+	USER_EVT_JS_GET_FINGERPRINT,
+	USER_EVT_JS_GET_FINGERPRINT_FINISHED,
+	USER_EVT_JS_GENERATE_TEMPLATE,
+	USER_EVT_JS_GENERATE_TEMPLATE_FINISHED,
+	USER_EVT_JS_CANCEL_SCAN,
+	USER_EVT_JS_CANCEL_SCAN_FINISHED
+
 };
 
 enum BmpType
@@ -193,6 +202,52 @@ public:
 	}
 };
 
+//JS
+class GetFingerPrintJSEvent : public FSMEvent
+{
+public:
+	GetFingerPrintJSEvent() : FSMEvent(USER_EVT_JS_GET_FINGERPRINT) {}
+	virtual ~GetFingerPrintJSEvent() {}
+	SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req, FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx;
+	virtual void OnUnhandled()
+	{
+		if (ctx != NULL)
+		{
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetFingerPrintJS unhandled");
+		}
+	}
+};
+
+class GenerateTemplateJSEvent : public FSMEvent
+{
+public:
+	GenerateTemplateJSEvent() : FSMEvent(USER_EVT_JS_GENERATE_TEMPLATE) {}
+	virtual ~GenerateTemplateJSEvent() {}
+	SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req, FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx;
+	virtual void OnUnhandled()
+	{
+		if (ctx != NULL)
+		{
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GenerateTemplateJS unhandled.");
+		}
+	}
+};
+
+class CancelScanJSEvent : public FSMEvent
+{
+public:
+	CancelScanJSEvent() : FSMEvent(USER_EVT_JS_CANCEL_SCAN) {}
+	virtual ~CancelScanJSEvent() {}
+	SpReqAnsContext<FingerPrintService_CancelScanJS_Req, FingerPrintService_CancelScanJS_Ans>::Pointer ctx;
+	virtual void OnUnhandled()
+	{
+		if (ctx != NULL)
+		{
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GenerateTemplateJS unhandled.");
+		}
+	}
+};
+
 class CFingerPrintFSM : public CCommDevFSM<CFingerPrintFSM, FingerPrintClass>
 {
 public:
@@ -216,6 +271,8 @@ public:
 		FSM_RULE_ENTRY(s0, s2, USER_EVT_ERROR, 0)
 		FSM_RULE_ENTRY(s0, s3, USER_EVT_MATCH, 0)
 		FSM_RULE_ENTRY(s0, s4, USER_EVT_FWB_OPEN_SUC_FINISHED, 0)
+		FSM_RULE_ENTRY(s0, s1, USER_EVT_JS_GET_FINGERPRINT, 0)//js 扫描
+		FSM_RULE_ENTRY(s0, s1, USER_EVT_JS_GENERATE_TEMPLATE, 0)//js 指纹模版
 		FSM_RULE_ENTRY(s1, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
 		FSM_RULE_ENTRY(s1, s0, USER_EVT_SCAN_FINISHED, 0)
 		FSM_RULE_ENTRY(s1, s2, USER_EVT_SCAN_FINISHED, 2)
@@ -225,6 +282,8 @@ public:
 		FSM_RULE_ENTRY(s1, s2, USER_EVT_GETFINGER_FINISHED, 2)
 		FSM_RULE_ENTRY(s1, s0, USER_EVT_GENERATE_TEMPLATE_FINISHED, 0)
 		FSM_RULE_ENTRY(s1, s2, USER_EVT_GENERATE_TEMPLATE_FINISHED, 2)
+		FSM_RULE_ENTRY(s1, s0, USER_EVT_JS_GET_FINGERPRINT_FINISHED, 0)//js 扫描
+		FSM_RULE_ENTRY(s1, s0, USER_EVT_JS_GENERATE_TEMPLATE_FINISHED, 0)//js 指纹模版
 		FSM_RULE_ENTRY(s2, s4, USER_EVT_FWB_OPEN_SUC_FINISHED, 0)
 		FSM_RULE_ENTRY(s3, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
 		FSM_RULE_ENTRY(s3, s0, USER_EVT_MATCH_FINISHED, 0)
@@ -234,7 +293,8 @@ public:
 	END_FSM_RULE()
 
 	CFingerPrintFSM():m_bCancelRegister(false), m_bCancelMatch(false), m_bExit(false),
-					  m_testResult(Error_Succeed),m_csMachineType(""), m_terminalNo(""), m_machineVersion("")
+					  m_testResult(Error_Succeed),m_csMachineType(""), m_terminalNo(""), m_machineVersion(""),
+					  m_bCancelScan(false), m_bExitMainPage(false)
 					{	
 						HARDWARE_ENTITY_RESET_ENTITYID(m_entCode, 0x204); 
 					}
@@ -287,7 +347,25 @@ private:
 	bool m_bCancelMatch;
 	bool m_bExit;
 	CSimpleStringA m_csMachineType, m_terminalNo, m_machineVersion;
+	
+public:
+	int GetFingerPrintJS(SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req, FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx);
+	int GenerateTemplateJS(SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req, FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx);
+
+	ErrorCodeEnum GetImgBlob(CBlob& data, CSimpleStringA imgPath);
+	ErrorCodeEnum DeleteFingerBmp(CSimpleStringA imgPath);
+	ErrorCodeEnum DeleteRegisterFingerBmp();
+	void insertRegisterFingerBmp(CSimpleStringA bmpPath);
+
+	DWORD GetFsmStateErrCode();
+
+private:
+	bool m_bCancelScan;
+	bool m_bExitMainPage;
+	set<CSimpleStringA> m_fingerPrintFileSet;
+	std::mutex m_fingerfileMtx;          
 };
+
 //废弃
 struct ScanTask : public ITaskSp   
 {
@@ -375,4 +453,33 @@ struct InitTask : public ITaskSp
 	}
 };
 
+//JS
+struct GetFingerPrintJSTask : public ITaskSp
+{
+	CFingerPrintFSM* fsm;
+	SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req, FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx;
+	GetFingerPrintJSTask(CFingerPrintFSM* f) : fsm(f) {}
+	void Process()
+	{
+		LOG_FUNCTION();
+		FSMEvent* e = new FSMEvent(USER_EVT_JS_GET_FINGERPRINT_FINISHED);
+		e->param1 = fsm->GetFingerPrintJS(ctx);
+		fsm->PostEventFIFO(e);
+	}
+};
+
+struct GenerateTemplateJSTask : public ITaskSp
+{
+	CFingerPrintFSM* fsm;
+	SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req, FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx;
+	GenerateTemplateJSTask(CFingerPrintFSM* f) : fsm(f) {}
+	void Process()
+	{
+		LOG_FUNCTION();
+		FSMEvent* e = new FSMEvent(USER_EVT_JS_GENERATE_TEMPLATE_FINISHED);
+		e->param1 = fsm->GenerateTemplateJS(ctx);
+		fsm->PostEventFIFO(e);
+	}
+};
+
 #endif

+ 15 - 0
Module/mod_FingerPrint/FingerPrint_UserErrorCode.h

@@ -44,7 +44,22 @@
 
 #define FingerPrint_UserErrorCode_FEATURELEN_ISNOTRIGHT_MATCH			0x20400224		//识别时 返回的指纹特征长度错误
 #define FingerPrint_UserErrorCode_DevOpen_Failed_Registe				0x20400225	//采集指纹时,指纹是打开失败状态
+#define FingerPrint_UserErrorCode_CANCEL_SCAN							0x20400226	//扫描取消
+#define FingerPrint_UserErrorCode_CANCEL_GETTEMPLATE					0x20400227	//生成取消
+#define FingerPrint_UserErrorCode_TEMPLATELEN_ISNOTRIGHT				0x20400228	//指纹模版生产长度不对
+#define FingerPrint_UserErrorCode_GET_FINGERBLOB_FAIL					0x20400229	//获取指纹图片内容失败
+#define FingerPrint_UserErrorCode_GETTEMPLATE_NO_FILE					0x2040022a	//指纹模版需要的指纹文件不存在
+#define FingerPrint_UserErrorCode_GETTEMPLATE_PARAM_FAIL				0x2040022b	//指纹模版输入参数错误
+#define FingerPrint_UserErrorCode_DEVOPENFAILED_CANCELSCAN_FAIL			0x2040022c	//指纹DevOpen失败,业务调用CancelScan时报错
 
 #define FingerPrint_UserErrorCode_FindFile_in_DepBak					0x20400232	//在旧Dep路径下找到文件
+#define FingerPrint_UserErrorCode_GET_FINGERPRINT_PARAM_FAIL			0x20400233	//指纹扫描输入参数错误
+
+//指纹流程状态报错
+#define FingerPrint_UserErrorCode_PROCESS_NORMAL						0x20400401		//当前处于指纹仪空闲状态,无法处理此请求
+#define FingerPrint_UserErrorCode_PROCESS_SCAN							0x20400402		//当前处于指纹仪扫描工作状态,无法处理此请求
+#define FingerPrint_UserErrorCode_PROCESS_FAIL							0x20400403		//当前处于指纹仪故障异常状态,无法处理此请求
+#define FingerPrint_UserErrorCode_PROCESS_INIT							0x20400404		//当前处于指纹仪初始化状态,无法处理此请求
+#define FingerPrint_UserErrorCode_PROCESS_CANNOT_PROCESS				0x20400405		//指纹仪当前状态无法处理此请求
 
 #endif

+ 147 - 0
Module/mod_FingerPrint/FingerPrint_client_g.h

@@ -443,6 +443,153 @@ public:
 		return Error;
 	}
 
+	ErrorCodeEnum GetFingerPrintJS(FingerPrintService_GetFingerPrintJS_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(FingerPrintService_Method_GetFingerPrintJS, FingerPrintService_MethodSignature_GetFingerPrintJS, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum GetFingerPrintJS(FingerPrintService_GetFingerPrintJS_Req &Req, FingerPrintService_GetFingerPrintJS_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GetFingerPrintJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum GetFingerPrintJS(FingerPrintService_GetFingerPrintJS_Req &Req, FingerPrintService_GetFingerPrintJS_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GetFingerPrintJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum GetFingerPrintJS(FingerPrintService_GetFingerPrintJS_Req &Req, FingerPrintService_GetFingerPrintJS_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GetFingerPrintJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
+	ErrorCodeEnum GenerateTemplateJS(FingerPrintService_GenerateTemplateJS_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(FingerPrintService_Method_GenerateTemplateJS, FingerPrintService_MethodSignature_GenerateTemplateJS, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum GenerateTemplateJS(FingerPrintService_GenerateTemplateJS_Req &Req, FingerPrintService_GenerateTemplateJS_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GenerateTemplateJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum GenerateTemplateJS(FingerPrintService_GenerateTemplateJS_Req &Req, FingerPrintService_GenerateTemplateJS_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GenerateTemplateJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum GenerateTemplateJS(FingerPrintService_GenerateTemplateJS_Req &Req, FingerPrintService_GenerateTemplateJS_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = GenerateTemplateJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
+	ErrorCodeEnum CancelScanJS(FingerPrintService_CancelScanJS_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(FingerPrintService_Method_CancelScanJS, FingerPrintService_MethodSignature_CancelScanJS, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum CancelScanJS(FingerPrintService_CancelScanJS_Req &Req, FingerPrintService_CancelScanJS_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = CancelScanJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum CancelScanJS(FingerPrintService_CancelScanJS_Req &Req, FingerPrintService_CancelScanJS_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = CancelScanJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum CancelScanJS(FingerPrintService_CancelScanJS_Req &Req, FingerPrintService_CancelScanJS_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = CancelScanJS(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
 
 	bool SafeDelete()
 	{

+ 88 - 0
Module/mod_FingerPrint/FingerPrint_def_g.h

@@ -22,6 +22,9 @@ namespace FingerPrint {
 #define FingerPrintService_Method_GetImageAndFeatureEx 6
 #define FingerPrintService_Method_GetFingerPrint 7
 #define FingerPrintService_Method_GenerateTemplate 8
+#define FingerPrintService_Method_GetFingerPrintJS 9
+#define FingerPrintService_Method_GenerateTemplateJS 10
+#define FingerPrintService_Method_CancelScanJS 11
 
 #define FingerPrintService_MethodSignature_GetImageAndFeature 248238486
 #define FingerPrintService_MethodSignature_CancelRegister -1073046765
@@ -33,6 +36,9 @@ namespace FingerPrint {
 #define FingerPrintService_MethodSignature_GetImageAndFeatureEx 86600716
 #define FingerPrintService_MethodSignature_GetFingerPrint -2051396936
 #define FingerPrintService_MethodSignature_GenerateTemplate 1610871029
+#define FingerPrintService_MethodSignature_GetFingerPrintJS -291306234
+#define FingerPrintService_MethodSignature_GenerateTemplateJS 6087154
+#define FingerPrintService_MethodSignature_CancelScanJS -991804256
 
 #define FingerPrintService_LogCode_GetImageAndFeature "QLR040220400"
 #define FingerPrintService_LogCode_CancelRegister "QLR040220401"
@@ -44,6 +50,9 @@ namespace FingerPrint {
 #define FingerPrintService_LogCode_GetImageAndFeatureEx "QLR040220406"
 #define FingerPrintService_LogCode_GetFingerPrint "QLR040220407"
 #define FingerPrintService_LogCode_GenerateTemplate "QLR040220408"
+#define FingerPrintService_LogCode_GetFingerPrintJS "QLR040220409"
+#define FingerPrintService_LogCode_GenerateTemplateJS "QLR040220410"
+#define FingerPrintService_LogCode_CancelScanJS "QLR040220411"
 
 struct FingerPrintService_GetImageAndFeature_Req
 {
@@ -243,6 +252,85 @@ struct FingerPrintService_GenerateTemplate_Ans
 
 };
 
+struct FingerPrintService_GetFingerPrintJS_Req
+{
+	int fingerSN;
+	int scanTimeOut;
+	CAutoArray<int> reserved1;
+	CAutoArray<CSimpleStringA> reserved2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & fingerSN & scanTimeOut & reserved1 & reserved2;
+	}
+
+};
+
+struct FingerPrintService_GetFingerPrintJS_Ans
+{
+	CSimpleStringA feature;
+	CBlob fingerImg;
+	int fingerImgLen;
+	CAutoArray<int> reserved1;
+	CAutoArray<CSimpleStringA> reserved2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & feature & fingerImg & fingerImgLen & reserved1 & reserved2;
+	}
+
+};
+
+struct FingerPrintService_GenerateTemplateJS_Req
+{
+	CAutoArray<int> fingerSNList;
+	CAutoArray<int> reserved1;
+	CAutoArray<CSimpleStringA> reserved2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & fingerSNList & reserved1 & reserved2;
+	}
+
+};
+
+struct FingerPrintService_GenerateTemplateJS_Ans
+{
+	CSimpleStringA templateFeature;
+	CAutoArray<int> reserved1;
+	CAutoArray<CSimpleStringA> reserved2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & templateFeature & reserved1 & reserved2;
+	}
+
+};
+
+struct FingerPrintService_CancelScanJS_Req
+{
+	CAutoArray<int> reserved1;
+	CAutoArray<CSimpleStringA> reserved2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & reserved1 & reserved2;
+	}
+
+};
+
+struct FingerPrintService_CancelScanJS_Ans
+{
+	CAutoArray<int> reserved1;
+	CAutoArray<CSimpleStringA> reserved2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & reserved1 & reserved2;
+	}
+
+};
+
 
 ///////////////////////////
 

+ 81 - 0
Module/mod_FingerPrint/FingerPrint_server_g.h

@@ -100,6 +100,27 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case FingerPrintService_Method_GetFingerPrintJS:
+			if (dwSignature == FingerPrintService_MethodSignature_GetFingerPrintJS) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case FingerPrintService_Method_GenerateTemplateJS:
+			if (dwSignature == FingerPrintService_MethodSignature_GenerateTemplateJS) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case FingerPrintService_Method_CancelScanJS:
+			if (dwSignature == FingerPrintService_MethodSignature_CancelScanJS) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -161,6 +182,21 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case FingerPrintService_Method_GetFingerPrintJS:
+			if (dwSignature != FingerPrintService_MethodSignature_GetFingerPrintJS) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case FingerPrintService_Method_GenerateTemplateJS:
+			if (dwSignature != FingerPrintService_MethodSignature_GenerateTemplateJS) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
+		case FingerPrintService_Method_CancelScanJS:
+			if (dwSignature != FingerPrintService_MethodSignature_CancelScanJS) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -218,6 +254,21 @@ public:
 	/// override by user
 	}
 
+	virtual void Handle_GetFingerPrintJS(SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req, FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
+	virtual void Handle_GenerateTemplateJS(SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req, FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
+	virtual void Handle_CancelScanJS(SpReqAnsContext<FingerPrintService_CancelScanJS_Req, FingerPrintService_CancelScanJS_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
 	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CAutoBuffer Buf;
@@ -334,6 +385,36 @@ public:
 						Handle_GenerateTemplate(ctx);
 					}
 					break;
+				case FingerPrintService_Method_GetFingerPrintJS:
+					{
+						SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req,FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req,FingerPrintService_GetFingerPrintJS_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_GetFingerPrintJS(ctx);
+					}
+					break;
+				case FingerPrintService_Method_GenerateTemplateJS:
+					{
+						SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req,FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req,FingerPrintService_GenerateTemplateJS_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_GenerateTemplateJS(ctx);
+					}
+					break;
+				case FingerPrintService_Method_CancelScanJS:
+					{
+						SpReqAnsContext<FingerPrintService_CancelScanJS_Req,FingerPrintService_CancelScanJS_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<FingerPrintService_CancelScanJS_Req,FingerPrintService_CancelScanJS_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_CancelScanJS(ctx);
+					}
+					break;
 				default:
 					assert(0);
 					break;

+ 27 - 0
Module/mod_FingerPrint/mod_FingerPrint.cpp

@@ -84,6 +84,33 @@ void FingerPrintServerSession::Handle_Exit(SpOnewayCallContext<FingerPrintServic
 	m_pEntity->Exit(ctx);
 }
 
+#pragma region JS接口实现
+
+void FingerPrintServerSession::Handle_GetFingerPrintJS(SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req, FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx)
+{
+	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke GetFingerPrintJS , fingerSN = %d, scanTimeOut = %d", ctx->Req.fingerSN,ctx->Req.scanTimeOut);
+	m_pEntity->GetFingerPrintJS(ctx);
+}
+void FingerPrintServerSession::Handle_GenerateTemplateJS(SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req, FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx)
+{
+	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke GenerateTemplateJS");
+	m_pEntity->GenerateTemplateJS(ctx);
+}
+void FingerPrintServerSession::Handle_CancelScanJS(SpReqAnsContext<FingerPrintService_CancelScanJS_Req, FingerPrintService_CancelScanJS_Ans>::Pointer ctx)
+{
+	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
+	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CancelScanJS");
+	m_pEntity->CancelScanJS(ctx);
+}
+
+
+#pragma endregion JS接口实现
+
 void CFingerPrintEntity::OnSysVarEvent(const char *pszKey,
 	const char *pszValue, const char *pszOldValue, const char *pszEntityName)
 {

+ 64 - 0
Module/mod_FingerPrint/mod_FingerPrint.h

@@ -26,6 +26,10 @@ public:
 	virtual void Handle_GetDevStatus(SpReqAnsContext<FingerPrintService_GetDevStatus_Req, FingerPrintService_GetDevStatus_Ans>::Pointer ctx);
 	virtual void Handle_Match(SpReqAnsContext<FingerPrintService_Match_Req, FingerPrintService_Match_Ans>::Pointer ctx);
 	virtual void Handle_Exit(SpOnewayCallContext<FingerPrintService_Exit_Info>::Pointer ctx);
+	//新增接口
+	virtual void Handle_GetFingerPrintJS(SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req, FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx);
+	virtual void Handle_GenerateTemplateJS(SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req, FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx);
+	virtual void Handle_CancelScanJS(SpReqAnsContext<FingerPrintService_CancelScanJS_Req, FingerPrintService_CancelScanJS_Ans>::Pointer ctx);
 private:
 	CFingerPrintEntity* m_pEntity;
 };
@@ -185,6 +189,66 @@ public:
 		FSMEvent* e = new FSMEvent(USER_EVT_EXIT);
 		m_fsm.PostEventFIFO(e);
 	}
+	//js接口
+	void GetFingerPrintJS(SpReqAnsContext<FingerPrintService_GetFingerPrintJS_Req, FingerPrintService_GetFingerPrintJS_Ans>::Pointer ctx)
+	{
+		if (!m_fsm.GetDevInitFlag()) {
+			ctx->Answer(Error_DevNotAvailable, FingerPrint_UserErrorCode_DEVOPENFAILED_GETFINGERPRINT);
+			LogWarn(Severity_Middle, Error_DevNotAvailable, FingerPrint_UserErrorCode_DEVOPENFAILED_GETFINGERPRINT, "GetFingerPrintJS but DevOpen failed.");
+		}
+		else if (_stricmp(m_fsm.GetCurrStateName(), "Normal") != 0) {
+			//不符合请求调用,告知具体错误流程
+			DWORD errCode = m_fsm.GetFsmStateErrCode();
+			CSimpleStringA stateName = m_fsm.GetCurrStateName();
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetFingerPrintJS req is unhandled ,CurrState=%d", stateName.GetData());
+			ctx->Answer(Error_Unexpect, errCode);
+		}
+		else {
+			GetFingerPrintJSEvent* e = new GetFingerPrintJSEvent();
+			e->ctx = ctx;
+			m_fsm.PostEventFIFO(e);
+		}
+	}
+
+	void GenerateTemplateJS(SpReqAnsContext<FingerPrintService_GenerateTemplateJS_Req, FingerPrintService_GenerateTemplateJS_Ans>::Pointer ctx)
+	{
+		if (!m_fsm.GetDevInitFlag()) {
+			ctx->Answer(Error_DevNotAvailable, FingerPrint_UserErrorCode_DEVOPENFAILED_GenerateTemplate);
+			LogWarn(Severity_Middle, Error_DevNotAvailable, FingerPrint_UserErrorCode_DEVOPENFAILED_GenerateTemplate, "GenerateTemplateJS but DevOpen failed.");
+		}
+		else if (_stricmp(m_fsm.GetCurrStateName(), "Normal") != 0) {
+			//不符合请求调用,告知具体错误流程
+			DWORD errCode = m_fsm.GetFsmStateErrCode();
+			CSimpleStringA stateName = m_fsm.GetCurrStateName();
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GenerateTemplateJS req is unhandled ,CurrState=%d", stateName.GetData());
+			ctx->Answer(Error_Unexpect, errCode);
+		}
+		else {
+			GenerateTemplateJSEvent* e = new GenerateTemplateJSEvent();
+			e->ctx = ctx;
+			m_fsm.PostEventFIFO(e);
+		}
+	}
+
+	void CancelScanJS(SpReqAnsContext<FingerPrintService_CancelScanJS_Req, FingerPrintService_CancelScanJS_Ans>::Pointer ctx)
+	{
+		if (!m_fsm.GetDevInitFlag()) {
+			ctx->Answer(Error_DevNotAvailable, FingerPrint_UserErrorCode_DEVOPENFAILED_CANCELSCAN_FAIL);
+			LogWarn(Severity_Middle, Error_DevNotAvailable, FingerPrint_UserErrorCode_DEVOPENFAILED_CANCELSCAN_FAIL, "CancelScanJS but DevOpen failed.");
+		}
+		else if (_stricmp(m_fsm.GetCurrStateName(), "Normal") != 0 && _stricmp(m_fsm.GetCurrStateName(), "Scan") != 0) {
+			//不符合请求调用,告知具体错误流程
+			DWORD errCode = m_fsm.GetFsmStateErrCode();
+			CSimpleStringA stateName = m_fsm.GetCurrStateName();
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("CancelScanJS req is unhandled ,CurrState=%d", stateName.GetData());
+			ctx->Answer(Error_Unexpect, errCode);
+		}
+		else {
+			CancelScanJSEvent* e = new CancelScanJSEvent();
+			e->ctx = ctx;
+			m_fsm.PostEventFIFO(e);
+		}
+	}
 
 	virtual void OnSysVarEvent(const char *pszKey,
 		const char *pszValue, const char *pszOldValue, const char *pszEntityName);

+ 9 - 30
Module/mod_HSPScanner/HSPScannerFSM.cpp

@@ -1503,7 +1503,6 @@ int CHSPScannerFSM::StartPreview(SpReqAnsContext<HSPScannerService_StartPreview_
 			SetLastUserCode(dwCode);
 		}
 	} else if (ISSUCCEEDED(erroCode)) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("Start to SetPreview(1)...");
 		const ULONGLONG ullStart = SP::Module::Comm::RVCGetTickCount();
 		erroCode = m_hDevHelper->SetPreview(1);
 		const ULONGLONG ullEnd = SP::Module::Comm::RVCGetTickCount();
@@ -1547,7 +1546,6 @@ int CHSPScannerFSM::StopPreview(SpReqAnsContext<HSPScannerService_CancelPreview_
 	}
 	else
 	{
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("Start to SetPreview(0).");
 		const ULONGLONG ullStart = SP::Module::Comm::RVCGetTickCount();
 		erroCode = m_hDevHelper->SetPreview(0);
 		const ULONGLONG ullEnd = SP::Module::Comm::RVCGetTickCount();
@@ -1591,10 +1589,8 @@ bool CHSPScannerFSM::ResizeImage(const CSimpleStringA& fileName, int kbSize)
 	long fileSize = ftell(fHandle);
 	fclose(fHandle);
 	if (fileSize <= (imageSize)) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("File(%s)(%u<=%u) no need resize.", (LPCTSTR)fileName, fileSize, imageSize);
 		return TRUE;
 	}
-
 	CSimpleStringA backUpFile, backUpPath;
     m_pEntity->GetFunction()->GetPath("Temp", backUpPath);
 	backUpFile = backUpPath + SPLIT_SLASH_STR + "backupHSPSCannerImage";
@@ -1615,7 +1611,6 @@ bool CHSPScannerFSM::ResizeImage(const CSimpleStringA& fileName, int kbSize)
 			success = FALSE;
 			break;
 		}
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("to resize %lf rate...", rate);
 		width = img.cols;
 		height = img.rows;
 		cv::resize(img, img, cv::Size(width * rate, height * rate));
@@ -1644,7 +1639,6 @@ bool CHSPScannerFSM::ResizeImage(const CSimpleStringA& fileName, int kbSize)
 	}
 	fileSize = fileSize / 1024;
 	DeleteFileIfExisted(backUpFile);
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("HSPScanner resize image succeed, SIZE : %d KB.", fileSize);
 	return TRUE;
 }
 
@@ -1666,7 +1660,7 @@ int CHSPScannerFSM::ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
 	erroCode = m_hDevHelper->ScanImage((LPCTSTR)csImageFile);
 	ULONGLONG ullEnd = SP::Module::Comm::RVCGetTickCount();
 	if (ISSUCCEEDED(erroCode)) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::ScanImage").setCostTime(ullEnd - ullStart)("DevAdapter::ScanImage succ");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::ScanImage").setCostTime(ullEnd - ullStart)("ScanImage succ");
 		///*TODO:  (80374374@2/20/2024)*/
 		if (!ResizeImage(csImageFile, m_dwMaxImageSize)) {
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setResultCode(MapCode2RTAString(LOG_WARN_HSPS_RESIZE_IMAGE_FILE_FAILED)).setAPI(__FUNCTION__)("HSPScanner resize image failed");
@@ -1705,11 +1699,11 @@ int CHSPScannerFSM::ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
 				ErrorCodeEnum eHide = m_hDevHelper->SetParam(HSPS_MODEL_VIEW, HSPS_VIEW_HIDE);
 				ullEnd = SP::Module::Comm::RVCGetTickCount();
 				if (ISSUCCEEDED(eHide)) {
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::SetParam").setCostTime(ullEnd - ullStart)("Hide Preview Dialog");
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::SetParam").setCostTime(ullEnd - ullStart)("HSPS_MODEL_VIEW::HSPS_VIEW_HIDE");
 					nRes = 6;
 				} else {
 					//RTA2N0Q
-					SetErrorAndLog(eHide, MEC_DEVAPI_HSPSCANNER_SetParam, "DevAdapter::SetParam", __FUNCTION__, IsInBusiness(), ullEnd - ullStart, HSPScannerService_LogCode_ScanImage, CombineJsonContext("HSPS_VIEW_HIDE"));
+					SetErrorAndLog(eHide, MEC_DEVAPI_HSPSCANNER_SetParam, "DevAdapter::SetParam", __FUNCTION__, IsInBusiness(), ullEnd - ullStart, HSPScannerService_LogCode_ScanImage, CombineJsonContext("HSPS_MODEL_VIEW::HSPS_VIEW_HIDE"));
 				}
 				/** 拍照成功虽然隐藏了但没有关闭灯  [Gifur@2025325]*/
 			}
@@ -1723,6 +1717,7 @@ int CHSPScannerFSM::ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
 		ctx->Answer(TransECWithRepeat(erroCode), GetLastUserCode());
 		nRes = 2;
 	}
+	ClearPictureFileSure(1);
 	return nRes;
 }
 
@@ -1796,10 +1791,10 @@ int CHSPScannerFSM::ScanImageEx(SpReqAnsContext<HSPScannerService_ScanImageEx_Re
 			ErrorCodeEnum eHide = m_hDevHelper->SetParam(HSPS_MODEL_VIEW, HSPS_VIEW_HIDE);
 			ullEnd = SP::Module::Comm::RVCGetTickCount();
 			if (ISSUCCEEDED(eHide)) {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::SetParam").setCostTime(ullEnd - ullStart)("Hide Preview Dialog");
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("DevAdapter::SetParam").setCostTime(ullEnd - ullStart)("HSPS_MODEL_VIEW::HSPS_VIEW_HIDE");
 				nRes = 6;
 			} else {
-				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI("DevAdapter::SetParam").setCostTime(ullEnd - ullStart).setResultCode(MapCode2RTAString(HSPScanner_UserErrorCode_SetParam_Hide))("Hide Preview Dialog failed: %s", SpStrError(eHide));
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI("DevAdapter::SetParam").setCostTime(ullEnd - ullStart).setResultCode(MapCode2RTAString(HSPScanner_UserErrorCode_SetParam_Hide))("HSPS_MODEL_VIEW::HSPS_VIEW_HIDE failed: %s", SpStrError(eHide));
 			}
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI(__FUNCTION__).setLogCode(HSPScannerService_LogCode_ScanImageEx)("ScanImageEx ctx: %s, %d.", (LPCTSTR)ctx->Ans.filePath, ctx->Ans.imageData.m_iLength);
 		}
@@ -1816,6 +1811,7 @@ int CHSPScannerFSM::ScanImageEx(SpReqAnsContext<HSPScannerService_ScanImageEx_Re
 		delete pBtImage;
 		pBtImage = NULL;
 	}
+	ClearPictureFileSure(2);
 	return nRes;
 }
 
@@ -1884,11 +1880,8 @@ int CHSPScannerFSM::SetWinPos(SpReqAnsContext<HSPScannerService_SetWinPos_Req,
 	}
 	break;
 	}
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("SetWinPos: %s(%d).", ParamValToString(value), value);
 
 	if (bSetCustom) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("Start to SetViewPos x(%d), y(%d), w(%d), reserved(%d).",
-			ctx->Req.pointX, ctx->Req.pointY, ctx->Req.nWidth, ctx->Req.reserved4);
 		const ULONGLONG ullStart = SP::Module::Comm::RVCGetTickCount();
 		erroCode = m_hDevHelper->SetViewPos(ctx->Req.pointX, ctx->Req.pointY, ctx->Req.nWidth);
 		const ULONGLONG ullEnd = SP::Module::Comm::RVCGetTickCount();
@@ -2054,22 +2047,7 @@ BOOL CHSPScannerFSM::DelAndGetNewFileName(CSimpleStringA& csfileName, bool bInBu
 	strAimPath = strPath + SPLIT_SLASH_STR + fileName;
 
 	UpdateAndWarnFileFindInDepBak(strAimPath, fileName, HSPScanner_UserErrorCode_FindFile_in_DepBak);
-#if 0
-	///*TODO(80374374@10/11/2022): 这段代码上线一段时间后要去除,因为从这个版本开始这个文件就不生成在这个目录了 */
-	if (ExistsFileA(strAimPath)) {
-		if (DeleteFileA((LPCTSTR)strAimPath) != 0) {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DeleteFile(%s) suc.", (LPCTSTR)strAimPath);
-		} else {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DeleteFile(%s) failed LastError(%d).", (LPCTSTR)strAimPath, GetLastError());
-		}
-	}
-	strPath.Clear();
-	GetEntityBase()->GetFunction()->GetPath("Temp", strPath);
-	strAimPath = strPath + SPLIT_SLASH_STR + fileName;
-#endif
-	// Add [Josephus in 17:04:27 2016/10/25]
 	csfileName = strAimPath;
-
 	if (ExistsFileA(csfileName)) {
 		if (RemoveFileA((LPCTSTR)strAimPath) != 0) {
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DeleteFile(%s) suc.", (LPCTSTR)strAimPath);
@@ -2228,7 +2206,7 @@ int CHSPScannerFSM::ScanImageJS(SpReqAnsContext<HSPScannerService_ScanImageJS_Re
 	erroCode = m_hDevHelper->ScanImage((LPCTSTR)csImageFile);
 	ULONGLONG ullEnd = SP::Module::Comm::RVCGetTickCount();
 	if (ISSUCCEEDED(erroCode)) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::ScanImage").setCostTime(ullEnd - ullStart)("DevAdapter::ScanImage succ");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::ScanImage").setCostTime(ullEnd - ullStart)("ScanImage succ");
 		if (ctx->Req.compress > 0 && !ResizeImage(csImageFile, ctx->Req.compress/*KB*/)) {
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setResultCode(MapCode2RTAString(LOG_WARN_HSPS_RESIZE_IMAGE_FILE_FAILED)).setAPI(__FUNCTION__).setLogCode(HSPScannerService_LogCode_ScanImageJS).setCostTime(ullEnd - ullStart)("HSPScanner resize image failed");
 			SetLastUserCode(LOG_WARN_HSPS_RESIZE_IMAGE_FILE_FAILED);
@@ -2284,6 +2262,7 @@ int CHSPScannerFSM::ScanImageJS(SpReqAnsContext<HSPScannerService_ScanImageJS_Re
 		ret = 1;
 	}
 	ctx->Answer(erroCode, GetLastUserCode());
+	ClearPictureFileSure(1);
 	return ret;
 }
 

+ 11 - 6
Module/mod_HSPScanner/HSPScannerFSM.h

@@ -366,13 +366,18 @@ private:
 	
 	void InitialMaxResizeValue();
 
-	void ClearPictureFileSure()
+	void ClearPictureFileSure(int nMask = 3)
 	{
-		CSimpleStringA strNoUsed(true);
-		GetCurImageName(strNoUsed);
-		DelAndGetNewFileName(strNoUsed);
-		GetCurImageName(strNoUsed, true);
-		DelAndGetNewFileName(strNoUsed);
+		if (!!(nMask & 1)) {
+			CSimpleStringA strNoUsed(true);
+			GetCurImageName(strNoUsed);
+			DelAndGetNewFileName(strNoUsed);
+		}
+		if (!!(nMask & 2)) {
+			CSimpleStringA strNoUsed(true);
+			GetCurImageName(strNoUsed, true);
+			DelAndGetNewFileName(strNoUsed);
+		}
 	}
 };
 

+ 6 - 20
Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp

@@ -588,7 +588,6 @@ time_t ResourceWatcherFSM::GetPathTimeSeconds(const char* inPath)
     }
 
     time_t lCreateTime = 0;
-    //int reTimes = 0;
 
 #ifdef RVC_OS_WIN
     struct _finddata_t fileinfo;//文件信息读取结构
@@ -918,17 +917,13 @@ BOOL ResourceWatcherFSM::DeleteVersionPackage()
                 CSimpleStringA tVerPath;
                 DeleteResult delResult;
                 int nFileCount = 0;
-#ifdef RVC_OS_LINUX
-                tVerPath = verPath + SPLIT_SLASH_STR + (*riter).ToString(); 
-#else
-                tVerPath = verPath + "\\" + (*riter).ToString();
-#endif // RVC_OS_LINUX
+                tVerPath = verPath + SPLIT_SLASH_STR + (*riter).ToString();
                 DeleteParam delParam(tVerPath.GetData());
                 delParam.rtaCode = "RTA5A12";
                 delParam.SetRmDirFlag();//版本文件夹连目录一起清理
                 nFileCount = ProcessFileDelete(delParam, delResult); 
-                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Delete Version result(%s): count(%d), suc(%d), failed(%d).", 
-                    tVerPath.GetData(), nFileCount, delResult.sucCnt, delResult.failCnt);
+				DbgWithLink(delResult.failCnt > 0 ? LOG_LEVEL_WARN : LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Delete Version result(%s): count(%d), suc(%d), failed(%d).",
+					tVerPath.GetData(), nFileCount, delResult.sucCnt, delResult.failCnt);
                 if (delResult.failCnt > 0)
                 {
                     bFailFlag = true;
@@ -992,8 +987,7 @@ void ResourceWatcherFSM::DeleteVideoFiles()
     delParam.rtaCode = "RTA5A13";
     delParam.saveBackDay = backDays;
     const int nFileCount = ProcessFileDelete(delParam, delResult);
-    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Delete [Video] result(%s): count(%d), suc(%d), failed(%d).", videoPath.GetData(), nFileCount, delResult.sucCnt, delResult.failCnt);
-
+	DbgWithLink(delResult.failCnt > 0 ? LOG_LEVEL_WARN : LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Delete [Video] result(%s): count(%d), suc(%d), failed(%d).", videoPath.GetData(), nFileCount, delResult.sucCnt, delResult.failCnt);
 }
 
 void ResourceWatcherFSM::SelfTest(EntityTestEnum eTestType,
@@ -1728,7 +1722,6 @@ int ResourceWatcherFSM::InitialAutoStartupSetType()
     spConfig->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "AutoStartCMD", value);
     if (value != 0) {
         ret = value;
-        DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get AutoStartCMD from CenterSettings: %d", ret);
     }
     return ret;
 }
@@ -2362,10 +2355,7 @@ void ResourceWatcherFSM::DetectAutoStartFileAndWarn()
 		}
         keyset_str += content;
 	}
-
-    //Object2Json(curset_str, curStartupFileInfo);
-	//Object2Json(keyset_str, keyStartFileInfo);
-    LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_DEBUG_STARTUPFILES, curset_str.c_str());
+    //LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_DEBUG_STARTUPFILES, curset_str.c_str());
 	LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_DEBUG_KEY_STARTUPFILES, keyset_str.c_str());
 }
 
@@ -3720,20 +3710,17 @@ void ResourceWatcherFSM::DetectWallpaperAndWarn()
 		if (lResult == ERROR_SUCCESS) {
 			CSimpleStringA strMsg = CSimpleStringA::Format("{\"subject\":\"wallpaper_path\",\"value\":\"%s\"}", szValue);
 			LogWarn(Severity_Low, Error_Debug, LOG_INFO_DESKTOP_WALLPAPER_PATH, strMsg);
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("WallpaperSettings")(strMsg.GetData());
             regeditValue = szValue;
             wellDone = true;
 		}
 		else {
 			CSimpleStringA strMsg = CSimpleStringA::Format("{\"subject\":\"wallpaper_path\",\"error\":\"RegQueryValueEx for Wallpaper returned %u, GLE=%u\"}", lResult, GetLastError());
 			LogWarn(Severity_Low, Error_Unexpect, LOG_WARN_DESKTOP_WALLPAPER_PATH_FETCHFAILE, strMsg);
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("WallpaperSettings").setResultCode("RTA5A0E")(strMsg.GetData());
 		}
 	}
 	else {
 		CSimpleStringA strMsg = CSimpleStringA::Format("{\"subject\":\"wallpaper_path\",\"error\":\"RegOpenKeyEx for Desktop returned %u, GLE=%u\"}", lResult, GetLastError());
 		LogWarn(Severity_Low, Error_Unexpect, LOG_WARN_DESKTOP_WALLPAPER_PATH_FETCHFAILE, strMsg);
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("WallpaperSettings").setResultCode("RTA5A0E")(strMsg.GetData());
 	}
     RegCloseKey(hKey);
     //////////////////////////////////////////////////////////////////////////
@@ -3742,7 +3729,6 @@ void ResourceWatcherFSM::DetectWallpaperAndWarn()
 	int value(0);
     spCtSettingConfig->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "MakeSureCMBWallPaper", value);
 	if (!!value) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get MakeSureCMBWallPaper active flag from CenterSettings");
         wallpapaerSetCMD = true;
 	}
 
@@ -3874,7 +3860,7 @@ void ResourceWatcherFSM::InitUserInfo()
 	if (bRes)
 	{
 		m_strLoginedUserName = pBuffer;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Current logined user name:%s", m_strLoginedUserName.GetData());
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Current logined user name:%s", m_strLoginedUserName.GetData());
     }
     else {
 		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("WTSQuerySessionInformation failed, GLE=%u", GetLastError());

+ 0 - 12
Module/mod_ScannerSet/ScannerSetFSM.cpp

@@ -444,9 +444,6 @@ int CScannerFSM::StopPreview(SpReqAnsContext<ScannerService_CancelPreview_Req,
 			CSimpleStringA::Format("CancelPreview context failed: ErrCode:%s, userCode: 0x%08X.", SpStrError(erroCode), dwUserCode));
 		nRes = 1;
 	}
-	else {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER).setAPI(__FUNCTION__)("CancelPreview context suc.");
-	}
 	return nRes;
 }
 
@@ -543,7 +540,6 @@ int CScannerFSM::SetProperty(SpReqAnsContext<ScannerService_SetProperty_Req,
 	}
 	else {
 		ctx->Ans.retCode = ans.retCode;
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("SetProperty context suc, retCode: ans(%d), ctx(%d).", ans.retCode, ctx->Ans.retCode);
 	}
 	ctx->Answer(erroCode, dwUserCode);
 	return nRes;
@@ -577,10 +573,6 @@ int CScannerFSM::ShowLTProperty(SpReqAnsContext<ScannerService_ShowProperty_Req,
 			nRes = 0;
 		}
 	}
-	else {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("ShowLTProperty context suc.");
-	}
-
 	ctx->Answer(erroCode, dwUserCode);
 	return nRes;
 }
@@ -619,10 +611,6 @@ int CScannerFSM::SetWinPos(SpReqAnsContext<ScannerService_SetWindowPos_Req,
 		}
 		nRes = 1;
 	}
-	else {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("SetWinPos context suc.");
-	}
-
 	ctx->Answer(erroCode, dwUserCode);
 	return nRes;
 }

+ 77 - 5
Module/mod_chromium/CModTools.cpp

@@ -204,6 +204,8 @@ namespace Chromium {
 			errPagePath.Append("homePageErr.html");
 		else if (errType._to_integral() == ERR_PAGE_REASON::startup)
 			errPagePath.Append("startPage.html");
+		else if (errType._to_integral() == ERR_PAGE_REASON::redirect)
+			errPagePath.Append("redirect.html");
 		else
 			errPagePath.Append("entityCheck.html");
 
@@ -585,9 +587,15 @@ namespace Chromium {
 #endif //RVC_OS_LINUX
 	}
 
+	bool startsWithHttpCaseInsensitive(std::string url) {
+		std::transform(url.begin(), url.end(), url.begin(), ::tolower);
+		return url.find("http") == 0;
+	}
+
 	std::string CModTools::generateCommonPage(std::string url, std::string name, int width, int height, int point_x, int point_y, int top)
 	{
 #if defined(RVC_OS_LINUX)
+		std::string dstUrl = url;
 		CSimpleStringA strBasePath(true);
 		this->m_pEntity->GetFunction()->GetPath("BaseDir", strBasePath);
 		std::string strPath(strBasePath.GetData());
@@ -636,7 +644,15 @@ namespace Chromium {
 			CSimpleStringA strUOSBrowserPath(execute_oldbrowser_path.c_str());
 			strParams.Append(" --new-window --no-first-run --disable-popup-blocking --disable-notifications --disable-desktop-notifications ");
 			if (ConfigManager::getInstance().m_extension_withTerminal)
+			{
 				strParams.Append(" --load-extension=").Append(ConfigManager::getInstance().m_extensionPath.c_str());
+				if (startsWithHttpCaseInsensitive(url))
+				{
+					auto redirctUrlRet = getErrUrl(ERR_PAGE_REASON::redirect);
+					dstUrl = "\"file:///" + redirctUrlRet.second + "?redirect_open=" + url + "&redirect_type=" + name + "\"";
+				}
+			}
+
 			strParams.Append(" --allow-running-insecure-content --disable-infobars --disable-suggestions-service --disable-save-password-bubble --disable-component-update");
 			
 			
@@ -653,7 +669,11 @@ namespace Chromium {
 			CSimpleStringA usrDataPath(tempPath);
 			usrDataPath.Append(SPLIT_SLASH_STR).Append("UOSBrowserConfig_").Append(name.c_str());
 			strParams.Append(" --user-data-dir=").Append(usrDataPath);
-			strParams.Append(" --app=").Append(url.c_str());
+
+			CSimpleStringA debug_log_path = usrDataPath + "/chrome_debug.log";
+			if (ConfigManager::getInstance().m_withDebugMode)
+				strParams.Append(" --enable-logging --vmodule=*/webrtc/*=2,*/media/*=2 --log-file=").Append(debug_log_path);
+			strParams.Append(" --app=").Append(dstUrl.c_str());
 			strUOSBrowserPath.Append(strParams);
 			return strUOSBrowserPath.GetData();
 		}
@@ -664,7 +684,16 @@ namespace Chromium {
 			CSimpleStringA strUOSBrowserPath(execute_newbrowser_path.c_str());
 			strParams.Append(" --allow-running-insecure-content --new-window");
 			if (ConfigManager::getInstance().m_extension_withTerminal)
+			{
 				strParams.Append(" --load-extension=").Append(ConfigManager::getInstance().m_extensionPath.c_str());
+				if (startsWithHttpCaseInsensitive(url))
+				{
+					auto redirctUrlRet = getErrUrl(ERR_PAGE_REASON::redirect);
+					dstUrl = "\"file:///" + redirctUrlRet.second + "?redirect_open=" + url + "&redirect_type=" + name + "\"";
+				}
+			}
+
+
 			CSimpleStringA tempPath;
 			this->m_pEntity->GetFunction()->GetPath("Temp", tempPath);
 			CSimpleStringA cachePath(tempPath);
@@ -677,7 +706,10 @@ namespace Chromium {
 			CSimpleStringA usrDataPath(tempPath);
 			usrDataPath.Append(SPLIT_SLASH_STR).Append("BrowserConfig_").Append(name.c_str());
 			strParams.Append(" --user-data-dir=").Append(usrDataPath);
-			strParams.Append(" --app=").Append(url.c_str());
+			CSimpleStringA debug_log_path = usrDataPath + "/chrome_debug.log";
+			if (ConfigManager::getInstance().m_withDebugMode)
+				strParams.Append(" --enable-logging --vmodule=*/webrtc/*=2,*/media/*=2 --log-file=").Append(debug_log_path);
+			strParams.Append(" --app=").Append(dstUrl.c_str());
 			strUOSBrowserPath.Append(strParams);
 			return strUOSBrowserPath.GetData();
 		}
@@ -751,12 +783,28 @@ namespace Chromium {
 #if defined(RVC_OS_LINUX)
     std::string CModTools::generateBrowserCMDForEverything(const std::string& url, int pageType, bool ignoreSecurity)
     {
+		std::string dstUrl = url;
         CSimpleStringA strBasePath(true);
         this->m_pEntity->GetFunction()->GetPath("BaseDir", strBasePath);
         std::string strPath(strBasePath.GetData());
         const std::string execute_newbrowser_path = strPath + SPLIT_SLASH_STR + "res" + SPLIT_SLASH_STR + "RunScript" + SPLIT_SLASH_STR + "startBrower.sh";
         const std::string execute_oldbrowser_path = strPath + SPLIT_SLASH_STR + "res" + SPLIT_SLASH_STR + "RunScript" + SPLIT_SLASH_STR + "startUOSBrower.sh";
 
+		std::string name = "";
+		if (pageType == 0 || pageType == 2 || pageType == 3) {
+			name = (+ERR_PAGE_REASON::main)._to_string();
+		}
+		else if (pageType == 1) {
+			name = (+ERR_PAGE_REASON::Ad)._to_string();
+		}
+		else if (pageType == 2) {
+			name = (+ERR_PAGE_REASON::breakdown)._to_string();
+		}
+		else if (pageType == 3) {
+			name = (+ERR_PAGE_REASON::OutsideRequest)._to_string();
+		}
+
+
 		auto getUnsafeDomain = [](const std::string& url)
 		{
 			// 移除协议部分
@@ -790,7 +838,16 @@ namespace Chromium {
 			if (!ConfigManager::getInstance().m_extension_debugOpen)
 				strParams.Append(" --kiosk");
 			if (ConfigManager::getInstance().m_extension_withTerminal)
+			{
 				strParams.Append(" --load-extension=").Append(ConfigManager::getInstance().m_extensionPath.c_str());
+				if (startsWithHttpCaseInsensitive(url))
+				{
+					auto redirctUrlRet = getErrUrl(ERR_PAGE_REASON::redirect);
+					dstUrl = "\"file:///" + redirctUrlRet.second + "?redirect_open=" + url + "&redirect_type=" + name + "\"";
+				}
+			}
+
+
 			if (pageType == 0 || pageType == 2 || pageType == 3) {
 
 			} else if (pageType == 1) {
@@ -834,8 +891,12 @@ namespace Chromium {
                 usrDataPath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("UOSBrowserConfigMain_").Append((+ERR_PAGE_REASON::OutsideRequest)._to_string());
             }
             strParams.Append(" --user-data-dir=").Append(usrDataPath);
+
+			CSimpleStringA debug_log_path = usrDataPath + "/chrome_debug.log";
+			if (ConfigManager::getInstance().m_withDebugMode)
+				strParams.Append(" --enable-logging --vmodule=*/webrtc/*=2,*/media/*=2 --log-file=").Append(debug_log_path);
             strParams.Append(" ");
-            strParams.Append(url.c_str());
+            strParams.Append(dstUrl.c_str());
             strUOSBrowserPath.Append(strParams);
 
             if (pageType == 0) {
@@ -854,7 +915,15 @@ namespace Chromium {
 			if (!ConfigManager::getInstance().m_extension_debugOpen)
 				strParams.Append(" --kiosk");
 			if (ConfigManager::getInstance().m_extension_withTerminal)
+			{
 				strParams.Append(" --load-extension=").Append(ConfigManager::getInstance().m_extensionPath.c_str());
+				if (startsWithHttpCaseInsensitive(url))
+				{
+					auto redirctUrlRet = getErrUrl(ERR_PAGE_REASON::redirect);
+					dstUrl = "\"file:///" + redirctUrlRet.second + "?redirect_open=" + url + "&redirect_type=" + name + "\"";
+				}
+			}
+
             if (pageType == 0 || pageType == 2 || pageType == 3) {
 
             } else if (pageType == 1) {
@@ -898,8 +967,11 @@ namespace Chromium {
                 cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("BrowserConfigMain_").Append((+ERR_PAGE_REASON::OutsideRequest)._to_string());
             }
             strParams.Append(" --user-data-dir=").Append(usrDataPath);
+			CSimpleStringA debug_log_path = usrDataPath + "/chrome_debug.log";
+			if (ConfigManager::getInstance().m_withDebugMode)
+				strParams.Append(" --enable-logging --vmodule=*/webrtc/*=2,*/media/*=2 --log-file=").Append(debug_log_path);
             strParams.Append(" ");
-            strParams.Append(url.c_str());
+            strParams.Append(dstUrl.c_str());
             strUOSBrowserPath.Append(strParams);
 
             if (pageType == 0) {
@@ -1321,7 +1393,7 @@ namespace Chromium {
 		now -= now % (3600 * 24);
 		now -= 3600 * 8; //处理东八区问题
 		CSmartPointer<IConfigInfo> spConfig;
-		ErrorCodeEnum BootTimeCfgError = m_pEntity->GetFunction()->OpenConfig(Config_Run, spConfig);
+		m_pEntity->GetFunction()->OpenConfig(Config_Run, spConfig);
 		CSimpleStringA strLastRecordTime = "";
 		ErrorCodeEnum errorRead = Error_Succeed;
 		errorRead = spConfig->ReadConfigValue("Record", "LastRecordTime", strLastRecordTime);

+ 1 - 1
Module/mod_chromium/CModTools.h

@@ -21,7 +21,7 @@ namespace Chromium {
 
 	BETTER_ENUM(ERR_PAGE_REASON, int, CameraConfig, CardStoreIsBusy, MachineTypeError, TerminalManagerKickOut,
 		TerminalManagerOff, breakdown, warnPrompt, disabled, jobuncomplete, ErrNotify, main, Ad, extend, OutsideRequest, SpecialPageFromOtherEntity
-		, Install, startup, performance_monitor, audioErr)
+		, Install, startup, performance_monitor, audioErr, redirect)
 
 		BETTER_ENUM(PAGE_TYPE, int, Deploy, CameraConfig, TerminalManager, errPage, Ad, slv, init, TradeManager
 			, breakdown, extend, CardStoreIsBusy, Install, startup, performance_monitor)

+ 5 - 1
Module/mod_chromium/CWebsocketServer.cpp

@@ -295,8 +295,12 @@ namespace Chromium {
 				t_type = LOG_TYPE_BUSINESS_USER;
 			else if (logType.second.Compare("VTMWeb", true) == 0)
 				t_type = LOG_TYPE_VTMWEB;
-			else if(logType.second.Compare("Sys", true) == 0)
+			else if (logType.second.Compare("Sys", true) == 0)
 				t_type = LOG_TYPE_BUSINESS_SYSTEM;
+			else if (logType.second.Compare("VTMSys", true) == 0)
+				t_type = LOG_TYPE_SYSTEM;
+			else if (logType.second.Compare("VTMUser", true) == 0)
+				t_type = LOG_TYPE_USER;
 
 			//通过变量方式进行处理
 			DbgWithLink t_obj(changeMessageTypeToLogLevel(messageType), t_type);

+ 0 - 2
Module/mod_evtconverter/CustomerApproachEvent.hpp

@@ -73,7 +73,6 @@
 //		<Filter LogType = "Log_Event" UserCode = "0x20400001" / ><!--scanner not used now-->
 //		<Filter LogType = "Log_Event" UserCode = "0x20700001" / ><!--ukey inserted event-->
 //		<Filter LogType = "Log_Event" UserCode = "0x21500001" / ><!--start printseal-->
-//		<Filter LogType = "Log_Event" UserCode = "0x21400003" / ><!--netbank ukey insert-->
 //		<Filter LogType = "Log_Event" UserCode = "0x30B00009" / ><!--ui send operate state-->
 //		<Filter LogType = "Log_Event" UserCode = "0x10313088" / ><!--hangup call-->
 //		<Reset Source = "ApproachSlot" / >
@@ -202,7 +201,6 @@ rvc_slot_t OperateSlot =
 		{"Log_Event", NULL, NULL, NULL, "0x20400001", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x20700001", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x21500001", NULL},
-		{"Log_Event", NULL, NULL, NULL, "0x21400003", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x30B00009", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x10313088", NULL}
 	},

+ 0 - 2
Module/mod_evtconverter/CustomerApproachEventCardStore.hpp

@@ -71,7 +71,6 @@
 //		<Filter LogType = "Log_Event" UserCode = "0x40100001" / ><!--issue from mod_browser, mouse hook proc-->
 //		<Filter LogType = "Log_Event" UserCode = "0x20400001" / ><!--scanner not used now-->
 //		<Filter LogType = "Log_Event" UserCode = "0x20700001" / ><!--ukey inserted event-->
-//		<Filter LogType = "Log_Event" UserCode = "0x21400003" / ><!--netbank ukey insert-->
 //		<Filter LogType = "Log_Event" UserCode = "0x30B00009" / ><!--ui send operate state-->
 // 		<Filter LogType = "Log_Event" UserCode = "0x22090006" / ><!-- batch read cardinfo-->
 //		<Filter LogType = "Log_Event" UserCode = "0x22090007" / ><!--add card-->
@@ -199,7 +198,6 @@ rvc_slot_t CardStoreOperateSlot =
 		{"Log_Event", NULL, NULL, NULL, "0x40100001", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x20400001", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x20700001", NULL},
-		{"Log_Event", NULL, NULL, NULL, "0x21400003", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x30B00009", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x22090006", NULL},
 		{"Log_Event", NULL, NULL, NULL, "0x22090007", NULL}

+ 0 - 2
Module/mod_gpio/GpioFSM.cpp

@@ -935,7 +935,6 @@ void CGPIOFSM::OnEventDetect(void* pData)
 		m_bOpenFlag = true;
 		m_DoorOpenTimeStamp = SP::Module::Comm::RVCGetTickCount();
 		LogEvent(Severity_Middle, LOG_EVT_OPENSENSOR_ON, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(18), __LINE__));
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(GpioService_LogCode_Detect_DoorOpen)("[GPIO] The chassis door is open");
 	}
 	else if (!DetectBit(btInput, OPENSENSOR) && m_bOpenFlag) {
 		m_bOpenFlag = false;
@@ -1012,7 +1011,6 @@ void CGPIOFSM::OnEventDetect(void* pData)
 	if (DetectBit(btInput, CARDGATESENSOR) && !m_bCardGateFlag) {
 		m_bCardGateFlag = true;
 		LogEvent(Severity_Middle, LOG_EVT_CARDGATESENSOR, CSimpleStringA::Format("%s [Active] line: %d", GetDriverPortString(21), __LINE__));
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(GpioService_LogCode_Detect_CardMouseJam)("[GPIO] The card mouse is jam");
 	}
 	else if (!DetectBit(btInput, CARDGATESENSOR) && m_bCardGateFlag) {
 		LogEvent(Severity_Middle, LOG_EVT_CARDGATESENSOR_OFF, CSimpleStringA::Format("%s [InActive] line: %d", GetDriverPortString(21), __LINE__));

+ 0 - 1
Module/mod_gpio/mod_gpio.cpp

@@ -31,7 +31,6 @@ void CGpioEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<I
 		GetFunction()->SubscribeLog(m_uuidCR, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardIssuerStand");
 		GetFunction()->SubscribeLog(m_uuidCA, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CustomerAware");
 		GetFunction()->SubscribeLog(m_uuidCC, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "ContactlessCard");
-		GetFunction()->SubscribeLog(m_uuidDD, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "DeviceControl");
 		GetFunction()->SubscribeLog(m_uuidCS, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardIssuerStore");
 		GetFunction()->SubscribeLog(m_uuidHSPscanner, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "HSPScanner");
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sub ok...");

+ 1 - 1
Module/mod_gpio/mod_gpio.h

@@ -81,7 +81,7 @@ public:
 
 public:
 
-    CUUID m_uuidHealth, m_uuidCR, m_uuidIDC, m_uuidFP, m_uuidKB, m_uuidCA, m_uuidCC, m_uuidDD, m_uuidCS;
+    CUUID m_uuidHealth, m_uuidCR, m_uuidIDC, m_uuidFP, m_uuidKB, m_uuidCA, m_uuidCC, m_uuidCS;
     CUUID m_uuidHSPscanner;
 
 private:

+ 0 - 1
Module/mod_healthmanager/CMakeLists.txt

@@ -30,7 +30,6 @@ target_include_directories(${MODULE_NAME} PRIVATE
 	${ModuleCommonHeadPath}
 	${MODULE_BASE_DIR}/mod_heartbeat
 	${MODULE_BASE_DIR}/mod_ContactlessCard
-	${MODULE_BASE_DIR}/mod_DeviceControl
 	${MODULE_BASE_DIR}/mod_ups
 	${MODULE_BASE_DIR}/mod_interactioncontext
 	${MODULE_BASE_DIR}/mod_UpgradeMgr

+ 0 - 5
Module/mod_vtmloader/VtmLoaderFSM.cpp

@@ -1061,11 +1061,6 @@ int CVtmLoaderFSM::EntityLoad()
 			LogWarn(Severity_High, Error_Unexpect, VtmLoader_CoreBootCfg_Err, CSimpleStringA::Format("terminalNo[%s] CoreBoot配置异常,请联系总行开发人员检查(%s)", m_sysInfo.strTerminalID.GetData(), csCoreBootList.GetData()).GetData());
 			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setLogCode("QLR040210F14").setResultCode("RTA1F05")(CSimpleStringA::Format("terminalNo[%s] CoreBoot配置异常,请联系总行开发人员检查(%s)",m_sysInfo.strTerminalID.GetData(), csCoreBootList.GetData()));
 		}
-		//if have PinPad module
-		//if (m_sysInfo.strMachineType.Compare("RVC.CardStore", true) == 0)
-		//	csCoreBootList = "HealthManager=0|TokenKeeper=0|Alarm=0|UpgradeManager=0|DeviceControl=0|ResourceWatcher=0|AccessAuthorization=0|HeartBeat=0|EventConverter=0|CenterSetting=0";
-		//else
-		//	csCoreBootList = "HealthManager=0|TokenKeeper=0|Alarm=0|UpgradeManager=0|DeviceControl=0|ResourceWatcher=0|AccessAuthorization=0|HeartBeat=0|EventConverter=0|CenterSetting=0|PinPad=0";
 	}
 
 	spConfigCen->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "SleepEnterOpMS", m_sleepEnterOpMS);

+ 19 - 0
addin/res/ManagerDesktop/redirect.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <!-- 1. 从 URL 参数中提取目标地址 -->
+    <script>
+        const params = new URLSearchParams(window.location.search);
+        const targetUrl = params.get('redirect_open'); // 例如 ?url=http://oa.cmbchina.com
+        if (targetUrl) {
+            // 2. 延迟 2 秒后通过 meta 刷新跳转(无界面闪烁)
+            setTimeout(() => {
+                window.location.href = targetUrl + (targetUrl.includes('?') ? '&' : '?') + 'from_redirect=' + Date.now();
+            }, 2000);
+        }
+    </script>
+    <!-- 3. 确保页面完全空白 -->
+    <style>html, body { display: none; }</style>
+</head>
+<body></body>
+</html>

+ 497 - 274
addin/res/VTMModifyHeaders/background.js

@@ -8,7 +8,16 @@
  */
 
 
+//C:\Program Files\Google\Chrome\Application\chrome.exe --auto-open-devtools-for-tabs --load-extension=D:\mayun\LR04.02_RVCTerminalPlus_uos\addin\res\VTMModifyHeaders "file:///D:/redirect.html?url=http://oa.cmbchina.com"
+
+//"C:\Program Files\Google\Chrome\Application\chrome.exe" --auto-open-devtools-for-tabs --load-extension=D:\mayun\LR04.02_RVCTerminalPlus_uos\addin\res\VTMModifyHeaders "file:///D:/mayun/LR04.02_RVCTerminalPlus_uos/addin/res/ManagerDesktop/redirect.html?redirect_open=http://oa.cmbchina.com&redirect_type=ad"
+
 "use strict";
+// 创建自定义事件发射器
+const eventBus = new EventTarget();
+
+// 定义事件名
+const WS_CALLBACK_COMPLETE = 'wsCallbackComplete';
 
 let config;
 let started = 'on';
@@ -16,139 +25,350 @@ let debug_mode = true;
 const isChrome = true;
 let config_read_type = 'websocket';//local,file,websocket,http
 const wsUrl = 'ws://127.0.0.1:9002?name=vtm_modify_header';
+const wsLoggerUrl = 'ws://127.0.0.1:9002?name=header_';
 let socket = null;
+let isExtensionReady = false;
+let isSuc = false;
+let dstWs_logger = wsLoggerUrl;
+let currentUrl = "";
+let urlParam = "";
+let data = "";
+
+function delay(ms) {
+    return new Promise(resolve => setTimeout(resolve, ms));
+}
 
-loadConfigurationFromLocalStorage();
+class WebSocketLogger {
+    constructor(options) {
+        // 默认配置
+        const defaults = {
+            url: wsLoggerUrl,
+            reconnectInterval: 5000,
+            maxReconnectAttempts: 3,
+            logging: true
+        };
+
+        this.config = { ...defaults, ...options };
+        this.ws = null;
+        this.reconnectAttempts = 0;
+        this.isConnected = false;
+        this.messageQueue = [];
+    }
 
-addListener();
-// listen for change in configuration or start/stop
-chrome.runtime.onMessage.addListener(notify);
+    // 初始化WebSocket连接
+    connect() {
+        this.ws = new WebSocket(this.config.url);
+
+        this.ws.onopen = () => {
+            this.isConnected = true;
+            this.reconnectAttempts = 0;
+            console.log('WebSocket connected');
+            this._flushMessageQueue(); // 发送积压的消息
+        };
+
+        this.ws.onclose = () => {
+            this.isConnected = false;
+            console.log('WebSocket disconnected');
+            this._attemptReconnect();
+        };
+
+        this.ws.onerror = (error) => {
+            console.error('WebSocket error:', error);
+        };
+    }
 
-function connectWebSocket(callback_function) {
-  let socket = null; // 初始化 socket 变量
-  let timeoutId = setTimeout(() => {
-    socket.close();
-    callback_function(null); // 超时回调 null
-  }, 3000); // 5秒 = 5000 毫秒
-  let connectionOpened = false; // 标记连接是否已经打开
-
-  try {
-    socket = new WebSocket(wsUrl);
-  } catch (error) {
-    log('WebSocket connection creation error: ' + error);
-    callback_function(null); // 连接创建失败,回调 null
-    return;
-  }
+    // 尝试重新连接
+    _attemptReconnect() {
+        if (this.reconnectAttempts < this.config.maxReconnectAttempts) {
+            this.reconnectAttempts++;
+            console.log(`Reconnecting attempt ${this.reconnectAttempts}...`);
+            setTimeout(() => this.connect(), this.config.reconnectInterval);
+        } else {
+            console.error('Max reconnection attempts reached');
+        }
+    }
 
+    // 发送日志消息
+    log(payload) {
+        const defaultPayload = {
+            messageType: 3080198,
+            EntityName: 'header_log',
+            ResultMsg: '',
+            LogType: 'VTMSys',
+            CostTime: 0,
+            ResultCode: 'SUC0000',
+            LogCode: '',
+            API: 'header_log',
+            SourceType: '',
+            BussID: '',
+            TipMsg: ''
+        };
+
+        const message = { ...defaultPayload, ...payload };
+
+        if (this.isConnected) {
+            this._sendMessage(message);
+        } else {
+            this.messageQueue.push(message); // 先存入队列
+            if (this.messageQueue.length === 1) {
+                this.connect(); // 首次断连时尝试重连
+            }
+        }
+    }
 
-  socket.onmessage = function (event) {
-    log('Received message:' + event.data);
-    clearTimeout(timeoutId); // 清除定时器
-    if (socket && socket.readyState === WebSocket.OPEN) { // 检查连接状态
-      socket.close();
+    // 实际发送消息
+    _sendMessage(message) {
+        try {
+            this.ws.send(JSON.stringify(message));
+            if (this.config.logging) {
+                console.log('Log sent:', message);
+            }
+        } catch (error) {
+            console.error('Failed to send log:', error);
+            this.messageQueue.push(message); // 失败后重新入队
+        }
     }
-    callback_function(event.data);
-    return;
-  };
-
-  socket.onopen = function () {
-    log('WebSocket connection established');
-    connectionOpened = true; // 设置连接已打开标志
-    // 发送配置请求
-    let requestData = '{"messageType":131073}';
-    log('Send message:' + requestData);
-    socket.send(requestData);
-  };
-
-  socket.onerror = function (error) {
-    log('WebSocket connection error:' + error);
-    clearTimeout(timeoutId); // 清除定时器
-    if (socket && socket.readyState === WebSocket.OPEN) { // 检查连接状态
-      socket.close();
+
+    // 发送队列中的积压消息
+    _flushMessageQueue() {
+        while (this.messageQueue.length > 0 && this.isConnected) {
+            const message = this.messageQueue.shift();
+            this._sendMessage(message);
+        }
     }
-    callback_function(null); // 错误回调 null
-  };
-
-  socket.onclose = function (event) {
-    log('WebSocket connection closed:' + event.reason);
-    clearTimeout(timeoutId); // 清除定时器
-    connectionOpened = false; // 重置连接已打开标志
-    if (event.reason !== 'Connection timed out') { // 如果不是超时关闭
-      callback_function(null); // 连接意外关闭,回调 null
+
+    // 关闭连接
+    close() {
+        if (this.ws) {
+            this.ws.close();
+            this.isConnected = false;
+        }
     }
-  };
 }
 
 
-function loadConfigurationFromLocalStorage() {
-  if (config_read_type == 'local') {
-    let headers = [];
-    headers.push({ url_contains: "", action: "add", header_name: "terminalno", header_value: "7555980178", comment: "test", apply_on: "req", status: "on" });
-    config = { format_version: "1.1", target_page: "", headers: headers, debug_mode: true, use_url_excepts: false };
-    log("current new config" + JSON.stringify(config));
 
+loadConfigurationFromLocalStorage();
 
-    storeInBrowserStorage({ config: JSON.stringify(config) });
-    started = 'on';
-  }
-  else if (config_read_type == 'file') {
-    log('loadConfigurationFromLocalStorage');
-    const filePath = 'file:///D:/Run/runinfo/runcfg/config.json'; // 指定本地文件路径
-    fetch(filePath)
-      .then(response => response.json())
-      .then(data => {
-        console.log('Current new config:', JSON.stringify(data));
-        config = data;
-        storeInBrowserStorage({ config: JSON.stringify(data) }); // 如果不需要存储到浏览器存储中,可以注释掉这行
-        started = 'on';
-      })
-      .catch(error => {
-        console.error('Error reading file:', error);
-      });
+
+chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
+  if (tabs.length > 0 && tabs[0].url) {
+    console.log("Current URL2:", tabs[0].url);
+  } else {
+    console.error("No active tab found or URL is unavailable.");
   }
-  else if (config_read_type == 'websocket') {
-    connectWebSocket(function (dataStr) {
-      if (dataStr == null)
+});
+
+function connectWebSocket(callback_function) {
+    let socket = null; // 初始化 socket 变量
+    let timeoutId = setTimeout(() => {
+        socket.close();
+        callback_function(null); // 超时回调 null
+    }, 3000); // 5秒 = 5000 毫秒
+    let connectionOpened = false; // 标记连接是否已经打开
+
+    try {
+        socket = new WebSocket(wsUrl);
+    } catch (error) {
+        console.log('WebSocket connection creation error: ' + error);
+        callback_function(null); // 连接创建失败,回调 null
         return;
-      let data = JSON.parse(dataStr);
-      log("current new config:" + JSON.stringify(data));
-      config = data
-      storeInBrowserStorage({ config: JSON.stringify(data) });
-      started = 'on';
+    }
+
+
+    socket.onmessage = function (event) {
+        console.log('Received message:' + event.data);
+        clearTimeout(timeoutId); // 清除定时器
+        if (socket && socket.readyState === WebSocket.OPEN) { // 检查连接状态
+            socket.close();
+        }
+        callback_function(event.data);
+        return;
+    };
+
+    socket.onopen = function () {
+        console.log('WebSocket connection established');
+        connectionOpened = true; // 设置连接已打开标志
+        // 发送配置请求
+        let requestData = '{"messageType":131073}';
+        console.log('Send message:' + requestData);
+        socket.send(requestData);
+    };
+
+    socket.onerror = function (error) {
+        console.log('WebSocket connection error:' + error);
+        clearTimeout(timeoutId); // 清除定时器
+        if (socket && socket.readyState === WebSocket.OPEN) { // 检查连接状态
+            socket.close();
+        }
+        callback_function(null); // 错误回调 null
+    };
+
+    socket.onclose = function (event) {
+        console.log('WebSocket connection closed:' + event.reason);
+        clearTimeout(timeoutId); // 清除定时器
+        connectionOpened = false; // 重置连接已打开标志
+        if (event.reason !== 'Connection timed out') { // 如果不是超时关闭
+            callback_function(null); // 连接意外关闭,回调 null
+        }
+    };
+}
+
+function extractUrlFromFileProtocol(fileUrl) {
+    try {
+        const urlObj = new URL(fileUrl);
+        const params = new URLSearchParams(urlObj.search);
+        const targetUrl = params.get('redirect_open');
+
+        // 验证提取的 URL 是否合法
+        if (targetUrl && (targetUrl.startsWith('http://') || targetUrl.startsWith('https://'))) {
+            return targetUrl;
+        }
+    } catch (e) {
+        console.error('Failed to parse file:// URL:', e);
+    }
+    return null;
+}
+
+function extractTypeFromFileProtocol(fileUrl) {
+    try {
+        const urlObj = new URL(fileUrl);
+        const params = new URLSearchParams(urlObj.search);
+        const targetUrl = params.get('redirect_type');
+
+        // 验证提取的 URL 是否合法
+        if (targetUrl) {
+            return targetUrl;
+        }
+        else
+            return "log";
+    } catch (e) {
+        console.error('Failed to parse file:// URL:', e);
+    }
+    return null;
+}
+
+function getCurrentTabUrlWithRetry(maxRetries = 40, retryDelay = 50) {
+    chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
+        if (tabs[0] && tabs[0].url && tabs[0].url.length > 0) {
+            // 成功获取有效 URL
+            currentUrl = tabs[0].url;
+            console.log("当前 URL:", currentUrl);
+            handleUrlLogic(currentUrl, tabs); // 处理你的业务逻辑
+        } else {
+            // URL 无效,触发重试
+            if (maxRetries > 0) {
+                console.warn(`URL 为空,剩余重试次数: ${maxRetries}`);
+                setTimeout(() => {
+                    getCurrentTabUrlWithRetry(maxRetries - 1, retryDelay);
+                }, retryDelay);
+            } else {
+                console.error("无法获取有效 URL,重试次数用尽");
+                eventBus.dispatchEvent(new CustomEvent(WS_CALLBACK_COMPLETE, {
+                    detail: { success: false, data: "无法获取标签页 URL" }
+                }));
+            }
+        }
+    });
+}
+
+function handleUrlLogic(currentUrl, tabs) {
+    const urlType = "log";
+    dstWs_logger = dstWs_logger + urlType;
+
+    if (currentUrl.startsWith('file:///')) {
+        console.log("begin with file:///");
+        urlParam = extractUrlFromFileProtocol(currentUrl);
+        console.log("解析的url为:" + urlParam);
+        if (urlParam) {
+            // 使插件生效
+            config = data; // modify config which make 
+            storeInBrowserStorage({ config: JSON.stringify(data) });
+            started = 'on';
+			addListener();
+            isSuc = true;
+            console.log("重载为:", urlParam);
+            chrome.tabs.update(tabs[0].id, { url: urlParam });
+            
+
+            eventBus.dispatchEvent(new CustomEvent(WS_CALLBACK_COMPLETE, {
+                detail: { success: true, data: "操作完成" }
+            }));
+        }
+    } else {
+        started = 'off';
+        eventBus.dispatchEvent(new CustomEvent(WS_CALLBACK_COMPLETE, {
+            detail: { success: false, data: "操作失败" }
+        }));
+    }
+}
+
+function loadConfigurationFromLocalStorage() {
+    
+    if (config_read_type == 'websocket') {
+        connectWebSocket(function (dataStr) {
+            if (dataStr == null)
+                return;
+            data = JSON.parse(dataStr);
+            log("current new config:" + JSON.stringify(data));            
+
+            getCurrentTabUrlWithRetry();
+            /*
+                  chrome.tabs.query({ active: true }, (tabs) => {
+                    chrome.tabs.update(tabs[0].id, { url: "https://oa.cmbchina.com" });
+                  });
+                  */
+        });
+    }
+
+    eventBus.addEventListener(WS_CALLBACK_COMPLETE, async (e) => {
+        const logger = new WebSocketLogger({
+            url: dstWs_logger,
+            logging: true // 开启调试日志
+        });
+        if (isSuc) {
+            logger.log({
+                ResultMsg: "重载为:" + urlParam
+            });
+        } else {
+            logger.log({
+                ResultMsg: "不运行插件, 当前url地址为:" + currentUrl
+            });
+        }
+        logger.close();
     });
-  }
 }
 
 
 
 
 function loadFromBrowserStorage(item, callback_function) {
-  chrome.storage.local.get(item, callback_function);
+    chrome.storage.local.get(item, callback_function);
 }
 
 function storeInBrowserStorage(item, callback_function) {
-  chrome.storage.local.set(item, callback_function);
+    chrome.storage.local.set(item, callback_function);
 }
 
 
 function cookie_keyvalues_set(original_cookies, key, value) {
-  let new_element = " " + key + "=" + value; // not used if value is undefined. 
-  let cookies_ar = original_cookies.split(";").filter(e => e.trim().length > 0);
-  let selected_cookie_index = cookies_ar.findIndex(kv => kv.trim().startsWith(key + "="));
-  if ((selected_cookie_index == -1) && (value != undefined)) cookies_ar.push(new_element);
-  else {
-    if (value === undefined)
-      cookies_ar.splice(selected_cookie_index, 1);
-    else
-      cookies_ar.splice(selected_cookie_index, 1, new_element);
-  }
-  return cookies_ar.join(";");
+    let new_element = " " + key + "=" + value; // not used if value is undefined. 
+    let cookies_ar = original_cookies.split(";").filter(e => e.trim().length > 0);
+    let selected_cookie_index = cookies_ar.findIndex(kv => kv.trim().startsWith(key + "="));
+    if ((selected_cookie_index == -1) && (value != undefined)) cookies_ar.push(new_element);
+    else {
+        if (value === undefined)
+            cookies_ar.splice(selected_cookie_index, 1);
+        else
+            cookies_ar.splice(selected_cookie_index, 1, new_element);
+    }
+    return cookies_ar.join(";");
 }
 
 function set_cookie_modify_cookie_value(original_set_cookie_header_content, key, new_value) {
-  let trimmed = original_set_cookie_header_content.trimStart();
-  let original_attributes = trimmed.indexOf(";") === -1 ? "" : trimmed.substring(trimmed.indexOf(";"))
-  return key + "=" + new_value + original_attributes;
+    let trimmed = original_set_cookie_header_content.trimStart();
+    let original_attributes = trimmed.indexOf(";") === -1 ? "" : trimmed.substring(trimmed.indexOf(";"))
+    return key + "=" + new_value + original_attributes;
 }
 
 
@@ -158,89 +378,92 @@ function set_cookie_modify_cookie_value(original_set_cookie_header_content, key,
 */
 
 function log(message) {
-  console.log(new Date() + " SimpleModifyHeader : " + message);
+    console.log(new Date() + " SimpleModifyHeader : " + message);
 }
 
 /*
 * Rewrite the request header (add , modify or delete)
 *
 */
+
+
+
 function rewriteRequestHeader(e) {
-  if (config.debug_mode) 
-    log("Start modify request headers for url " + e.url + "use_url_excepts:" + config.use_url_excepts)
-  for (let to_modify of config.headers) {
     if (config.debug_mode)
-      log("to_modify.url_contains:" + to_modify.url_contains + " e.url:" + e.url + ", result:" + !e.url.includes(to_modify.url_contains.trim()));
-
-    const shouldApplyModification = (to_modify, config, e) => {
-      const isStatusOn = to_modify.status === "on";
-      const isApplyOnReq = to_modify.apply_on === "req";
-      const isUrlExcepted = config.use_url_excepts 
-        ? to_modify.url_contains.length > 0 && e.url.includes(to_modify.url_contains.trim())
-        : false;
-      
-      return isStatusOn && isApplyOnReq && !isUrlExcepted;
-    };
-
-    if (shouldApplyModification(to_modify, config, e)) {
-      if (to_modify.action === "add") {
-        let new_header = { "name": to_modify.header_name, "value": to_modify.header_value };
-        e.requestHeaders.push(new_header);
-        if (config.debug_mode) log("Add request header : name=" + to_modify.header_name +
-          ",value=" + to_modify.header_value + " for url " + e.url + " url_contains " + to_modify.url_contains);
-      }
-      else if (to_modify.action === "modify") {
-        log("modify request header");
-        for (let header of e.requestHeaders) {
-          if (header.name.toLowerCase() === to_modify.header_name.toLowerCase()) {
-            if (config.debug_mode) log("Modify request header :  name= " + to_modify.header_name +
-              ",old value=" + header.value + ",new value=" + to_modify.header_value +
-              " for url " + e.url);
-            header.value = to_modify.header_value;
-          }
-        }
-      }
-      else if (to_modify.action === "delete") {
-        log("Delete request header");
-        let index = -1;
-        for (let i = 0; i < e.requestHeaders.length; i++) {
-          if (e.requestHeaders[i].name.toLowerCase() === to_modify.header_name.toLowerCase()) index = i;
-        }
-        if (index !== -1) {
-          e.requestHeaders.splice(index, 1);
-          if (config.debug_mode) log("Delete request header :  name=" + to_modify.header_name.toLowerCase() +
-            " for url " + e.url);
+        log("Start modify request headers for url " + e.url + "use_url_excepts:" + config.use_url_excepts)
+    for (let to_modify of config.headers) {
+        if (config.debug_mode)
+            log("to_modify.url_contains:" + to_modify.url_contains + " e.url:" + e.url + ", result:" + !e.url.includes(to_modify.url_contains.trim()));
+
+        const shouldApplyModification = (to_modify, config, e) => {
+            const isStatusOn = to_modify.status === "on";
+            const isApplyOnReq = to_modify.apply_on === "req";
+            const isUrlExcepted = config.use_url_excepts
+                ? to_modify.url_contains.length > 0 && e.url.includes(to_modify.url_contains.trim())
+                : false;
+
+            return isStatusOn && isApplyOnReq && !isUrlExcepted;
+        };
+
+        if (shouldApplyModification(to_modify, config, e)) {
+            if (to_modify.action === "add") {
+                let new_header = { "name": to_modify.header_name, "value": to_modify.header_value };
+                e.requestHeaders.push(new_header);
+                if (config.debug_mode) log("Add request header : name=" + to_modify.header_name +
+                    ",value=" + to_modify.header_value + " for url " + e.url + " url_contains " + to_modify.url_contains);
+            }
+            else if (to_modify.action === "modify") {
+                log("modify request header");
+                for (let header of e.requestHeaders) {
+                    if (header.name.toLowerCase() === to_modify.header_name.toLowerCase()) {
+                        if (config.debug_mode) log("Modify request header :  name= " + to_modify.header_name +
+                            ",old value=" + header.value + ",new value=" + to_modify.header_value +
+                            " for url " + e.url);
+                        header.value = to_modify.header_value;
+                    }
+                }
+            }
+            else if (to_modify.action === "delete") {
+                log("Delete request header");
+                let index = -1;
+                for (let i = 0; i < e.requestHeaders.length; i++) {
+                    if (e.requestHeaders[i].name.toLowerCase() === to_modify.header_name.toLowerCase()) index = i;
+                }
+                if (index !== -1) {
+                    e.requestHeaders.splice(index, 1);
+                    if (config.debug_mode) log("Delete request header :  name=" + to_modify.header_name.toLowerCase() +
+                        " for url " + e.url);
+                }
+            }
+            else if (to_modify.action === "cookie_add_or_modify") {
+                log("cookie_add_or_modify.req");
+                let header_cookie = e.requestHeaders.find(header => header.name.toLowerCase() === "cookie");
+                let new_cookie = cookie_keyvalues_set(header_cookie === undefined ? "" : header_cookie.value, to_modify.header_name, to_modify.header_value);
+                if (header_cookie === undefined) {
+                    e.requestHeaders.push({ "name": "Cookie", "value": new_cookie });
+                    if (config.debug_mode) log("cookie_add_or_modify.req new_header : name=Cookie,value=" + new_cookie + " for url " + e.url);
+                }
+                else {
+                    header_cookie.value = new_cookie;
+                    if (config.debug_mode) log("cookie_add_or_modify.req modify_header : name=Cookie,value=" + new_cookie + " for url " + e.url);
+                }
+            }
+            else if (to_modify.action === "cookie_delete") {
+                log("cookie_delete.req");
+                let header_cookie = e.requestHeaders.find(header => header.name.toLowerCase() === "cookie");
+                let new_cookie = cookie_keyvalues_set(header_cookie === undefined ? "" : header_cookie.value, to_modify.header_name, undefined);
+                if (header_cookie === undefined) {
+                    if (config.debug_mode) log("cookie_delete.req: no cookie header found. doing nothing for url " + e.url);
+                }
+                else {
+                    header_cookie.value = new_cookie;
+                    if (config.debug_mode) log("cookie_delete.req modify_header : name=Cookie,value=" + new_cookie + " for url " + e.url);
+                }
+            }
         }
-      }
-      else if (to_modify.action === "cookie_add_or_modify") {
-        log("cookie_add_or_modify.req");
-        let header_cookie = e.requestHeaders.find(header => header.name.toLowerCase() === "cookie");
-        let new_cookie = cookie_keyvalues_set(header_cookie === undefined ? "" : header_cookie.value, to_modify.header_name, to_modify.header_value);
-        if (header_cookie === undefined) {
-          e.requestHeaders.push({ "name": "Cookie", "value": new_cookie });
-          if (config.debug_mode) log("cookie_add_or_modify.req new_header : name=Cookie,value=" + new_cookie + " for url " + e.url);
-        }
-        else {
-          header_cookie.value = new_cookie;
-          if (config.debug_mode) log("cookie_add_or_modify.req modify_header : name=Cookie,value=" + new_cookie + " for url " + e.url);
-        }
-      }
-      else if (to_modify.action === "cookie_delete") {
-        log("cookie_delete.req");
-        let header_cookie = e.requestHeaders.find(header => header.name.toLowerCase() === "cookie");
-        let new_cookie = cookie_keyvalues_set(header_cookie === undefined ? "" : header_cookie.value, to_modify.header_name, undefined);
-        if (header_cookie === undefined) {
-          if (config.debug_mode) log("cookie_delete.req: no cookie header found. doing nothing for url " + e.url);
-        }
-        else {
-          header_cookie.value = new_cookie;
-          if (config.debug_mode) log("cookie_delete.req modify_header : name=Cookie,value=" + new_cookie + " for url " + e.url);
-        }
-      }
     }
-  }
-  if (config.debug_mode) log("End modify request headers for url " + e.url);
-  return { requestHeaders: e.requestHeaders };
+    if (config.debug_mode) log("End modify request headers for url " + e.url);
+    return { requestHeaders: e.requestHeaders };
 }
 
 
@@ -249,68 +472,68 @@ function rewriteRequestHeader(e) {
 *
 */
 function rewriteResponseHeader(e) {
-  //if (config.debug_mode) log("Start modify response headers for url " + e.url);
-  for (let to_modify of config.headers) {
-    if ((to_modify.status === "on") && (to_modify.apply_on === "res") && (!config.use_url_excepts || (config.use_url_excepts && e.url.includes(to_modify.url_contains.trim())))) {
-      if (to_modify.action === "add") {
-        let new_header = { "name": to_modify.header_name, "value": to_modify.header_value };
-        e.responseHeaders.push(new_header);
-        if (config.debug_mode) log("Add response header : name=" + to_modify.header_name
-          + ",value=" + to_modify.header_value + " for url " + e.url);
-      }
-      else if (to_modify.action === "modify") {
-        for (let header of e.responseHeaders) {
-          if (header.name.toLowerCase() === to_modify.header_name.toLowerCase()) {
-            if (config.debug_mode) log("Modify response header :  name= " + to_modify.header_name + ",old value="
-              + header.value + ",new value=" + to_modify.header_value + " for url " + e.url);
-            header.value = to_modify.header_value;
-          }
-        }
-      }
-      else if (to_modify.action === "delete") {
-        let index = -1;
-        for (let i = 0; i < e.responseHeaders.length; i++) {
-          if (e.responseHeaders[i].name.toLowerCase() === to_modify.header_name.toLowerCase()) index = i;
+    //if (config.debug_mode) log("Start modify response headers for url " + e.url);
+    for (let to_modify of config.headers) {
+        if ((to_modify.status === "on") && (to_modify.apply_on === "res") && (!config.use_url_excepts || (config.use_url_excepts && e.url.includes(to_modify.url_contains.trim())))) {
+            if (to_modify.action === "add") {
+                let new_header = { "name": to_modify.header_name, "value": to_modify.header_value };
+                e.responseHeaders.push(new_header);
+                if (config.debug_mode) log("Add response header : name=" + to_modify.header_name
+                    + ",value=" + to_modify.header_value + " for url " + e.url);
+            }
+            else if (to_modify.action === "modify") {
+                for (let header of e.responseHeaders) {
+                    if (header.name.toLowerCase() === to_modify.header_name.toLowerCase()) {
+                        if (config.debug_mode) log("Modify response header :  name= " + to_modify.header_name + ",old value="
+                            + header.value + ",new value=" + to_modify.header_value + " for url " + e.url);
+                        header.value = to_modify.header_value;
+                    }
+                }
+            }
+            else if (to_modify.action === "delete") {
+                let index = -1;
+                for (let i = 0; i < e.responseHeaders.length; i++) {
+                    if (e.responseHeaders[i].name.toLowerCase() === to_modify.header_name.toLowerCase()) index = i;
+                }
+                if (index !== -1) {
+                    e.responseHeaders.splice(index, 1);
+                    if (config.debug_mode) log("Delete response header :  name=" + to_modify.header_name.toLowerCase()
+                        + " for url " + e.url);
+                }
+            }
+            else if (to_modify.action === "cookie_add_or_modify") {
+                let header_cookie = e.responseHeaders.find(header =>
+                    header.name.toLowerCase() === "set-cookie" &&
+                    header.value.toLowerCase().trim().startsWith(to_modify.header_name.toLowerCase() + "=")
+                );
+                let new_header_value = set_cookie_modify_cookie_value(header_cookie === undefined ? "" : header_cookie.value, to_modify.header_name, to_modify.header_value);
+                if (header_cookie === undefined) {
+                    log("SimpleModifyHeaders.Warning: you're using cookie_add_or_modify in Response. While adding new cookie in response, this plugin only generates `Set-Cookie: cookie-name=cookie-value `, without ANY additional attributes. Add a `Set-Cookie` header if you need them. ");
+                    e.responseHeaders.push({ "name": "Set-Cookie", "value": new_header_value });
+                    if (config.debug_mode) log("cookie_add_or_modify.resp new_header : name=Cookie,value=" + new_header_value + " for url " + e.url);
+                }
+                else {
+                    header_cookie.value = new_header_value;
+                    if (config.debug_mode) log("cookie_add_or_modify.resp modify_header : name=Cookie,value=" + new_header_value + " for url " + e.url);
+                }
+            }
+            else if (to_modify.action === "cookie_delete") {
+                let index = e.responseHeaders.findIndex(header =>
+                    header.name.toLowerCase() === "set-cookie" &&
+                    header.value.toLowerCase().trim().startsWith(to_modify.header_name.toLowerCase() + "=")
+                );
+                if (index === -1) {
+                    if (config.debug_mode) log("cookie_delete.resp: no matching set-cookie header. doing nothing for url " + e.url);
+                }
+                else {
+                    e.responseHeaders.splice(index, 1);
+                    if (config.debug_mode) log("cookie_delete.resp delete_header : name=" + to_modify.header_name + " for url " + e.url);
+                }
+            }
         }
-        if (index !== -1) {
-          e.responseHeaders.splice(index, 1);
-          if (config.debug_mode) log("Delete response header :  name=" + to_modify.header_name.toLowerCase()
-            + " for url " + e.url);
-        }
-      }
-      else if (to_modify.action === "cookie_add_or_modify") {
-        let header_cookie = e.responseHeaders.find(header =>
-          header.name.toLowerCase() === "set-cookie" &&
-          header.value.toLowerCase().trim().startsWith(to_modify.header_name.toLowerCase() + "=")
-        );
-        let new_header_value = set_cookie_modify_cookie_value(header_cookie === undefined ? "" : header_cookie.value, to_modify.header_name, to_modify.header_value);
-        if (header_cookie === undefined) {
-          log("SimpleModifyHeaders.Warning: you're using cookie_add_or_modify in Response. While adding new cookie in response, this plugin only generates `Set-Cookie: cookie-name=cookie-value `, without ANY additional attributes. Add a `Set-Cookie` header if you need them. ");
-          e.responseHeaders.push({ "name": "Set-Cookie", "value": new_header_value });
-          if (config.debug_mode) log("cookie_add_or_modify.resp new_header : name=Cookie,value=" + new_header_value + " for url " + e.url);
-        }
-        else {
-          header_cookie.value = new_header_value;
-          if (config.debug_mode) log("cookie_add_or_modify.resp modify_header : name=Cookie,value=" + new_header_value + " for url " + e.url);
-        }
-      }
-      else if (to_modify.action === "cookie_delete") {
-        let index = e.responseHeaders.findIndex(header =>
-          header.name.toLowerCase() === "set-cookie" &&
-          header.value.toLowerCase().trim().startsWith(to_modify.header_name.toLowerCase() + "=")
-        );
-        if (index === -1) {
-          if (config.debug_mode) log("cookie_delete.resp: no matching set-cookie header. doing nothing for url " + e.url);
-        }
-        else {
-          e.responseHeaders.splice(index, 1);
-          if (config.debug_mode) log("cookie_delete.resp delete_header : name=" + to_modify.header_name + " for url " + e.url);
-        }
-      }
     }
-  }
-  //if (config.debug_mode) log("End modify response headers for url " + e.url);
-  return { responseHeaders: e.responseHeaders };
+    //if (config.debug_mode) log("End modify response headers for url " + e.url);
+    return { responseHeaders: e.responseHeaders };
 }
 
 
@@ -322,26 +545,26 @@ function rewriteResponseHeader(e) {
 *
 **/
 function notify(message) {
-  if (message === "reload") {
-    if (config.debug_mode) log("Reload configuration");
-    loadFromBrowserStorage(['config'], function (result) {
-      config = JSON.parse(result.config);
-      if (started === "on") {
+    if (message === "reload") {
+        if (config.debug_mode) log("Reload configuration");
+        loadFromBrowserStorage(['config'], function (result) {
+            config = JSON.parse(result.config);
+            if (started === "on") {
+                removeListener();
+                addListener();
+            }
+        });
+    }
+    else if (message === "off") {
         removeListener();
+        started = "off";
+        if (config.debug_mode) log("Stop modifying headers");
+    }
+    else if (message === "on") {
         addListener();
-      }
-    });
-  }
-  else if (message === "off") {
-    removeListener();
-    started = "off";
-    if (config.debug_mode) log("Stop modifying headers");
-  }
-  else if (message === "on") {
-    addListener();
-    started = "on";
-    if (config.debug_mode) log("Start modifying headers");
-  }
+        started = "on";
+        if (config.debug_mode) log("Start modifying headers");
+    }
 }
 
 /*
@@ -350,28 +573,28 @@ function notify(message) {
 * Make it "blocking" so we can modify the headers.
 */
 function addListener() {
-  //return;
-  let target = "<all_urls>";
-  // need to had "extraHeaders" option for chrome https://developer.chrome.com/extensions/webRequest#life_cycle_footnote
-  if (isChrome) {
-    chrome.webRequest.onBeforeSendHeaders.addListener(rewriteRequestHeader,
-      { urls: target.split(";") },
-      ["blocking", "requestHeaders", "extraHeaders"]);
-
-    chrome.webRequest.onHeadersReceived.addListener(rewriteResponseHeader,
-      { urls: target.split(";") },
-      ["blocking", "responseHeaders", "extraHeaders"]);
-  }
+    //return;
+    let target = "<all_urls>";
+    // need to had "extraHeaders" option for chrome https://developer.chrome.com/extensions/webRequest#life_cycle_footnote
+    if (isChrome) {
+        chrome.webRequest.onBeforeSendHeaders.addListener(rewriteRequestHeader,
+            { urls: target.split(";") },
+            ["blocking", "requestHeaders", "extraHeaders"]);
+
+        chrome.webRequest.onHeadersReceived.addListener(rewriteResponseHeader,
+            { urls: target.split(";") },
+            ["blocking", "responseHeaders", "extraHeaders"]);
+    }
+
+    else {
+        chrome.webRequest.onBeforeSendHeaders.addListener(rewriteRequestHeader,
+            { urls: target.split(";") },
+            ["blocking", "requestHeaders"]);
+        chrome.webRequest.onHeadersReceived.addListener(rewriteResponseHeader,
+            { urls: target.split(";") },
+            ["blocking", "responseHeaders"]);
+    }
 
-  else {
-    chrome.webRequest.onBeforeSendHeaders.addListener(rewriteRequestHeader,
-      { urls: target.split(";") },
-      ["blocking", "requestHeaders"]);
-    chrome.webRequest.onHeadersReceived.addListener(rewriteResponseHeader,
-      { urls: target.split(";") },
-      ["blocking", "responseHeaders"]);
-  }
-  
 }
 
 
@@ -380,8 +603,8 @@ function addListener() {
 *
 */
 function removeListener() {
-  chrome.webRequest.onBeforeSendHeaders.removeListener(rewriteRequestHeader);
-  chrome.webRequest.onHeadersReceived.removeListener(rewriteResponseHeader);
+    chrome.webRequest.onBeforeSendHeaders.removeListener(rewriteRequestHeader);
+    chrome.webRequest.onHeadersReceived.removeListener(rewriteResponseHeader);
 }
 
 

+ 5 - 2
addin/res/VTMModifyHeaders/manifest.json

@@ -10,12 +10,15 @@
     "webRequest",
     "webRequestBlocking",
     "<all_urls>",
-    "file:///D:/Run/runinfo/runcfg/config.json"
+    "extraHeaders",
+    "webNavigation",
+    "tabs"
   ],
   "background": {
     "scripts": [
       "background.js"
-    ]
+    ],
+    "persistent": true
   },
   "browser_action": {
     "default_title": "VTModifyHeaders"