protected override void communicate_main(bool slow_read_flag) { try { //クエリするSSM_codeリストの作成 List <OBDIIParameterCode> query_OBDII_code_list = new List <OBDIIParameterCode>(); foreach (OBDIIParameterCode code in Enum.GetValues(typeof(OBDIIParameterCode))) { if (slow_read_flag) { if (content_table[code].SlowReadEnable) { query_OBDII_code_list.Add(code); } } else { if (content_table[code].FastReadEnable) { query_OBDII_code_list.Add(code); } } } //Exit loop if the PIDs to query are not exists. if (query_OBDII_code_list.Count <= 0) { //SSM_codeがない場合、すぐに抜けると直後にcommunicate_mainが呼び出されCPUを占有するので、500ms待つ //SlowReadの場合、この処理はしない if (!slow_read_flag) { Thread.Sleep(500); } return; } foreach (OBDIIParameterCode code in query_OBDII_code_list) { communicateOnePID(code); } //Invoke SSMDatareceived event ELM327DataReceivedEventArgs elm327_received_eventargs = new ELM327DataReceivedEventArgs(); elm327_received_eventargs.Slow_read_flag = slow_read_flag; elm327_received_eventargs.Received_Parameter_Code = new List <OBDIIParameterCode>(query_OBDII_code_list); ELM327DataReceived(this, elm327_received_eventargs); } catch (TimeoutException ex) { logger.Warn("SSMCOM timeout. " + ex.GetType().ToString() + " " + ex.Message); communicateRealtimeIsError = true; } }
protected override void communicate_main(bool slow_read_flag) { try { //Create PID list to query List <OBDIIParameterCode> query_OBDII_code_list = new List <OBDIIParameterCode>(); foreach (OBDIIParameterCode code in Enum.GetValues(typeof(OBDIIParameterCode))) { if (slow_read_flag) { if (content_table[code].SlowReadEnable) { query_OBDII_code_list.Add(code); } } else { if (content_table[code].FastReadEnable) { query_OBDII_code_list.Add(code); } } } //Exit loop if the PIDs to query are not exists. if (query_OBDII_code_list.Count <= 0) { //If no PIDs are in query list, return with waiting 500ms(wait is ignored if slow_read_flag = true). if (!slow_read_flag) { Thread.Sleep(500); } return; } foreach (OBDIIParameterCode code in query_OBDII_code_list) { communicateOnePID(code); } //Invoke SSMDatareceived event ELM327DataReceivedEventArgs elm327_received_eventargs = new ELM327DataReceivedEventArgs(); elm327_received_eventargs.Slow_read_flag = slow_read_flag; elm327_received_eventargs.Received_Parameter_Code = new List <OBDIIParameterCode>(query_OBDII_code_list); ELM327DataReceived(this, elm327_received_eventargs); } catch (TimeoutException ex) { logger.Warn("SSMCOM timeout. " + ex.GetType().ToString() + " " + ex.Message); communicateRealtimeIsError = true; } }