SanTak_3A3120KS.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. //////////////////////////////////////////////////////////////////////////////
  2. ////// //////
  3. ////// 文 件: CSanTak_3A3120KS.cpp //////
  4. ////// 作 者: wjf //////
  5. ////// 创建时间: //////
  6. ////// 说 明: SanTak 3A3120KS协议 //////
  7. ////// //////
  8. ////// 修改时间:2011-06-15 9:30 //////
  9. ////// 修改说明: //////
  10. ////// //////
  11. //////////////////////////////////////////////////////////////////////////////
  12. #include "stdafx.h"
  13. #include "CommProcess.h"
  14. #include "SanTak_3A3120KS.h "
  15. CSanTak_3A3120KS::CSanTak_3A3120KS(
  16. char szPath[MAX_PATH],
  17. char szIniName[MAX_PATH],
  18. int nCommPort, int nAddr,
  19. int nRate, int nDataBit,
  20. int nStopBit, int nParity,
  21. int nInterval
  22. )
  23. {
  24. #if IS_USE_READMSG_CS
  25. InitializeCriticalSection(&m_csReadMsg);
  26. #endif
  27. MTVERIFY(m_hSemComm = CreateEvent(NULL, TRUE, TRUE, 0));
  28. memset(m_sz3A3120KS_Q2Msg, 0, sizeof(m_sz3A3120KS_Q2Msg));
  29. memset(m_sz3A3120KS_WAMsg, 0, sizeof(m_sz3A3120KS_WAMsg));
  30. m_dwOnlineTick = 0;
  31. m_devOnline = TRUE;
  32. }
  33. CSanTak_3A3120KS::~CSanTak_3A3120KS()
  34. {
  35. #if IS_USE_READMSG_CS
  36. DeleteCriticalSection(& m_csReadMsg);
  37. #endif
  38. MTVERIFY(CloseHandle(m_hSemComm));
  39. CloseComm();
  40. }
  41. BOOL CSanTak_3A3120KS::SanTakSwOpenComm(int nCommPort, int nAddr, int nRate, int nDataBit, int nStopBit, int nParity, int nInterval)
  42. {
  43. BOOL bResult = FALSE;
  44. bResult = OpenComm( nCommPort, nAddr, nRate, nDataBit, nStopBit, nParity, nInterval );
  45. return bResult;
  46. }
  47. int CSanTak_3A3120KS::SendReadRequest(
  48. char szPath[MAX_PATH],
  49. char szIniName[MAX_PATH],
  50. int nCommPort,
  51. int nAddr,
  52. char szCmd[MAX_CMD],
  53. char szMsg[VAR_MSG],
  54. int nReversed1,
  55. int nReversed2,
  56. int nReversed3,
  57. int nReversed4,
  58. int nReversed5,
  59. float fReversed1,
  60. float fReversed2,
  61. float fReversed3,
  62. char szReversed1[MAX_RESERVED1],
  63. char szReversed2[MAX_RESERVED2],
  64. char szReversed3[MAX_RESERVED3],
  65. char szReversed4[MAX_RESERVED4],
  66. char szReversed5[MAX_RESERVED5]
  67. )
  68. {
  69. int nIndex = 0, nLen = 0;
  70. char szSendMsg[UPS_SANTAK_SEND_MSG] = {0};
  71. char szType[UPS_TYPE_LENGTH] = {0};
  72. int startBit = 0;
  73. int endBit = 0;
  74. m_address = nAddr;
  75. GetParFromIni(szPath, szIniName, szCmd, szSendMsg, szType, nIndex, nLen, startBit, endBit);
  76. CCommProcess *pComm = FindComm(nCommPort);
  77. if( pComm == NULL ) return -1;
  78. int nRet = -1;
  79. if(
  80. ( strlen(m_sz3A3120KS_Q2Msg) == 0 && (
  81. strcmp(szCmd,"cmd-1") == 0 || strcmp(szCmd,"cmd-2") == 0 || strcmp(szCmd,"cmd-3") == 0 ||
  82. strcmp(szCmd,"cmd-4") == 0 || strcmp(szCmd,"cmd-6") == 0 || strcmp(szCmd,"cmd-5") == 0 ||
  83. strcmp(szCmd,"cmd-7") == 0 || strcmp(szCmd,"cmd-8") == 0 || strcmp(szCmd,"cmd-9") == 0 ||
  84. strcmp(szCmd,"cmd-10") == 0 || strcmp(szCmd,"cmd-11") == 0 || strcmp(szCmd,"cmd-12") == 0 ||
  85. strcmp(szCmd,"cmd-13") == 0 || strcmp(szCmd,"cmd-14") == 0 || strcmp(szCmd,"cmd-15") == 0 ||
  86. strcmp(szCmd,"cmd-16") == 0 || strcmp(szCmd,"cmd-17") == 0 || strcmp(szCmd,"cmd-18") == 0 ||
  87. strcmp(szCmd,"cmd-19") == 0 || strcmp(szCmd,"cmd-20") == 0 || strcmp(szCmd,"cmd-21") == 0 ||
  88. strcmp(szCmd,"cmd-22") == 0 || strcmp(szCmd,"cmd-23") == 0 || strcmp(szCmd,"cmd-24") == 0 ||
  89. strcmp(szCmd,"cmd-25") == 0 || strcmp(szCmd,"cmd-26") == 0 || strcmp(szCmd,"cmd-27") == 0 ||
  90. strcmp(szCmd,"cmd-28") == 0 || strcmp(szCmd,"cmd-29") == 0 || strcmp(szCmd,"cmd-30") == 0 ||
  91. strcmp(szCmd,"cmd-31") == 0 || strcmp(szCmd,"cmd-32") == 0 || strcmp(szCmd,"cmd-33") == 0 ||
  92. strcmp(szCmd,"cmd-34") == 0 || strcmp(szCmd,"cmd-35") == 0 || strcmp(szCmd,"cmd-36") == 0 ||
  93. strcmp(szCmd,"cmd-37") == 0
  94. ) )
  95. ||
  96. (strlen(m_sz3A3120KS_WAMsg) == 0 && (
  97. strcmp(szCmd,"cmd-38") == 0 || strcmp(szCmd,"cmd-39") == 0 ||
  98. strcmp(szCmd,"cmd-40") == 0 || strcmp(szCmd,"cmd-41") == 0 || strcmp(szCmd,"cmd-42") == 0 ||
  99. strcmp(szCmd,"cmd-43") == 0 || strcmp(szCmd,"cmd-44") == 0 || strcmp(szCmd,"cmd-45") == 0 ||
  100. strcmp(szCmd,"cmd-46") == 0 || strcmp(szCmd,"cmd-47") == 0 || strcmp(szCmd,"cmd-48") == 0 ||
  101. strcmp(szCmd,"cmd-49") == 0
  102. ))||
  103. strcmp(szCmd,"cmd-1") == 0 || strcmp(szCmd,"cmd-38") == 0
  104. )
  105. {
  106. nRet = GetDeviceParam(nAddr, pComm, szSendMsg, szCmd, szMsg, nIndex, nLen, szType );
  107. if( nRet != 0 )
  108. return nRet;
  109. }
  110. if( GetTickCount() - m_dwOnlineTick > 60 * 1000 && m_dwOnlineTick > 0 )
  111. {
  112. m_devOnline = FALSE;
  113. }
  114. else if( GetTickCount() - m_dwOnlineTick < 60 * 1000 && m_dwOnlineTick > 0 )
  115. {
  116. m_devOnline = TRUE;
  117. }
  118. if( m_devOnline == FALSE )
  119. {
  120. return -1;
  121. }
  122. nRet = GetSanTak_Q2Msg(szCmd, szMsg, nIndex, nLen, szType, startBit, endBit);
  123. nRet = GetSanTak_WAMsg(szCmd, szMsg, nIndex, nLen, szType, startBit, endBit);
  124. //LOG4C_HEX_DUMP((LOG_NOTICE, szMsg, sizeof(szMsg)));
  125. //LOG4C((LOG_NOTICE, "%s=%d, sizeof = %d, return %d", szCmd, atoi(szMsg), sizeof(buf), nRet));
  126. return nRet;
  127. }
  128. int CSanTak_3A3120KS::GetSanTak_Q2Msg(char szCmd[MAX_CMD], char szMsg[VAR_MSG], int &nIndex, int &nLen, char szType[TYPE_LENGTH], int startBit, int endBit )
  129. {
  130. int nRet = 0;
  131. if (strcmp(szCmd,"cmd-1") == 0 || strcmp(szCmd,"cmd-2") == 0 || strcmp(szCmd,"cmd-3") == 0 ||
  132. strcmp(szCmd,"cmd-4") == 0 || strcmp(szCmd,"cmd-6") == 0 || strcmp(szCmd,"cmd-5") == 0 ||
  133. strcmp(szCmd,"cmd-7") == 0 || strcmp(szCmd,"cmd-8") == 0 || strcmp(szCmd,"cmd-9") == 0 ||
  134. strcmp(szCmd,"cmd-10") == 0 || strcmp(szCmd,"cmd-11") == 0 || strcmp(szCmd,"cmd-12") == 0 ||
  135. strcmp(szCmd,"cmd-13") == 0 || strcmp(szCmd,"cmd-14") == 0 || strcmp(szCmd,"cmd-15") == 0 ||
  136. strcmp(szCmd,"cmd-16") == 0 || strcmp(szCmd,"cmd-17") == 0 || strcmp(szCmd,"cmd-18") == 0 ||
  137. strcmp(szCmd,"cmd-19") == 0 || strcmp(szCmd,"cmd-20") == 0 || strcmp(szCmd,"cmd-21") == 0 ||
  138. strcmp(szCmd,"cmd-22") == 0 || strcmp(szCmd,"cmd-23") == 0 || strcmp(szCmd,"cmd-24") == 0 ||
  139. strcmp(szCmd,"cmd-25") == 0 || strcmp(szCmd,"cmd-26") == 0 || strcmp(szCmd,"cmd-27") == 0 ||
  140. strcmp(szCmd,"cmd-28") == 0 || strcmp(szCmd,"cmd-29") == 0 || strcmp(szCmd,"cmd-30") == 0 ||
  141. strcmp(szCmd,"cmd-31") == 0 || strcmp(szCmd,"cmd-32") == 0 || strcmp(szCmd,"cmd-33") == 0 ||
  142. strcmp(szCmd,"cmd-34") == 0 || strcmp(szCmd,"cmd-35") == 0 || strcmp(szCmd,"cmd-36") == 0 ||
  143. strcmp(szCmd,"cmd-37") == 0
  144. )
  145. {
  146. #if IS_USE_READMSG_CS
  147. EnterCriticalSection(&m_csReadMsg);
  148. #endif
  149. DataConversion(szType, m_sz3A3120KS_Q2Msg + nIndex, szMsg, nLen, startBit, endBit);
  150. //LOG4C((LOG_NOTICE, "GetSanTak_3C_Q4Msg"));
  151. //LOG4C_HEX_DUMP((LOG_INFO, m_szSanTak_3C_Q4Msg,sizeof(m_szSanTak_3C_Q4Msg)));
  152. //LOG4C_HEX_DUMP((LOG_INFO, szMsg, 5 ));
  153. #if IS_USE_READMSG_CS
  154. LeaveCriticalSection(&m_csReadMsg);
  155. #endif
  156. nRet = 0;
  157. }
  158. return nRet;
  159. }
  160. int CSanTak_3A3120KS::GetSanTak_WAMsg(char szCmd[MAX_CMD], char szMsg[VAR_MSG], int &nIndex, int &nLen, char szType[TYPE_LENGTH], int startBit, int endBit )
  161. {
  162. int nRet = 0;
  163. if (
  164. strcmp(szCmd,"cmd-38") == 0 || strcmp(szCmd,"cmd-39") == 0 ||
  165. strcmp(szCmd,"cmd-40") == 0 || strcmp(szCmd,"cmd-41") == 0 || strcmp(szCmd,"cmd-42") == 0 ||
  166. strcmp(szCmd,"cmd-43") == 0 || strcmp(szCmd,"cmd-44") == 0 || strcmp(szCmd,"cmd-45") == 0 ||
  167. strcmp(szCmd,"cmd-46") == 0 || strcmp(szCmd,"cmd-47") == 0 || strcmp(szCmd,"cmd-48") == 0 ||
  168. strcmp(szCmd,"cmd-49") == 0)
  169. {
  170. #if IS_USE_READMSG_CS
  171. EnterCriticalSection(&m_csReadMsg);
  172. #endif
  173. DataConversion(szType, m_sz3A3120KS_WAMsg + nIndex, szMsg, nLen, startBit, endBit);
  174. //LOG4C((LOG_NOTICE, "GetSanTak_3C_Q4Msg"));
  175. //LOG4C_HEX_DUMP((LOG_INFO, m_szSanTak_3C_Q4Msg,sizeof(m_szSanTak_3C_Q4Msg)));
  176. //LOG4C_HEX_DUMP((LOG_INFO, szMsg, 5 ));
  177. #if IS_USE_READMSG_CS
  178. LeaveCriticalSection(&m_csReadMsg);
  179. #endif
  180. nRet = 0;
  181. }
  182. return nRet;
  183. }
  184. int CSanTak_3A3120KS::GetDeviceParam(
  185. int nAddr,
  186. CCommProcess *pComm, // 串口对象指针
  187. char szSendMsg[UPS_SANTAK_SEND_MSG], // 发送Buffer
  188. char szCmd[MAX_CMD], // 命令
  189. char szMsg[VAR_MSG], // 接收Buffer
  190. int &nIndex, // 变量索引,针对接收Buffer而言
  191. int &nLen, // 变量长度
  192. char szType[TYPE_LENGTH]) // 变量数据类型
  193. {
  194. int nRet = -1;
  195. nRet = RequestStatus(nAddr, pComm, szSendMsg);
  196. if( nRet != 0 )
  197. {
  198. return nRet; // 串口忙
  199. }
  200. nRet = ResponseStatus(nAddr, pComm, szCmd, szMsg, nIndex, nLen, szType);
  201. return nRet;
  202. }
  203. int CSanTak_3A3120KS::GetParFromIni(
  204. char szPath[MAX_PATH], //服务器程序所在目录
  205. char szIniName[MAX_PATH], //配置文件名
  206. char szCmd[MAX_CMD], //命令
  207. char szSanTakSendMsg[MAX_CMD], //发送Buffer
  208. char nType[MAX_CMD],
  209. int &nIndex,
  210. int &nLen,
  211. int &startBit,
  212. int &endBit)
  213. {
  214. CHAR szFile[MAX_PATH + 1] = "";
  215. wsprintf(szFile, "%s\\config\\%s", szPath, szIniName);
  216. TRACE("szFile =%s\n",szFile);
  217. GetPrivateProfileString(szCmd, "SendCmd", "", szSanTakSendMsg, 10, szFile);
  218. szSanTakSendMsg[strlen(szSanTakSendMsg)] = 0x0D;
  219. GetPrivateProfileString(szCmd, "type", "", nType, 10, szFile);
  220. nType[strlen(nType)] = '\0';
  221. nIndex = GetPrivateProfileInt(szCmd, "Index", 0, szFile);
  222. nLen = GetPrivateProfileInt(szCmd, "Len", 0, szFile);
  223. return 0;
  224. }
  225. int CSanTak_3A3120KS::RequestStatus(int nAddr, CCommProcess *pComm,const char chSendMsg[UPS_SANTAK_SEND_MSG] )
  226. {
  227. #if DEBUG_SANTAK_120 //开关量,用于测试模拟数据
  228. #if 0
  229. REQUEST_STRUCT structResuest;
  230. int nLen = sizeof(REQUEST_STRUCT);
  231. char chkSumBuf[5] ={0};
  232. char addBuf[UPS_TYPE_LENGTH] = {0};
  233. memset(&structResuest,0,nLen);
  234. //
  235. memcpy(structResuest.chkSum, chSendMsg, 2);
  236. structResuest.midBuf = 0x2C;
  237. structResuest.addr[0] = ByteToAscii((nAddr >> 4) & 0x0f);;
  238. structResuest.addr[1] = ByteToAscii(nAddr & 0x0f);
  239. structResuest.End = 0x0D;
  240. //
  241. #endif
  242. if (WaitForSingleObject(m_hSemComm,0) == WAIT_OBJECT_0 )
  243. {
  244. int nDatalen = (int)sizeof(chSendMsg);
  245. ResetEvent(m_hSemComm);
  246. int nResult = pComm->Write((BYTE *)&chSendMsg, nDatalen);
  247. //LOG4C_HEX_DUMP((LOG_NOTICE, chSendMsg, 3));
  248. //LOG4C((LOG_NOTICE, "CSanTak::RequestStatus chSendMsg = %s, nResult = %d, nDatalen = %d", chSendMsg,nResult, nDatalen));
  249. if (nResult == nDatalen)
  250. {
  251. }
  252. else
  253. {
  254. SetEvent(m_hSemComm);
  255. return EER_CODE_SANTAK_COM_REGNUM;
  256. }
  257. }
  258. else
  259. {
  260. return ERR_CODE_SANTAK_COM_BUSY; //串口忙
  261. }
  262. #endif
  263. return 0;
  264. }
  265. int CSanTak_3A3120KS::ResponseStatus(
  266. int nAddr,
  267. CCommProcess *pComm,
  268. char szCmd[MAX_CMD],
  269. char szMsg[VAR_MSG],
  270. int &nIndex,
  271. int &nLen,
  272. char szType[TYPE_LENGTH]
  273. )
  274. {
  275. #if DEBUG_SANTAK_120
  276. int nReceiveLen = 0;
  277. int nProcessLen = 0;
  278. int nReadLen = 0;
  279. RESPONSE_STRUCT strcutResponse;
  280. memset(&strcutResponse, 0, sizeof(RESPONSE_STRUCT));
  281. nReceiveLen = sizeof(RESPONSE_STRUCT);
  282. char *pBuff = new char[nReceiveLen];
  283. memset(pBuff, 0 , nReceiveLen);
  284. nReadLen = pComm->Read((BYTE *)pBuff,nReceiveLen);
  285. //LOG4C((LOG_NOTICE, "CSanTak::ResponseStatus pBuff = %s, nReadLen = %d, nReceiveLen = %d", pBuff, nReadLen, nReceiveLen));
  286. if (nReadLen <= 0)
  287. {
  288. SetEvent(m_hSemComm);
  289. if (pBuff != NULL)
  290. {
  291. delete [] pBuff;
  292. pBuff = NULL;
  293. }
  294. return ERR_CODE_SANTAK_COM_READ_NO_DATA;
  295. }
  296. //长度校验出错
  297. SetSanTak3A3_Q2Msg(szCmd, pBuff);
  298. SetSanTak3A3_WAMsg(szCmd, pBuff);
  299. m_dwOnlineTick = GetTickCount();
  300. // 设置串口等待事件为有信号
  301. SetEvent( m_hSemComm );
  302. if( pBuff != NULL)
  303. {
  304. delete[] pBuff;
  305. pBuff = NULL;
  306. }
  307. #else
  308. SimulationCommData();
  309. #endif
  310. //LOG4C((LOG_NOTICE, "SimulationCommData"));
  311. return 0;
  312. }
  313. void CSanTak_3A3120KS::SetSanTak3A3_Q2Msg(char szCmd[MAX_CMD], char *pBuff)
  314. {
  315. if (
  316. strcmp(szCmd,"cmd-1") == 0 || strcmp(szCmd,"cmd-2") == 0 || strcmp(szCmd,"cmd-3") == 0 ||
  317. strcmp(szCmd,"cmd-4") == 0 || strcmp(szCmd,"cmd-6") == 0 || strcmp(szCmd,"cmd-5") == 0 ||
  318. strcmp(szCmd,"cmd-7") == 0 || strcmp(szCmd,"cmd-8") == 0 || strcmp(szCmd,"cmd-9") == 0 ||
  319. strcmp(szCmd,"cmd-10") == 0 || strcmp(szCmd,"cmd-11") == 0 || strcmp(szCmd,"cmd-12") == 0 ||
  320. strcmp(szCmd,"cmd-13") == 0 || strcmp(szCmd,"cmd-14") == 0 || strcmp(szCmd,"cmd-15") == 0 ||
  321. strcmp(szCmd,"cmd-16") == 0 || strcmp(szCmd,"cmd-17") == 0 || strcmp(szCmd,"cmd-18") == 0 ||
  322. strcmp(szCmd,"cmd-19") == 0 || strcmp(szCmd,"cmd-20") == 0 || strcmp(szCmd,"cmd-21") == 0 ||
  323. strcmp(szCmd,"cmd-22") == 0 || strcmp(szCmd,"cmd-23") == 0 || strcmp(szCmd,"cmd-24") == 0 ||
  324. strcmp(szCmd,"cmd-25") == 0 || strcmp(szCmd,"cmd-26") == 0 || strcmp(szCmd,"cmd-27") == 0 ||
  325. strcmp(szCmd,"cmd-28") == 0 || strcmp(szCmd,"cmd-29") == 0 || strcmp(szCmd,"cmd-30") == 0 ||
  326. strcmp(szCmd,"cmd-31") == 0 || strcmp(szCmd,"cmd-32") == 0 || strcmp(szCmd,"cmd-33") == 0 ||
  327. strcmp(szCmd,"cmd-34") == 0 || strcmp(szCmd,"cmd-35") == 0 || strcmp(szCmd,"cmd-36") == 0 ||
  328. strcmp(szCmd,"cmd-37") == 0
  329. )
  330. {
  331. #if IS_USE_READMSG_CS
  332. EnterCriticalSection(&m_csReadMsg);
  333. #endif
  334. memcpy(m_sz3A3120KS_Q2Msg, pBuff, sizeof(m_sz3A3120KS_Q2Msg));
  335. #if IS_USE_READMSG_CS
  336. LeaveCriticalSection(&m_csReadMsg);
  337. #endif
  338. }
  339. }
  340. void CSanTak_3A3120KS::SetSanTak3A3_WAMsg(char szCmd[MAX_CMD], char *pBuff)
  341. {
  342. if ( strcmp(szCmd,"cmd-38") == 0 || strcmp(szCmd,"cmd-39") == 0 ||
  343. strcmp(szCmd,"cmd-40") == 0 || strcmp(szCmd,"cmd-41") == 0 || strcmp(szCmd,"cmd-42") == 0 ||
  344. strcmp(szCmd,"cmd-43") == 0 || strcmp(szCmd,"cmd-44") == 0 || strcmp(szCmd,"cmd-45") == 0 ||
  345. strcmp(szCmd,"cmd-46") == 0 || strcmp(szCmd,"cmd-47") == 0 || strcmp(szCmd,"cmd-48") == 0 ||
  346. strcmp(szCmd,"cmd-49") == 0 )
  347. {
  348. #if IS_USE_READMSG_CS
  349. EnterCriticalSection(&m_csReadMsg);
  350. #endif
  351. memcpy(m_sz3A3120KS_WAMsg, pBuff, sizeof(m_sz3A3120KS_WAMsg));
  352. #if IS_USE_READMSG_CS
  353. LeaveCriticalSection(&m_csReadMsg);
  354. #endif
  355. }
  356. }
  357. void CSanTak_3A3120KS::SimulationCommData(void)
  358. {
  359. memcpy(m_sz3A3120KS_Q2Msg, ";(229.0 229.0 230.0 229.0 221.0 221.0 221.0 020 003 010 49.9 273.0 30.1 11111111 140.00 100 00 00 00 00 00 00000000 11.", sizeof(";(229.0 229.0 230.0 229.0 221.0 221.0 221.0 000 000 000 49.9 273.0 30.1 00000000 000.00 100 00 00 00 00 00 00000000 11."));
  360. memcpy(m_sz3A3120KS_WAMsg, ";(001.4 000.6 001.8 002.0 001.0 001.9 003.8 004.9 009.7 005.5 009.8 009 00000000.", sizeof(";(001.4 000.6 001.8 002.0 001.0 001.9 003.8 004.9 009.7 005.5 009.8 009 00000000."));
  361. }
  362. int CSanTak_3A3120KS::WriteRequestStatus(char szCmd[MAX_CMD], CCommProcess *pComm, char chSendMsg[UPS_SANTAK_SEND_MSG])
  363. {
  364. return 0;
  365. }
  366. int CSanTak_3A3120KS::WriteResponseStatus(
  367. CCommProcess *pComm, //串口对象指针
  368. int nAddr, // 设备地址
  369. char szCmd[MAX_CMD], // 命令
  370. char szMsg[VAR_MSG], // 接收Buffer
  371. int &nIndex, // 变量索引,针对接收Buffer而言
  372. int &nLen, // 变量长度
  373. char szType[TYPE_LENGTH] // 变量数据类型
  374. )
  375. {
  376. return 0;
  377. }
  378. int CSanTak_3A3120KS::SendSetReuest(
  379. char szPath[MAX_PATH], // 程序所在路径
  380. char szIniName[MAX_PATH], // 配置文件名称
  381. int nCommPort, // 串行端口
  382. int nAddr, // 设备地址
  383. char szCmd[MAX_CMD], // 请求命令
  384. char szMsg[VAR_MSG], // 响应的值
  385. int nReversed1, // 预留整形参数1接口
  386. int nReversed2, // 预留整形参数2接口
  387. int nReversed3, // 预留整形参数3接口
  388. int nReversed4, // 预留整形参数4接口
  389. int nReversed5, // 预留整形参数5接口
  390. float fReversed1, // 预留float参数1接口
  391. float fReversed2, // 预留float参数2接口
  392. float fReversed3, // 预留float参数3接口
  393. char szReversed1[MAX_RESERVED1], // 预留字符数组参数1接口
  394. char szReversed2[MAX_RESERVED2], // 预留字符数组参数2接口
  395. char szReversed3[MAX_RESERVED3], // 预留字符数组参数3接口
  396. char szReversed4[MAX_RESERVED4], // 预留字符数组参数4接口
  397. char szReversed5[MAX_RESERVED5] // 预留字符数组参数5接口
  398. )
  399. {
  400. return 0;
  401. }
  402. int CSanTak_3A3120KS::SetDeviceParam(
  403. CCommProcess *pComm, //串口对象指针
  404. int nAddr, // 设备地址
  405. char szSendMsg[UPS_SANTAK_SEND_MSG], //发送Buffer
  406. char szCmd[MAX_CMD], // 命令
  407. char szMsg[VAR_MSG], // 接收Buffer
  408. int &nIndex, // 变量索引,针对接收Buffer而言
  409. int &nLen, // 变量长度
  410. char szType[TYPE_LENGTH] ) // 变量数据类型
  411. {
  412. return 0;
  413. }