Loading…

Method Name: method_read_eventlogbook

Method ID: 0x484D

Method Label: Ler eventos

Method Help:


  • {
  • int nState;
  • int count_retries;
  • int nTransaction;
  • int nMasterLength;
  • int nMaxLoops;
  • long nFilter;
  • long nBCT;
  • long i;
  • long j;
  • long nCurrent;
  • long jMaxLoops;
  • unsigned int byte0;
  • unsigned int byte1;
  • unsigned int byte2;
  • unsigned int byte3;
  • unsigned int byte4;
  • unsigned int dwData;
  • long varid[2];
  • int tabnState[2];
  • long select;
  • unsigned int compareDW[29];
  • unsigned int compareVal;
  • int configChangedType;
  • _iassign(17468,0);
  • _iassign(18974,0);
  • save_values();
  • nState = 0;
  • _iassign(18075,0);
  • varid[0] = 18075;
  • save_values();
  • _set_all_resp_code(0);
  • _set_device_status(0xFF,0);
  • i = 0;
  • send_command_trans(143,10);
  • nBCT = _ivar_value(17917);
  • if (nBCT == 0 || nBCT == 107)
  • {
  • compareDW[0] = 0x3a7d6d3d;
  • compareDW[1] = 0x513e2d2d;
  • compareDW[2] = 0x717a2f6a;
  • compareDW[3] = 0x43755f46;
  • compareDW[4] = 0x41247658;
  • compareDW[5] = 0x6b3d3734;
  • compareDW[6] = 0x76737076;
  • compareDW[7] = 0x6137416f;
  • compareDW[8] = 0x435b515d;
  • compareDW[9] = 0x2b50534a;
  • compareDW[10] = 0x26766a33;
  • compareDW[11] = 0x626f235e;
  • compareDW[12] = 0x61aa7347;
  • compareDW[13] = 0x6e735477;
  • compareDW[14] = 0x264c4c34;
  • compareDW[15] = 0x3462787d;
  • compareDW[16] = 0x3a7d6d3d;
  • compareDW[17] = 0x513e2d2d;
  • compareDW[18] = 0x717a2f6a;
  • compareDW[19] = 0x43755f46;
  • compareDW[20] = 0x41247658;
  • compareDW[21] = 0x6b3d3734;
  • compareDW[22] = 0x76737076;
  • compareDW[23] = 0x6137416f;
  • compareDW[24] = 0x435b515d;
  • compareDW[25] = 0x2b50534a;
  • compareDW[26] = 0x26766a33;
  • _iassign(17917,107);
  • send_command_trans(143,0);
  • for (i = 0; i < 25; i++)
  • {
  • compareVal = _ivar_value(resolve_array_ref(18013,i));
  • if (compareDW[i] != compareVal)
  • {
  • break;
  • }
  • }
  • remove_all_abort();
  • }
  • if (i == 25)
  • {
  • nTransaction = 60;
  • nMaxLoops = 5;
  • jMaxLoops = 2;
  • nMasterLength = 38;
  • _iassign(17917,38);
  • }
  • else
  • {
  • nTransaction = 50;
  • nMaxLoops = 10;
  • jMaxLoops = 1;
  • nMasterLength = 18;
  • _iassign(17917,18);
  • }
  • send_command_trans(173,220);
  • send_command_trans(173,220);
  • _add_abort_method(18074);
  • _iassign(18014,133);
  • i = _ivar_value(17466);
  • save_values();
  • count_retries = 1;
  • _iassign(17478,2);
  • send_command_trans(146,1);
  • tabnState[0] = 17465;
  • nState = _ivar_value(17465);
  • while (count_retries < 30 && nState != 100)
  • {
  • DELAY(2,literal_string(2880));
  • _iassign(18014,133);
  • i = _ivar_value(17466);
  • save_values();
  • send_command_trans(146,1);
  • count_retries = count_retries + 1;
  • nState = _ivar_value(17465);
  • tabnState[0] = 17465;
  • }
  • if (nState != 100)
  • {
  • ACKNOWLEDGE(literal_string(2881));
  • _iassign(17468,0);
  • save_values();
  • }
  • if (nState == 100)
  • {
  • count_retries = 1;
  • _iassign(18014,133);
  • i = _ivar_value(17466);
  • save_values();
  • send_command_trans(147,1);
  • tabnState[0] = 17465;
  • nState = _ivar_value(17465);
  • save_values();
  • while (count_retries < 15 && nState != 100)
  • {
  • DELAY(2,literal_string(2880));
  • send_command_trans(147,1);
  • count_retries = count_retries + 1;
  • nState = _ivar_value(17465);
  • tabnState[0] = 17465;
  • }
  • if (nState != 100)
  • {
  • ACKNOWLEDGE(literal_string(2881));
  • _iassign(17468,0);
  • save_values();
  • }
  • }
  • if (_ivar_value(17469) == 0 && nState == 100)
  • {
  • ACKNOWLEDGE(literal_string(2882) + literal_string(2883));
  • _iassign(18014,133);
  • _iassign(18030,1);
  • send_command_trans(211,0);
  • }
  • if (_ivar_value(17469) != 0)
  • {
  • _get_dev_var_value(literal_string(2884),0,18974);
  • save_values();
  • if (_ivar_value(17469) - _ivar_value(18974) >= 10)
  • {
  • _iassign(17468,10);
  • }
  • else
  • {
  • _iassign(17468,_ivar_value(17469) - _ivar_value(18974));
  • if (nMasterLength == 18)
  • {
  • nMaxLoops = CountOfHRData;
  • }
  • else
  • {
  • nMaxLoops = CountOfHRData / 2;
  • if (CountOfHRData % 2 == 1)
  • ++nMaxLoops;
  • }
  • }
  • _iassign(18016,255);
  • send_command_trans(146,1);
  • _iassign(18014,133);
  • i = _ivar_value(17466);
  • save_values();
  • count_retries = 1;
  • _iassign(17478,2);
  • send_command_trans(146,1);
  • tabnState[0] = 17465;
  • nState = _ivar_value(17465);
  • while (count_retries < 30 && nState != 100)
  • {
  • DELAY(2,literal_string(2880));
  • _iassign(18014,133);
  • i = _ivar_value(17466);
  • save_values();
  • send_command_trans(146,1);
  • count_retries = count_retries + 1;
  • nState = _ivar_value(17465);
  • tabnState[0] = 17465;
  • }
  • if (nState != 100)
  • {
  • ACKNOWLEDGE(literal_string(2881));
  • _iassign(17468,0);
  • save_values();
  • }
  • if (nState == 100)
  • {
  • count_retries = 1;
  • _iassign(18014,133);
  • i = _ivar_value(17466);
  • save_values();
  • send_command_trans(147,1);
  • tabnState[0] = 17465;
  • nState = _ivar_value(17465);
  • save_values();
  • while (count_retries < 15 && nState != 100)
  • {
  • DELAY(2,literal_string(2880));
  • send_command_trans(147,1);
  • count_retries = count_retries + 1;
  • nState = _ivar_value(17465);
  • tabnState[0] = 17465;
  • }
  • if (nState != 100)
  • {
  • ACKNOWLEDGE(literal_string(2881));
  • _iassign(17468,0);
  • save_values();
  • }
  • }
  • save_values();
  • put_message(literal_string(2885),varid);
  • _iassign(18014,133);
  • _iassign(18030,1);
  • _iassign(18031,0);
  • _iassign(18032,0);
  • _remove_abort_method(18074);
  • _add_abort_method(18073);
  • _add_abort_method(18074);
  • send_command_trans(211,0);
  • if (_ivar_value(17917) < nMasterLength)
  • {
  • nTransaction = 50;
  • nMaxLoops = 10;
  • nMasterLength = 18;
  • _iassign(17917,18);
  • }
  • device_byte_count = 19 * _ivar_value(18974);
  • save_values();
  • for (i = 1; i <= nMaxLoops; i++)
  • {
  • _iassign(18075,i * 100 / nMaxLoops);
  • put_message(literal_string(2885),varid);
  • _iassign(18030,0);
  • _iassign(18051,0);
  • if (nTransaction >= 60)
  • {
  • if (_ivar_value(17468) - (i - 1) * 2 == 1)
  • {
  • nMasterLength = 18;
  • _iassign(17917,18);
  • nTransaction = 50 + CountOfHRData;
  • send_command_trans(212,nTransaction);
  • }
  • else
  • {
  • nMasterLength = 38;
  • _iassign(17917,38);
  • nTransaction = nTransaction + 1;
  • send_command_trans(212,nTransaction);
  • }
  • }
  • else
  • {
  • nTransaction = nTransaction + 1;
  • send_command_trans(212,nTransaction);
  • }
  • for (j = 0; j < jMaxLoops; j++)
  • {
  • nCurrent = (i - 1) * jMaxLoops + j;
  • save_values();
  • dwData = block_data_evl_union_array[nCurrent];
  • byte0 = dwData & 0xff;
  • byte1 = dwData & 0x7f;
  • byte2 = dwData >> 8 & 0xff;
  • byte3 = dwData >> 16 & 0xff;
  • byte4 = dwData >> 24 & 0xff;
  • dwData = byte3 + byte4 * 256 + 65536 * byte2 + 65536 * 256 * byte1;
  • historom_status_array[nCurrent] = dwData;
  • historom_status_int_array[nCurrent] = dwData & 0xFFFF;
  • historom_class_array[nCurrent] = byte0;
  • save_values();
  • }
  • if (nMasterLength != 18)
  • {
  • device_byte_count = 19 * _ivar_value(18974) + 38 * i;


Please login for more