Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

896 lines
36 KiB

  1. /*
  2. *
  3. * REVISIONS:
  4. * pcy29Nov92: New defines from codes.h
  5. * sja08Dec92: Changed #define BATTERY_TYPE to RATED_BATTERY_VOLTAGE
  6. * jod13Jan93: Added eventList to InterpretMessage
  7. * jod28Jan93: Added fixes for support of Data and Decrement Sets
  8. * pcy02Feb93: InterpretSetMessage needs to return a value
  9. * ane03Feb93: Changed BuildPollTransactionGroupMessages to check IsPollSet
  10. * differently
  11. * jod14Feb93: Handle mulit char sets (@ddd, KK, etc)
  12. * pcy16Feb92: Move UPS_STATE_SET define to err.h to avoid conflicts
  13. * pcy16Feb92: Allow gets of UpsState params
  14. * pcy16Feb93: Made battery test results pollable
  15. * pcy21Apr93: OS/2 2.0 FE Merge
  16. * jod05Apr93: Added changes for Deep Discharge
  17. * jod14May93: Added Matrix changes.
  18. * cad10Jun93: Added Mups parms
  19. * cad22Jul93: Fixed up destructor conflicts and omissions
  20. * cad27Aug93: Added MeasureUPS firmware poll param
  21. * pcy12Sep93: Split off of proto.cxx
  22. * pcy12Sep93: Made simulate power fail & lights test poll param a simple set
  23. * cad07Oct93: Plugging Memory Leaks
  24. * jod02Nov93: Added CIBC conditional statements
  25. * ajr17Feb94: Made EventSearch check Buffer before using it.
  26. * jps14Jul94: commented out INCL_NOPMAPI; replaced strtok() call in findCRLF -
  27. * I think non-reentrency was causing problems in os2
  28. * jps28aug94: shorted EepromAllowedValues and BattCalibrationCond for os2 1.3
  29. * djs22Feb96: added CHANGESET
  30. * cgm16Apr96: testresponse will not test an incomplete response
  31. * djs07May96: Added Dark Star parameters
  32. * cgm05Apr96: Fixed TestResponse
  33. * srt23May96: Modified test response to accept erroneous serial number responses.
  34. * djs23Oct96: Modified HIGH_TRANSFER_VOLTAGE to use DECREMENTSET
  35. * dma05Nov97: Added SYSTEM_FAN_STATE to ProtoList
  36. * mholly12May1999: add TurnOffSmartModePollParam support
  37. *
  38. * v-stebe 29Jul2000 Added checks for mem. alloc. failures (bugs #46342-46352)
  39. * v-stebe 05Sep2000 Fixed additional PREfix errors
  40. */
  41. #define INCL_BASE
  42. #define INCL_NOPM
  43. //#define INCL_NOPMAPI // jwa
  44. #include "cdefine.h"
  45. extern "C" {
  46. #if (C_OS & C_OS2)
  47. #include <process.h>
  48. #include <os2.h>
  49. #endif
  50. #include <stdio.h>
  51. #include <stdlib.h>
  52. #include <string.h>
  53. }
  54. #include "_defs.h"
  55. #include "event.h"
  56. #include "codes.h"
  57. #include "message.h"
  58. #include "pollparm.h"
  59. #include "ulinkdef.h"
  60. #include "trans.h"
  61. #include "protsmrt.h"
  62. #include "err.h"
  63. #include "cfgmgr.h"
  64. #if (C_OS & C_UNIX)
  65. #include "utils.h"
  66. #endif
  67. #define PAUSEWAIT 2100
  68. UpsLinkProtocol :: UpsLinkProtocol()
  69. : SimpleUpsProtocol()
  70. {
  71. InitProtocol();
  72. }
  73. CHAR* UpsLinkProtocol :: FindCRLF(CHAR *InBuffer)
  74. {
  75. PCHAR pszTest;
  76. for (pszTest = InBuffer; *pszTest != 0; ++pszTest)
  77. {
  78. if ((*pszTest == '\r' && *(pszTest + 1) == '\n') || *pszTest == '\n')
  79. {
  80. *pszTest = 0;
  81. return InBuffer;
  82. }
  83. }
  84. return (PCHAR)NULL;
  85. }
  86. /*--------------------------------------------------------------------
  87. *
  88. * Function...: EventSearch
  89. *
  90. * Description: .
  91. *
  92. *-------------------------------------------------------------------*/
  93. VOID UpsLinkProtocol :: EventSearch(CHAR *Buffer, List* eventlist)
  94. {
  95. if (Buffer) {
  96. int event_code;
  97. int event_value;
  98. BOOL do_event;
  99. INT bypass;
  100. CHAR *tmpstr = Buffer;
  101. while ((tmpstr = strpbrk(tmpstr, ASYNC_CHARS)))
  102. {
  103. do_event = TRUE; // until proven otherwise
  104. bypass = FALSE;
  105. switch (*tmpstr)
  106. {
  107. case LINEFAILCHAR :
  108. event_code = UTILITY_LINE_CONDITION;
  109. event_value = LINE_BAD;
  110. break;
  111. case RETLINEFAILCHAR :
  112. event_code = UTILITY_LINE_CONDITION;
  113. event_value = LINE_GOOD;
  114. break;
  115. case LOWBATERYCHAR :
  116. event_code = BATTERY_CONDITION;
  117. event_value = BATTERY_BAD;
  118. break;
  119. case RETLLOWBATCHAR:
  120. event_code = BATTERY_CONDITION;
  121. event_value = BATTERY_GOOD;
  122. break;
  123. case REPLACEBATCHAR:
  124. if ( *(tmpstr+1) == '#')
  125. {
  126. tmpstr = tmpstr+2;
  127. bypass = TRUE;
  128. }
  129. do_event = FALSE;
  130. break;
  131. case EEPROMCHANGECHAR:
  132. event_code = EEPROM_CHANGED;
  133. event_value = EEPROM_CHANGED;
  134. break;
  135. case MUPSALARMCHAR:
  136. case LOADOFFCHAR :
  137. // event = new Message(SHUTDOWN,EVENT); //SHUTDOWN;
  138. default :
  139. do_event = FALSE;
  140. break;
  141. }
  142. if (do_event)
  143. {
  144. PEvent event = new Event(event_code, event_value);
  145. eventlist->Append(event);
  146. }
  147. if (!bypass)
  148. strcpy(tmpstr, (tmpstr+1));
  149. }
  150. }
  151. }
  152. INT UpsLinkProtocol :: BuildMessage(Message*, List* )
  153. {
  154. return 1;
  155. }
  156. VOID UpsLinkProtocol :: SetupMessage(Message* msg)
  157. {
  158. int msg_id = msg->getId();
  159. char data[32];
  160. PCHAR cmd;
  161. switch(msg_id) {
  162. case SET_DATA:
  163. sprintf(data, "%s%-8s", DECREMENTPARAMETER, msg->getValue());
  164. msg->setSubmit(data);
  165. msg->setTimeout(ProtoList[msg_id]->GetTime());
  166. break;
  167. default:
  168. cmd = ProtoList[msg_id]->Query();
  169. msg->setSubmit(cmd);
  170. free(cmd);
  171. msg->setTimeout(ProtoList[msg_id]->GetTime());
  172. if (msg->getType() == SET)
  173. msg->setType(ProtoList[msg_id]->GetSetType());
  174. }
  175. }
  176. INT UpsLinkProtocol :: BuildPollMessage(Message* msg, List* msglist)
  177. {
  178. int err = ErrNO_ERROR;
  179. int msg_id = msg->getId();
  180. if (ProtoList[msg_id] == (PollParam*)NULL)
  181. {
  182. msg->setErrcode(ErrUNSUPPORTED);
  183. err = ErrUNSUPPORTED;
  184. }
  185. if(!err) {
  186. if(ProtoList[msg_id]->isPollable()) {
  187. PCHAR cmd = ProtoList[msg_id]->Query();
  188. msg->setSubmit(cmd);
  189. free(cmd);
  190. msg->setTimeout(ProtoList[msg_id]->GetTime());
  191. msglist->Append(msg);
  192. }
  193. }
  194. else {
  195. err = ErrNOT_POLLABLE;
  196. }
  197. return err;
  198. }
  199. INT UpsLinkProtocol :: BuildPollTransactionGroupMessages(PTransactionGroup aTransactionGroup)
  200. {
  201. int err = ErrNO_ERROR;
  202. PTransactionItem theItem = aTransactionGroup->GetFirstTransactionItem();
  203. while ((theItem != NULL) && (err == ErrNO_ERROR))
  204. {
  205. if (ProtoList[theItem->GetCode()] != (PollParam*)NULL)
  206. {
  207. PollParam* poll_param = ProtoList[theItem->GetCode()];
  208. if ( !(poll_param->isPollable()) )
  209. {
  210. theItem->SetErrorCode(ErrNOT_POLLABLE);
  211. err = ErrBUILD_FAILED;
  212. }
  213. if(!err) {
  214. //
  215. // We ask the poll param if we're already polling
  216. // for the poll_param. Most pollparms return ErrNO_ERROR.
  217. // The special ones TRIP, TRIP1, UPS_STATE, STATE,
  218. // MODULE_COUNTS_AND_STATUS, ABNORMAL_CONDITION_REGISTER,
  219. // INPUT_VOLTAGE_FREQUENCY, and OUTPUT_VOLTAGE_CURRENTS have
  220. // multiple poll params that use the same ups link character.
  221. // We dont want send the same char twice in one poll loop, so
  222. // we let the poll param tell us if its been added by someone
  223. // else.
  224. //
  225. err = poll_param->IsPollSet();
  226. if (err == ErrUPS_STATE_SET) {
  227. err = ErrNO_ERROR;
  228. theItem->SetCode(UPS_STATE); // Switch the code
  229. }
  230. else if (err == ErrTRIP_SET) {
  231. err = ErrNO_ERROR;
  232. theItem->SetCode(TRIP_REGISTER); // Switch the code
  233. }
  234. else if (err == ErrTRIP1_SET) {
  235. err = ErrNO_ERROR;
  236. theItem->SetCode(TRIP1_REGISTER); // Switch the code
  237. }
  238. else if (err == ErrSTATE_SET) {
  239. err = ErrNO_ERROR;
  240. theItem->SetCode(STATE_REGISTER); // Switch the code to be upssate
  241. }
  242. if (err == ErrABNORMAL_CONDITION_SET) {
  243. err = ErrNO_ERROR;
  244. theItem->SetCode(ABNORMAL_CONDITION_REGISTER);
  245. }
  246. if (err == ErrMODULE_COUNTS_SET) {
  247. err = ErrNO_ERROR;
  248. theItem->SetCode(MODULE_COUNTS_AND_STATUS);
  249. }
  250. if (err == ErrVOLTAGE_FREQUENCY_SET) {
  251. err = ErrNO_ERROR;
  252. theItem->SetCode(INPUT_VOLTAGE_FREQUENCY);
  253. }
  254. if (err == ErrVOLTAGE_CURRENTS_SET) {
  255. err = ErrNO_ERROR;
  256. theItem->SetCode(OUTPUT_VOLTAGE_CURRENTS);
  257. }
  258. else if(err == ErrSAME_VALUE) {
  259. err = ErrBUILD_FAILED;
  260. theItem->SetErrorCode(ErrSAME_VALUE);
  261. }
  262. else {
  263. err = ErrNO_ERROR;
  264. }
  265. }
  266. }
  267. else
  268. err = ErrNOT_POLLABLE;
  269. theItem = aTransactionGroup->GetNextTransactionItem();
  270. }
  271. if (err == ErrNO_ERROR)
  272. {
  273. err = BuildTransactionGroupMessages(aTransactionGroup);
  274. }
  275. return err;
  276. }
  277. List* UpsLinkProtocol :: BuildTransactionMessageList(Type aType, INT aCode, CHAR* aValue)
  278. {
  279. List* msglist;
  280. PollParam* poll_param = ProtoList[aCode];
  281. if(poll_param == NULL) {
  282. return (List*)NULL;
  283. }
  284. switch(aType) {
  285. case GET:
  286. msglist = BuildGetMessage(aCode);
  287. break;
  288. case SET: {
  289. int set_type = poll_param->GetSetType();
  290. switch(set_type) {
  291. case DATASET:
  292. msglist = BuildDataSetMessage(aCode, aValue);
  293. break;
  294. case DECREMENTSET:
  295. msglist = BuildDecrementSetMessage(aCode, aValue);
  296. break;
  297. case PAUSESET:
  298. msglist = BuildPauseSetMessage(aCode, aValue);
  299. break;
  300. case CHANGESET:
  301. msglist = BuildChangeSetMessage(aCode, aValue);
  302. break;
  303. default:
  304. msglist = BuildStandardSetMessage(aCode, aValue);
  305. break;
  306. }
  307. }
  308. }
  309. return msglist;
  310. }
  311. List* UpsLinkProtocol :: BuildDataSetMessage(INT aCode, CHAR* aValue)
  312. {
  313. List* msglist = new List();
  314. // Initial get
  315. PollParam* poll_param = ProtoList[aCode];
  316. PMessage msg = new Message(aCode);
  317. PCHAR cmd = poll_param->Query();
  318. if (msg != NULL) {
  319. msg->setSubmit(cmd);
  320. msg->setTimeout(poll_param->GetTime());
  321. msglist->Append(msg);
  322. }
  323. free(cmd);
  324. // Data
  325. poll_param = ProtoList[SET_DATA];
  326. PMessage datamsg = new Message(SET_DATA);
  327. char data[32];
  328. if (datamsg != NULL) {
  329. sprintf(data, "%s%8s", DECREMENTPARAMETER, aValue);
  330. datamsg->setSubmit(data);
  331. datamsg->setTimeout(poll_param->GetTime());
  332. msglist->Append(datamsg);
  333. }
  334. // Put in two dummy gets to fix UPSLinkism that requires a unspecified
  335. // delay after getting the last OK. I'm sorry I had to do this, but its
  336. // December 14, I go on vacation next week an we have to get this don.:(
  337. poll_param = ProtoList[aCode];
  338. cmd = poll_param->Query();
  339. Message* dummy_get = new Message(aCode);
  340. if (dummy_get != NULL) {
  341. dummy_get->setSubmit(cmd);
  342. dummy_get->setTimeout(poll_param->GetTime());
  343. msglist->Append(dummy_get);
  344. }
  345. dummy_get = new Message(aCode);
  346. if (dummy_get != NULL) {
  347. dummy_get->setSubmit(cmd);
  348. dummy_get->setTimeout(poll_param->GetTime());
  349. msglist->Append(dummy_get);
  350. }
  351. // Verify with get
  352. Message* get = new Message(aCode);
  353. if (get != NULL) {
  354. get->setSubmit(cmd);
  355. get->setTimeout(poll_param->GetTime());
  356. get->setCompare(&(data[1])); // skip the first char (-)
  357. msglist->Append(get);
  358. }
  359. free(cmd);
  360. return msglist;
  361. }
  362. List* UpsLinkProtocol :: BuildPauseSetMessage(INT aCode, CHAR* aValue)
  363. {
  364. List* msglist = new List();
  365. // Really only action type stuff. How will we deal with commands that
  366. // require two letters (S, wait 1 seconds, S). Possibly use
  367. // TURN_OFF_UPS as the code, and set an inter character delay as part of
  368. // protocol message. For now this only handles the simple stuff.
  369. PollParam* poll_param = ProtoList[aCode];
  370. PMessage msg = new Message(aCode);
  371. if ((msg != NULL) && (msglist != NULL)) {
  372. CHAR submit_string[50];
  373. PCHAR cmd = poll_param->Query();
  374. *submit_string = '\0';
  375. if (cmd != NULL) {
  376. strcpy(submit_string,cmd);
  377. strcat(submit_string,cmd);
  378. free(cmd);
  379. }
  380. // if(poll_param->GetSetType() != SIMPLE_SET) {
  381. // if (aValue) {
  382. // strcat(submit_string,aValue);
  383. // }
  384. // }
  385. msg->setSubmit(submit_string);
  386. msg->setTimeout(poll_param->GetTime());
  387. msg->setWaitTime(PAUSEWAIT);
  388. msglist->Append(msg);
  389. }
  390. else {
  391. // Clean up memory so we don't leak
  392. delete msglist;
  393. delete msg;
  394. }
  395. return msglist;
  396. }
  397. List* UpsLinkProtocol :: BuildChangeSetMessage(INT aCode, CHAR* aValue)
  398. {
  399. List* msglist = new List();
  400. // Initial get. InterpretMessage will verify.
  401. PollParam* poll_param = ProtoList[aCode];
  402. PMessage msg = new Message(aCode);
  403. if (msg != NULL) {
  404. PCHAR cmd = poll_param->Query();
  405. msg->setSubmit(cmd);
  406. msg->setTimeout(poll_param->GetTime());
  407. msg->setCompare(aValue);
  408. msglist->Append(msg);
  409. free(cmd);
  410. }
  411. return msglist;
  412. }
  413. List* UpsLinkProtocol :: BuildDecrementSetMessage(INT aCode, CHAR* aValue)
  414. {
  415. List* msglist = new List();
  416. // Initial get. InterpretMessage will verify.
  417. PollParam* poll_param = ProtoList[aCode];
  418. PMessage msg = new Message(aCode);
  419. if (msg != NULL) {
  420. PCHAR cmd = poll_param->Query();
  421. msg->setSubmit(cmd);
  422. msg->setTimeout(poll_param->GetTime());
  423. msg->setCompare(aValue);
  424. msglist->Append(msg);
  425. free(cmd);
  426. }
  427. return msglist;
  428. }
  429. INT UpsLinkProtocol :: InterpretSetMessage(Message* msg, List* newmsglist)
  430. {
  431. INT err = ErrNO_ERROR;
  432. if (msg->getCompare()) {
  433. if (strncmp(msg->getCompare(), msg->getResponse(), 8 ) == 0) {
  434. msg->setErrcode(ErrNO_ERROR);
  435. }
  436. else {
  437. if (theCurrentTransactionGroup->GetInitialSetResponse() == (CHAR*)NULL)
  438. theCurrentTransactionGroup->SetInitialSetResponse(msg->getResponse());
  439. else {
  440. if (!strncmp(theCurrentTransactionGroup->GetInitialSetResponse(),
  441. msg->getResponse(), strlen(msg->getResponse()) )){
  442. if (theCurrentTransactionGroup->GetInitialSetResponseRepeated()) {
  443. msg->setErrcode(ErrSET_VALUE_NOT_FOUND);
  444. return ErrSET_VALUE_NOT_FOUND;
  445. }
  446. else {
  447. theCurrentTransactionGroup->SetInitialSetResponseRepeated(TRUE);
  448. }
  449. }
  450. }
  451. CHAR compare[32];
  452. PollParam* poll_param = (PollParam*)NULL;
  453. Message* decrement = (Message*)NULL;
  454. Message* verify = (Message*)NULL;
  455. PCHAR cmd;
  456. PollParam* orig_poll_param = ProtoList[msg->getId()];
  457. switch(orig_poll_param->GetSetType()) {
  458. case DECREMENTSET:
  459. {
  460. // save the compare value, we'll use it later
  461. strcpy(compare, msg->getCompare());
  462. PMessage orig_msg = new Message(msg->getId(),
  463. msg->getType(),
  464. msg->getValue());
  465. if (orig_msg !=NULL) {
  466. orig_msg->setSubmit(msg->getSubmit());
  467. orig_msg->setTimeout(msg->getTimeout());
  468. newmsglist->Append(orig_msg);
  469. }
  470. // Reset get message. should we create a new message here,
  471. // or is it OK to use the old one??
  472. // msg->setResponse((CHAR*)NULL);
  473. // msg->setErrcode(ErrNO_ERROR);
  474. // msg->setCompare((CHAR*)NULL);
  475. // newmsglist = new List();
  476. // newmsglist->Append(msg);
  477. // Now add the Decrement message
  478. poll_param = ProtoList[EEPROM_DECREMENT];
  479. decrement = new Message(EEPROM_DECREMENT);
  480. if (decrement != NULL) {
  481. cmd = poll_param->Query();
  482. decrement->setSubmit(cmd);
  483. decrement->setTimeout(poll_param->GetTime());
  484. newmsglist->Append(decrement);
  485. free(cmd);
  486. }
  487. // Now Verify with another get
  488. verify = new Message(msg);
  489. if (verify!=NULL) {
  490. verify->setCompare(compare);
  491. newmsglist->Append(verify);
  492. }
  493. }
  494. break; // this is new ????? JIMD
  495. case CHANGESET:
  496. {
  497. // A CHANGESET message will increment or
  498. // decrement a UPS parameter based upon the
  499. // current value stored in the UPS.
  500. // save the compare value, we'll use it later
  501. strcpy(compare, msg->getCompare());
  502. PMessage orig_msg = new Message(msg->getId(),
  503. msg->getType(),
  504. msg->getValue());
  505. if (orig_msg != NULL) {
  506. orig_msg->setSubmit(msg->getSubmit());
  507. orig_msg->setTimeout(msg->getTimeout());
  508. newmsglist->Append(orig_msg);
  509. }
  510. // Now add the Change message
  511. PMessage changemsg = (PMessage)NULL;
  512. if (atoi(msg->getCompare()) < atoi(msg->getResponse()))
  513. {
  514. poll_param = ProtoList[EEPROM_DECREMENT];
  515. changemsg = new Message(EEPROM_DECREMENT);
  516. }
  517. else {
  518. poll_param = ProtoList[EEPROM_INCREMENT];
  519. changemsg = new Message(EEPROM_INCREMENT);
  520. }
  521. if (changemsg != NULL) {
  522. cmd = poll_param->Query();
  523. changemsg->setSubmit(cmd);
  524. changemsg->setTimeout(poll_param->GetTime());
  525. newmsglist->Append(changemsg);
  526. free(cmd);
  527. }
  528. // Now Verify with another get
  529. verify = new Message(msg);
  530. if (verify != NULL) {
  531. verify->setCompare(compare);
  532. newmsglist->Append(verify);
  533. }
  534. }
  535. break;
  536. case DATASET:
  537. default:
  538. msg->setErrcode(ErrSET_FAILED);
  539. } // end switch
  540. } // end strncmp
  541. }
  542. else {
  543. PollParam* orig_poll_param = ProtoList[msg->getId()];
  544. err = orig_poll_param->ProcessValue(msg, (PList)NULL);
  545. msg->setErrcode(err);
  546. }
  547. return err;
  548. }
  549. INT UpsLinkProtocol :: InterpretMessage(Message* msg, List* eventList, List* newmsglist)
  550. {
  551. PList tiList = (PList)NULL;
  552. PTransactionItem trans_item = (PTransactionItem)NULL;
  553. PTransactionItem tmpti = (PTransactionItem)NULL;
  554. EventSearch(msg->getResponse(),eventList);
  555. FindCRLF(msg->getResponse());
  556. PollParam* orig_poll_param = ProtoList[msg->getId()];
  557. switch(theCurrentTransactionGroup->GetType())
  558. {
  559. case SET:
  560. InterpretSetMessage(msg, newmsglist);
  561. break;
  562. case GET:
  563. msg->setErrcode(orig_poll_param->ProcessValue(msg, eventList));
  564. tiList = theCurrentTransactionGroup->GetTransactionItemList();
  565. tmpti = new TransactionItem(GET,msg->getId());
  566. trans_item = (PTransactionItem)tiList->Find(tmpti);
  567. if (trans_item)
  568. {
  569. trans_item->SetErrorCode(msg->getErrcode());
  570. trans_item->SetValue(msg->getResponse());
  571. }
  572. delete tmpti;
  573. tmpti = NULL;
  574. break;
  575. } // end switch GetType()
  576. return msg->getErrcode();
  577. }
  578. INT UpsLinkProtocol :: TestResponse(Message* msg,CHAR* Buffer,USHORT BufferSize)
  579. {
  580. int err = ErrREAD_FAILED;
  581. CHAR lBuffer[512];
  582. PCHAR lPtr = NULL;
  583. strncpy(lBuffer,Buffer,BufferSize); //make a local copy
  584. lBuffer[BufferSize]= '\0';
  585. switch (msg->getId()) {
  586. case UPS_SERIAL_NUMBER: {// fixes serial number problem
  587. for(INT i=0;i<BufferSize;i++) {
  588. if(Buffer[i]=='\n') {
  589. Message tmpMsg(msg->getId());
  590. tmpMsg.setResponse(Buffer);
  591. PollParam* pollparm = ProtoList[msg->getId()];
  592. err = pollparm->ProcessValue(&tmpMsg);
  593. break;
  594. }
  595. }
  596. return err;
  597. }
  598. break;
  599. case UPS_ALLOWED_VALUES:
  600. // test allowed values response, a bad snmp adaptor will truncate
  601. // the response, but terminate it with \r\n making it look valid.
  602. if ((lPtr = strstr(lBuffer, "\r\n")) == NULL)
  603. return err; // broken ctrl-z (no \r\n), return error.
  604. break; // possibly real, allow response to be validated.
  605. default:
  606. if ((lPtr = strstr(lBuffer, "\r\n")) == NULL)
  607. return err;
  608. break; // should hardly ever get here cuz this function is only
  609. // called for HARD read errors or responses w/o \r\n.
  610. // though you can get here if using a flaky snmp adapter
  611. // which truncates commands and terminates them w/ \r\n
  612. // making them look valid. IN such a case, the individual
  613. // response's processValue funciton should catch the error.
  614. }
  615. *lPtr = '\0'; // most ProcessValue funcs expect \0 not \r\n, so convert.
  616. Message tmpMsg(msg->getId());
  617. tmpMsg.setResponse(lBuffer);
  618. PollParam *pollparm = ProtoList[msg->getId()];
  619. err = pollparm->ProcessValue(&tmpMsg);
  620. return err;
  621. }
  622. /*--------------------------------------------------------------------
  623. *
  624. * Function...: InitProtocol
  625. *
  626. * Description: Initializes all the protocol.
  627. *
  628. *-------------------------------------------------------------------*/
  629. VOID UpsLinkProtocol::InitProtocol()
  630. {
  631. FLOAT DELAY_FACTOR = (FLOAT)50.0;
  632. // I wish there was a better way...
  633. //
  634. delete ProtoList[UTILITY_LINE_CONDITION];
  635. ProtoList[UTILITY_LINE_CONDITION] = NULL;
  636. delete ProtoList[BATTERY_CONDITION];
  637. ProtoList[BATTERY_CONDITION] = NULL;
  638. delete ProtoList[TURN_OFF_UPS];
  639. ProtoList[TURN_OFF_UPS] = NULL;
  640. delete ProtoList[TURN_OFF_UPS_ON_BATTERY];
  641. ProtoList[TURN_OFF_UPS_ON_BATTERY] = NULL;
  642. delete ProtoList[TURN_ON_SMART_MODE];
  643. ProtoList[TURN_ON_SMART_MODE] = NULL;
  644. ProtoList[TURN_ON_SMART_MODE] = new SmartModePollParam(TURN_ON_SMART_MODE, SMARTMODE, (int)(50*DELAY_FACTOR), NO_POLL);
  645. ProtoList[TURN_OFF_SMART_MODE] = new TurnOffSmartModePollParam(TURN_OFF_SMART_MODE, TURNOFFSMARTMODE, (int)(50*DELAY_FACTOR), NO_POLL);
  646. ProtoList[LIGHTS_TEST] = new LightsTestPollParam(LIGHTS_TEST, LIGHTSTEST, (int)(50*DELAY_FACTOR), NO_POLL, SIMPLE_SET);
  647. ProtoList[TURN_OFF_UPS_AFTER_DELAY] = new TurnOffAfterDelayPollParam(TURN_OFF_UPS_AFTER_DELAY, TURNOFFAFTERDELAY, (int)(50*DELAY_FACTOR), NO_POLL, PAUSESET);
  648. ProtoList[TURN_OFF_UPS_ON_BATTERY] = new ShutdownPollParam(TURN_OFF_UPS_ON_BATTERY,TURNOFFUPSONBATT , (int)(50*DELAY_FACTOR), NO_POLL);
  649. ProtoList[SIMULATE_POWER_FAIL] = new SimulatePowerFailurePollParam(SIMULATE_POWER_FAIL, SIMULATEPOWERFAIL, (int)(50*DELAY_FACTOR), NO_POLL, SIMPLE_SET);
  650. ProtoList[SELF_TEST] = new BatteryTestPollParam(SELF_TEST, BATTERYTEST, (int)(50*DELAY_FACTOR), NO_POLL);
  651. ProtoList[TURN_OFF_UPS] = new TurnOffUpsPollParam(TURN_OFF_UPS, SHUTDOWNUPS, (int)(50*DELAY_FACTOR), NO_POLL, PAUSESET);
  652. ProtoList[PUT_UPS_TO_SLEEP] = new ShutdownWakeupPollParam(PUT_UPS_TO_SLEEP, SHUTDOWNUPSWAKEUP, (int)(50*DELAY_FACTOR), NO_POLL);
  653. ProtoList[BATTERY_CALIBRATION_TEST] = new BatteryCalibrationPollParam(BATTERY_CALIBRATION_TEST, BATTERYCALIBRATION,(int)(50*DELAY_FACTOR), NO_POLL, SIMPLE_SET);
  654. #ifndef CIBC
  655. ProtoList[BYPASS_MODE] = new BypassModePollParam(BYPASS_MODE, BYPASSMODE, (int)(50*DELAY_FACTOR), POLL,SIMPLE_SET);
  656. ProtoList[BYPASS_POWER_SUPPLY_CONDITION] = new BypassPowerSupplyPollParam(BYPASS_POWER_SUPPLY_CONDITION, TRIPREGISTER1, (int)(50*DELAY_FACTOR), POLL);
  657. #endif
  658. /**** STATUS INQUERY COMMANDS ****/
  659. ProtoList[SELF_TEST_RESULT] = new BatteryTestResultsPollParam(SELF_TEST_RESULT, BATTERYTESTRESULT, (int)(50*DELAY_FACTOR), POLL);
  660. #ifndef CIBC
  661. // ProtoList[BATTERY_PACKS] = new NumberBatteryPacksPollParam(BATTERY_PACKS, BATTERYPACKS, (int)(60*DELAY_FACTOR), POLL,CHANGESET);
  662. ProtoList[EXTERNAL_BATTERY_PACKS] = new NumberBatteryPacksPollParam(EXTERNAL_BATTERY_PACKS, BATTERYPACKS, (int)(60*DELAY_FACTOR), POLL,CHANGESET);
  663. ProtoList[BAD_BATTERY_PACKS] = new NumberBadBatteryPacksPollParam(BAD_BATTERY_PACKS, BADBATTERYPACKS, (int)(60*DELAY_FACTOR), POLL);
  664. #endif
  665. ProtoList[DECIMAL_FIRMWARE_REV] = new FirmwareVersionPollParam(DECIMAL_FIRMWARE_REV, UPSNEWFIRMWAREREV, (int)(60*DELAY_FACTOR), NO_POLL);
  666. ProtoList[TRANSFER_CAUSE] = new TransferCausePollParam(TRANSFER_CAUSE,TRANSFERCAUSE, (int)(40*DELAY_FACTOR), NO_POLL);
  667. ProtoList[FIRMWARE_REV] = new FirmwareVersionPollParam(FIRMWARE_REV, FIRMWAREREV, (int)(60*DELAY_FACTOR), NO_POLL);
  668. ProtoList[RATED_BATTERY_VOLTAGE] = new BatteryTypePollParam(RATED_BATTERY_VOLTAGE, UPSTYPE, (int)(60*DELAY_FACTOR), NO_POLL);
  669. ProtoList[BATTERY_CAPACITY] = new BatteryCapacityPollParam(BATTERY_CAPACITY, BATTERYCAPACITY,(int)(80*DELAY_FACTOR), POLL);
  670. ProtoList[UPS_STATE] = new UPSStatePollParam(UPS_STATE, UPSSTATE, (int)(50*DELAY_FACTOR), POLL);
  671. #ifndef CIBC
  672. ProtoList[STATE_REGISTER] = new StateRegisterPollParam(STATE_REGISTER, STATEREGISTER, (int)(50*DELAY_FACTOR), POLL);
  673. ProtoList[MATRIX_FAN_STATE] = new FanFailurePollParam(MATRIX_FAN_STATE, TRIPREGISTER1, (int)(50*DELAY_FACTOR), POLL);
  674. #endif
  675. ProtoList[DIP_SWITCH_POSITION] = new DipSwitchPollParam(DIP_SWITCH_POSITION, DIPSWITCHES, (int)(50*DELAY_FACTOR), POLL);
  676. ProtoList[RUN_TIME_REMAINING] = new RuntimeRemainingPollParam(RUN_TIME_REMAINING, BATTERYRUNTIMEAVAIL, (int)(80*DELAY_FACTOR), POLL);
  677. ProtoList[COPYRIGHT] = new CopyrightPollParam(COPYRIGHT, COPYRIGHTCOMMAND,(int)(100*DELAY_FACTOR), NO_POLL);
  678. ProtoList[BATTERY_VOLTAGE] = new BatteryVoltagePollParam(BATTERY_VOLTAGE, BATTERYVOLTAGE,(int)(80*DELAY_FACTOR), POLL);
  679. ProtoList[UPS_TEMPERATURE] = new InternalTempPollParam(UPS_TEMPERATURE, INTERNALTEMP,(int)(80*DELAY_FACTOR), POLL);
  680. ProtoList[OUTPUT_FREQUENCY] = new OutputFreqPollParam(OUTPUT_FREQUENCY, OUTPUTFREQ,(int)(80*DELAY_FACTOR), POLL);
  681. ProtoList[LINE_VOLTAGE] = new LineVoltagePollParam(LINE_VOLTAGE, LINEVOLTAGE,(int)(80*DELAY_FACTOR), POLL);
  682. ProtoList[MAX_LINE_VOLTAGE] = new MaxVoltagePollParam(MAX_LINE_VOLTAGE, MAXLINEVOLTAGE,(int)(80*DELAY_FACTOR), POLL);
  683. ProtoList[MIN_LINE_VOLTAGE] = new MinVoltagePollParam(MIN_LINE_VOLTAGE, MINLINEVOLTAGE,(int)(80*DELAY_FACTOR), POLL);
  684. ProtoList[OUTPUT_VOLTAGE] = new OutputVoltagePollParam(OUTPUT_VOLTAGE, OUTPUTVOLTAGE,(int)(80*DELAY_FACTOR), POLL);
  685. ProtoList[UPS_LOAD] = new LoadPowerPollParam(UPS_LOAD, LOADPOWER,(int)(80*DELAY_FACTOR), POLL);
  686. ProtoList[EEPROM_DECREMENT] = new DecrementPollParam(EEPROM_DECREMENT, DECREMENTPARAMETER, (int)(50*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  687. ProtoList[EEPROM_INCREMENT] = new IncrementPollParam(EEPROM_INCREMENT, INCREMENTPARAMETER, (int)(50*DELAY_FACTOR), NO_POLL,INCREMENTSET);
  688. ProtoList[DATA_DECREMENT] = new DataDecrementPollParam(DATA_DECREMENT, DECREMENTPARAMETER, 50, NO_POLL);
  689. ProtoList[UPS_SELF_TEST_SCHEDULE] = new AutoSelfTestPollParam(UPS_SELF_TEST_SCHEDULE, AUTOSELFTEST, (int)(60*DELAY_FACTOR), NO_POLL, DECREMENTSET);
  690. ProtoList[UPS_ID] = new UpsIdPollParam(UPS_ID, UPSID, (int)(250*DELAY_FACTOR), NO_POLL,DATASET);
  691. ProtoList[UPS_SERIAL_NUMBER] = new SerialNumberPollParam(UPS_SERIAL_NUMBER, UPSSERIALNUMBER, (int)(250*DELAY_FACTOR), NO_POLL, DATASET);
  692. ProtoList[MANUFACTURE_DATE] = new ManufactureDatePollParam(MANUFACTURE_DATE, UPSMANUFACTUREDATE, (int)(250*DELAY_FACTOR), NO_POLL, DATASET);
  693. ProtoList[BATTERY_REPLACEMENT_DATE] = new BatteryReplaceDatePollParam(BATTERY_REPLACEMENT_DATE, BATTERYREPLACEDATE,
  694. (int)(250*DELAY_FACTOR), NO_POLL, DATASET);
  695. ProtoList[HIGH_TRANSFER_VOLTAGE] = new HighTransferPollParam(HIGH_TRANSFER_VOLTAGE,
  696. HIGHTRANSFERPOINT, (int)(60*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  697. ProtoList[LOW_TRANSFER_VOLTAGE] = new LowTransferPollParam(LOW_TRANSFER_VOLTAGE, LOWTRANSFERPOINT, (int)(60*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  698. ProtoList[MIN_RETURN_CAPACITY] = new MinCapacityPollParam(MIN_RETURN_CAPACITY, MINIMUMCAPACITY, (int)(50*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  699. ProtoList[RATED_OUTPUT_VOLTAGE] = new RatedOutputVoltagePollParam(RATED_OUTPUT_VOLTAGE,
  700. OUTPUTVOLTAGESETTING, (int)(60*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  701. ProtoList[UPS_SENSITIVITY] = new SensitivityPollParam(UPS_SENSITIVITY, SENSETIVITY, (int)(40*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  702. ProtoList[LOW_BATTERY_DURATION] = new LowBattDurationPollParam(LOW_BATTERY_DURATION,
  703. LOWBATTERYRUNTIME, (int)(50*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  704. ProtoList[ALARM_DELAY] = new AlarmDelayPollParam(ALARM_DELAY, ALARMDELAY, (int)(40*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  705. ProtoList[SHUTDOWN_DELAY] = new ShutdownDelayPollParam(SHUTDOWN_DELAY, SHUTDOWNDELAY, (int)(60*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  706. ProtoList[TURN_ON_DELAY] = new TurnBackOnDelayPollParam(TURN_ON_DELAY, SYNCTURNBACKDELAY, (int)(60*DELAY_FACTOR), NO_POLL,DECREMENTSET);
  707. ProtoList[SET_DATA] = new SimplePollParam(SET_DATA, "", (int)(250*DELAY_FACTOR), NO_POLL);
  708. ProtoList[NO_MSG] = new SimplePollParam(NO_MSG, "", (int)(250*DELAY_FACTOR), NO_POLL);
  709. ProtoList[LINE_CONDITION_TEST] = new LineConditionPollParam(LINE_CONDITION_TEST, LINECONDITIONTEST, (int)(60*DELAY_FACTOR), POLL);
  710. ProtoList[UTILITY_LINE_CONDITION] = new UtilLineCondPollParam(UTILITY_LINE_CONDITION, UPSSTATE, (int)(50*DELAY_FACTOR), POLL);
  711. ProtoList[BATTERY_CONDITION] = new BatteryCondPollParam(BATTERY_CONDITION, UPSSTATE, (int)(50*DELAY_FACTOR), POLL);
  712. ProtoList[BATTERY_REPLACEMENT_CONDITION] = new ReplaceBattCondPollParam(BATTERY_REPLACEMENT_CONDITION, UPSSTATE, (int)(50*DELAY_FACTOR), POLL);
  713. ProtoList[OVERLOAD_CONDITION] = new OverLoadCondPollParam(OVERLOAD_CONDITION, UPSSTATE, (int)(50*DELAY_FACTOR), POLL);
  714. ProtoList[SMART_BOOST_STATE] = new SmartBoostCondPollParam(SMART_BOOST_STATE, UPSSTATE, (int)(50*DELAY_FACTOR), POLL);
  715. ProtoList[SMART_TRIM_STATE] = new SmartTrimCondPollParam(SMART_TRIM_STATE, UPSSTATE, (int)(50*DELAY_FACTOR), POLL);
  716. #if (C_OS & C_OS2)
  717. ProtoList[BATTERY_CALIBRATION_CONDITION] = new BattCalibrateCondPollParam(BATTERY_CALIBRATION_CONDITION, UPSSTATE, (int)(50*DELAY_FACTOR),
  718. POLL);
  719. #else
  720. ProtoList[BATTERY_CALIBRATION_CONDITION] = new BattCalibrationCondPollParam(BATTERY_CALIBRATION_CONDITION, UPSSTATE, (int)(50*DELAY_FACTOR),
  721. POLL);
  722. #endif
  723. ProtoList[AMBIENT_TEMPERATURE] = new MUpsTempPollParam(AMBIENT_TEMPERATURE, MUPSAMBIENTTEMP, (int)(80*DELAY_FACTOR), POLL);
  724. ProtoList[HUMIDITY] = new MUpsHumidityPollParam(HUMIDITY, MUPSHUMIDITY, (int)(80*DELAY_FACTOR), POLL);
  725. ProtoList[MUPS_FIRMWARE_REV] = new MUpsFirmwareRevPollParam(MUPS_FIRMWARE_REV, MUPSFIRMWAREREV, (int)(60*DELAY_FACTOR), NO_POLL);
  726. ProtoList[CONTACT_POSITION] = new MUpsContactPosPollParam(CONTACT_POSITION, MUPSCONTACTPOSITION, (int)(50*DELAY_FACTOR), POLL);
  727. ProtoList[UPS_FRONT_PANEL_PASSWORD] = new FrontPanelPasswordPollParam(UPS_FRONT_PANEL_PASSWORD, EEPROMPASSWORD, (int)(125*DELAY_FACTOR), POLL);
  728. ProtoList[UPS_RUN_TIME_AFTER_LOW_BATTERY] = new RunTimeAfterLowBatteryPollParam(UPS_RUN_TIME_AFTER_LOW_BATTERY, EARLYTURNOFF, (int)(50*DELAY_FACTOR), POLL);
  729. #ifndef CIBC
  730. ProtoList[TRIP_REGISTER] = new TripRegisterPollParam(TRIP_REGISTER, TRIPREGISTERS, (int)(50*DELAY_FACTOR), POLL);
  731. ProtoList[TRIP1_REGISTER] = new Trip1RegisterPollParam(TRIP1_REGISTER, TRIPREGISTER1, (int)(50*DELAY_FACTOR), POLL);
  732. #if (C_OS & C_OS2)
  733. ProtoList[UPS_ALLOWED_VALUES] = new EepromAllowedValsPollParam(UPS_ALLOWED_VALUES, EEPROMVALUES, (int)(2000*DELAY_FACTOR), NO_POLL);
  734. #else
  735. ProtoList[UPS_ALLOWED_VALUES] = new EepromAllowedValuesPollParam(UPS_ALLOWED_VALUES, EEPROMVALUES, (int)(2000*DELAY_FACTOR), NO_POLL);
  736. #endif
  737. ProtoList[UPS_MODEL_NAME] = new UpsModelPollParam(UPS_MODEL_NAME, UPSMODELNAME, (int)(2000*DELAY_FACTOR), NO_POLL);
  738. #endif
  739. const INT TBD = 200; // This must be finalized by hardware group
  740. // Dark Star additions
  741. ProtoList[TOTAL_INVERTERS] = new NumberInstalledInvertersPollParam(TOTAL_INVERTERS, MODULECOUNTSSTATUS, (int)(TBD*DELAY_FACTOR), POLL);
  742. ProtoList[NUMBER_BAD_INVERTERS] = new NumberBadInvertersPollParam(NUMBER_BAD_INVERTERS, MODULECOUNTSSTATUS, (int)(TBD*DELAY_FACTOR), POLL);
  743. ProtoList[CURRENT_REDUNDANCY] = new RedundancyLevelPollParam(CURRENT_REDUNDANCY,MODULECOUNTSSTATUS , (int)(TBD*DELAY_FACTOR), POLL);
  744. ProtoList[MINIMUM_REDUNDANCY] = new MinimumRedundancyPollParam(MINIMUM_REDUNDANCY, MODULECOUNTSSTATUS, (int)(TBD*DELAY_FACTOR), POLL);
  745. ProtoList[CURRENT_LOAD_CAPABILITY] = new CurrentLoadCapabilityPollParam(CURRENT_LOAD_CAPABILITY, MODULECOUNTSSTATUS, (int)(TBD*DELAY_FACTOR), POLL);
  746. ProtoList[MAXIMUM_LOAD_CAPABILITY] = new MaximumLoadCapabilityPollParam(MAXIMUM_LOAD_CAPABILITY, MODULECOUNTSSTATUS, (int)(TBD*DELAY_FACTOR), POLL);
  747. ProtoList[INPUT_VOLTAGE_PHASE_A] = new PhaseAInputVoltagePollParam(INPUT_VOLTAGE_PHASE_A,INPUTVOLTAGEFREQ , (int)(TBD*DELAY_FACTOR), POLL);
  748. ProtoList[INPUT_VOLTAGE_PHASE_B] = new PhaseBInputVoltagePollParam(INPUT_VOLTAGE_PHASE_B,INPUTVOLTAGEFREQ , (int)(TBD*DELAY_FACTOR), POLL);
  749. ProtoList[INPUT_VOLTAGE_PHASE_C] = new PhaseCInputVoltagePollParam(INPUT_VOLTAGE_PHASE_C, INPUTVOLTAGEFREQ, (int)(TBD*DELAY_FACTOR), POLL);
  750. ProtoList[INPUT_FREQUENCY] = new InputFrequencyPollParam(INPUT_FREQUENCY, INPUTVOLTAGEFREQ, (int)(TBD*DELAY_FACTOR), POLL);
  751. ProtoList[OUTPUT_VOLTAGE_PHASE_A] = new PhaseAOutputVoltagePollParam(OUTPUT_VOLTAGE_PHASE_A,OUTPUTVOLTAGECURRENT , (int)(TBD*DELAY_FACTOR), POLL);
  752. ProtoList[OUTPUT_VOLTAGE_PHASE_B] = new PhaseBOutputVoltagePollParam(OUTPUT_VOLTAGE_PHASE_B,OUTPUTVOLTAGECURRENT , (int)(TBD*DELAY_FACTOR), POLL);
  753. ProtoList[OUTPUT_VOLTAGE_PHASE_C] = new PhaseCOutputVoltagePollParam(OUTPUT_VOLTAGE_PHASE_C, OUTPUTVOLTAGECURRENT, (int)(TBD*DELAY_FACTOR), POLL);
  754. ProtoList[MODULE_COUNTS_AND_STATUS] = new ModuleCountsStatusPollParam(MODULE_COUNTS_AND_STATUS, MODULECOUNTSSTATUS, (int)(TBD*DELAY_FACTOR), POLL);
  755. ProtoList[ABNORMAL_CONDITION_REGISTER] = new AbnormalCondPollParam(ABNORMAL_CONDITION_REGISTER, ABNORMALCONDITION, (int)(TBD*DELAY_FACTOR), POLL);
  756. ProtoList[INPUT_VOLTAGE_FREQUENCY] = new InputVoltageFrequencyPollParam(INPUT_VOLTAGE_FREQUENCY, INPUTVOLTAGEFREQ, (int)(TBD*DELAY_FACTOR), POLL);
  757. ProtoList[OUTPUT_VOLTAGE_CURRENTS] = new OutputVoltageCurrentsPollParam(OUTPUT_VOLTAGE_CURRENTS,OUTPUTVOLTAGECURRENT , (int)(TBD*DELAY_FACTOR), POLL);
  758. ProtoList[IM_STATUS] = new IMStatusPollParam(IM_STATUS, ABNORMALCONDITION, (int)(TBD*DELAY_FACTOR), POLL);
  759. ProtoList[IM_INSTALLATION_STATE] = new IMInstallationStatusPollParam(IM_INSTALLATION_STATE, ABNORMALCONDITION, (int)(TBD*DELAY_FACTOR), POLL);
  760. ProtoList[RIM_INSTALLATION_STATE] = new RIMInstallationStatusPollParam(RIM_INSTALLATION_STATE, MODULECOUNTSSTATUS, (int)(TBD*DELAY_FACTOR), POLL);
  761. ProtoList[RIM_STATUS] = new RIMStatusPollParam(RIM_STATUS, ABNORMALCONDITION, (int)(TBD*DELAY_FACTOR), POLL);
  762. ProtoList[REDUNDANCY_STATE] = new RedundancyConditionPollParam(REDUNDANCY_STATE, ABNORMALCONDITION, (int)(TBD*DELAY_FACTOR), POLL);
  763. ProtoList[BYPASS_CONTACTOR_STATE] = new BypassContactorStatusPollParam(BYPASS_CONTACTOR_STATE, ABNORMALCONDITION, (int)(TBD*DELAY_FACTOR), POLL);
  764. ProtoList[INPUT_BREAKER_STATE] = new InputBreakerTrippedStatusPollParam(INPUT_BREAKER_STATE, ABNORMALCONDITION, (int)(TBD*DELAY_FACTOR), POLL);
  765. ProtoList[NUMBER_OF_INPUT_PHASES] = new NumberOfInputPhasesPollParam(NUMBER_OF_INPUT_PHASES, INPUTVOLTAGEFREQ, (int)(TBD*DELAY_FACTOR), POLL);
  766. ProtoList[NUMBER_OF_OUTPUT_PHASES] = new NumberOfOutputPhasesPollParam(NUMBER_OF_OUTPUT_PHASES, INPUTVOLTAGEFREQ, (int)(TBD*DELAY_FACTOR), POLL);
  767. ProtoList[SYSTEM_FAN_STATE] = new SystemFanStatusPollParam(SYSTEM_FAN_STATE, ABNORMALCONDITION, (int)(TBD*DELAY_FACTOR), POLL);
  768. }