Loading…

Method Name: method_read_eventlogbook

Method ID: 0x4817

Method Label: Read events

Method Help:


  • {
  • int nState;
  • int count_retries;
  • int nTransaction;
  • int nMasterLength;
  • int nMaxLoops;
  • long nFilter;
  • long nMaxBCT;
  • 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];
  • unsigned int compareDW[29];
  • unsigned int compareVal;
  • int configChangedType;
  • _iassign(17447,0);
  • _iassign(18967,0);
  • save_values();
  • nState = 0;
  • _iassign(17941,0);
  • varid[0] = 17941;
  • save_values();
  • _set_comm_status(0x7F,1);
  • _set_no_device(1);
  • _set_all_resp_code(0);
  • _set_device_status(0xFF,0);
  • i = 0;
  • send_command_trans(143,10);
  • nBCT = _ivar_value(17781);
  • nMaxBCT = _ivar_value(17782);
  • if (nMaxBCT == 0 || nMaxBCT == 107 && nBCT == 0)
  • {
  • _add_abort_method(17877);
  • 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(17781,110);
  • send_command_trans(143,0);
  • _iassign(17781,107);
  • send_command_trans(143,0);
  • for (i = 0; i < 25; i++)
  • {
  • compareVal = _ivar_value(resolve_array_ref(17878,i));
  • if (compareDW[i] != compareVal)
  • {
  • break;
  • }
  • }
  • remove_all_abort();
  • }
  • if (i == 0 && nMaxBCT != 110 || i == 25)
  • {
  • nTransaction = 60;
  • nMaxLoops = 5;
  • jMaxLoops = 2;
  • nMasterLength = 38;
  • _iassign(17781,38);
  • }
  • else
  • {
  • nTransaction = 50;
  • nMaxLoops = 10;
  • jMaxLoops = 1;
  • nMasterLength = 18;
  • _iassign(17781,18);
  • }
  • send_command_trans(173,269);
  • send_command_trans(173,269);
  • _add_abort_method(17940);
  • _iassign(17879,133);
  • i = _ivar_value(17445);
  • save_values();
  • count_retries = 1;
  • _iassign(17460,2);
  • send_command_trans(146,1);
  • tabnState[0] = 17444;
  • nState = _ivar_value(17444);
  • while (count_retries < 30 && nState != 100)
  • {
  • DELAY(2,literal_string(2804));
  • _iassign(17879,133);
  • i = _ivar_value(17445);
  • save_values();
  • send_command_trans(146,1);
  • count_retries = count_retries + 1;
  • nState = _ivar_value(17444);
  • tabnState[0] = 17444;
  • }
  • if (nState != 100)
  • {
  • ACKNOWLEDGE(literal_string(2715));
  • _iassign(17447,0);
  • save_values();
  • }
  • if (nState == 100)
  • {
  • count_retries = 1;
  • _iassign(17879,133);
  • i = _ivar_value(17445);
  • save_values();
  • send_command_trans(147,1);
  • tabnState[0] = 17444;
  • nState = _ivar_value(17444);
  • save_values();
  • while (count_retries < 15 && nState != 100)
  • {
  • DELAY(2,literal_string(2804));
  • send_command_trans(147,1);
  • count_retries = count_retries + 1;
  • nState = _ivar_value(17444);
  • tabnState[0] = 17444;
  • }
  • if (nState != 100)
  • {
  • ACKNOWLEDGE(literal_string(2715));
  • _iassign(17447,0);
  • save_values();
  • }
  • }
  • if (_ivar_value(17448) == 0 && nState == 100)
  • {
  • ACKNOWLEDGE(literal_string(2805) + literal_string(2806));
  • _iassign(17879,133);
  • _iassign(17895,1);
  • send_command_trans(211,0);
  • }
  • if (_ivar_value(17448) != 0)
  • {
  • _get_dev_var_value(literal_string(2807),0,18967);
  • save_values();
  • if (_ivar_value(17448) - _ivar_value(18967) >= 10)
  • {
  • _iassign(17447,10);
  • }
  • else
  • {
  • _iassign(17447,_ivar_value(17448) - _ivar_value(18967));
  • if (nMasterLength == 18)
  • {
  • nMaxLoops = CountOfHRData;
  • }
  • else
  • {
  • nMaxLoops = CountOfHRData / 2;
  • if (CountOfHRData % 2 == 1)
  • ++nMaxLoops;
  • }
  • }
  • _iassign(17881,255);
  • send_command_trans(146,1);
  • _iassign(17879,133);
  • i = _ivar_value(17445);
  • save_values();
  • count_retries = 1;
  • _iassign(17460,2);
  • send_command_trans(146,1);
  • tabnState[0] = 17444;
  • nState = _ivar_value(17444);
  • while (count_retries < 30 && nState != 100)
  • {
  • DELAY(2,literal_string(2804));
  • _iassign(17879,133);
  • i = _ivar_value(17445);
  • save_values();
  • send_command_trans(146,1);
  • count_retries = count_retries + 1;
  • nState = _ivar_value(17444);
  • tabnState[0] = 17444;
  • }
  • if (nState != 100)
  • {
  • ACKNOWLEDGE(literal_string(2715));
  • _iassign(17447,0);
  • save_values();
  • }
  • if (nState == 100)
  • {
  • count_retries = 1;
  • _iassign(17879,133);
  • i = _ivar_value(17445);
  • save_values();
  • send_command_trans(147,1);
  • tabnState[0] = 17444;
  • nState = _ivar_value(17444);
  • save_values();
  • while (count_retries < 15 && nState != 100)
  • {
  • DELAY(2,literal_string(2804));
  • send_command_trans(147,1);
  • count_retries = count_retries + 1;
  • nState = _ivar_value(17444);
  • tabnState[0] = 17444;
  • }
  • if (nState != 100)
  • {
  • ACKNOWLEDGE(literal_string(2715));
  • _iassign(17447,0);
  • save_values();
  • }
  • }
  • save_values();
  • put_message(literal_string(2808),varid);
  • _iassign(17879,133);
  • _iassign(17895,1);
  • _iassign(17896,0);
  • _iassign(17897,0);
  • _remove_abort_method(17940);
  • _add_abort_method(17939);
  • _add_abort_method(17940);
  • send_command_trans(211,0);
  • if (_ivar_value(17782) < nMasterLength)
  • {
  • nTransaction = 50;
  • nMaxLoops = 10;
  • nMasterLength = 18;
  • _iassign(17781,18);
  • }
  • device_byte_count = 19 * _ivar_value(18967);
  • save_values();
  • for (i = 1; i <= nMaxLoops; i++)
  • {
  • _iassign(17941,i * 100 / nMaxLoops);
  • put_message(literal_string(2808),varid);
  • _iassign(17895,0);
  • _iassign(17916,0);
  • if (nTransaction >= 60)
  • {
  • if (_ivar_value(17447) - (i - 1) * 2 == 1)
  • {
  • nMasterLength = 18;
  • _iassign(17781,18);
  • nTransaction = 50 + CountOfHRData;
  • send_command_trans(212,nTransaction);
  • }
  • else
  • {
  • nMasterLength = 38;
  • _iassign(17781,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();


Please login for more