private string decide_msg_com_support_type(ParserMessageInformation decide_msg_object) { string ret = ""; //System.Console.WriteLine(string.Format("decide_msg_object = {0}", decide_msg_object.MessageComSupport)); // private const string = "0"; //private const string COM_SUPPORT_TYPE = "1"; if (decide_msg_object.MessageComSupport == NOT_COM_SUPPORT_TYPE) { ret = "FALSE"; } else if (decide_msg_object.MessageComSupport == COM_SUPPORT_TYPE) { ret = "TRUE"; } return(ret); }
private string decide_msg_send_type(ParserMessageInformation decide_msg_object) { string ret = ""; byte result_msg_send_type = 0; //메시지에 해당하는 시그널들에 모든 전송타입을 체크하여, 최종 시그널 전송타입을 설정한다. foreach (var sig_object in parser_sig_info) { if (decide_msg_object.MessageID == sig_object.SignalParentID) { //DTM, PTM, MTM // 시그널 전송모드가 Cyclic일경우 if (sig_object.SignalSendProperty == CYCLE_SIG_SEND_TYPE) { result_msg_send_type |= MODE_CYCLE; } // 시그널 전송모드가 없을 경우 else if (sig_object.SignalSendProperty == NON_SIG_SEND_TYPE) { result_msg_send_type |= NON_MODE; } // 시그널 전송모드가 전송모드 Event 또는 Repetition 이벤트 일경우 else { result_msg_send_type |= MODE_EVENT; } } } //시그널이 아무런 전송타입이 없을경우 if (result_msg_send_type == NON_MODE) { // 메시지가 Cycle 메시지일경우 if (decide_msg_object.MessageSendMode == CYCLE_MSG_SEND_TYPE) { ret = "PTM"; } // 메시지가 Cycle 메시지가 아닐경우 else { ret = "NON_SEND_MODE"; } } //시그널 전송타입이 Cycle일경우 else if (result_msg_send_type == MODE_CYCLE) { ret = "PTM"; } //시그널 전송타입이 Event메시지 일경우 else if (result_msg_send_type == MODE_EVENT) { if (decide_msg_object.MessageSendMode == CYCLE_MSG_SEND_TYPE) //메시지 전송타입이 Cycle전송일경우 { ret = "MTM"; //혼합전송모드 } else if (decide_msg_object.MessageSendMode == NON_MSG_SEND_TYPE) { ret = "DTM";// 이벤트 모드 } } else if (result_msg_send_type == (MODE_CYCLE | MODE_EVENT)) { ret = "MTM"; } return(ret); }
/*Command에 대한 database 파싱*/ private void process_database_command(string[] process_command, int process_command_length, string select_node_name) { string command = process_command[0]; //시그널 타입뒤에 모든 노드 저장 필요 switch (command) { case "BA_": if (process_command_length > 1) { switch (process_command[1]) { case "GenMsgCycleTime": set_message_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4]); break; case "GenMsgCycleTimeFast": set_message_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4]); break; case "GenMsgNrOfRepetition": set_message_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4]); break; case "GenMsgDelayTime": set_message_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4]); break; case "GenMsgStartDelayTime": set_message_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4]); break; case "GenMsgSendType": set_message_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4]); break; case "GenSigSendType": set_signal_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4], process_command[5]); break; case "GenSigStartValue": set_signal_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4], process_command[5]); break; case "GenSigTimeoutValue": set_signal_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4], process_command[5]); break; case "GenMsgILSupport": set_message_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4]); break; case "TpTxIndex": set_message_attribute_by_id(Convert.ToUInt32(process_command[3]), process_command[1], process_command[4]); break; default: break; } } break; case "BU_": int command_index = 0; for (command_index = 1; command_index < process_command_length; command_index++) { database_node.AddLast(process_command[command_index]); } break; case "BO_": if (select_msg_object != null) { if (select_msg_object.MessageDirection == "") { parser_msg_info.Remove(select_msg_object); } else { select_msg_object = null; } } else { select_msg_object = null; } select_msg_object = new ParserMessageInformation(); select_msg_object.MessageID = Convert.ToUInt32(Convert.ToUInt32(process_command[1])); select_msg_object.MessageName = process_command[2]; select_msg_object.MessageLength = Convert.ToUInt32(process_command[3]); select_msg_object.MessageNode = process_command[4]; if (select_msg_object.MessageNode == select_node_name) { select_msg_object.MessageDirection = "SEND"; } else { ; } parser_msg_info.AddLast(select_msg_object); break; case "BA_DEF_": if (process_command[2] == "GenMsgSendType") { for (int index = 4; index < process_command_length; index++) { message_send_type.AddLast(process_command[index]); } } else if (process_command[2] == "GenSigSendType") { for (int index = 4; index < process_command_length; index++) { signal_send_type.AddLast(process_command[index]); } } else if (process_command[2] == "GenMsgILSupport") { for (int index = 4; index < process_command_length; index++) { il_support_type.AddLast(process_command[index]); } } break; case "BA_DEF_DEF_": int attribute_index = 0; if (process_command_length > 1) { switch (process_command[1]) { case "GenMsgCycleTime": foreach (var parser_msg_object in parser_msg_info) { parser_msg_object.MessageCycleTime = Convert.ToUInt32(process_command[process_command_length - 1]); } break; case "GenMsgCycleTimeFast": foreach (var parser_msg_object in parser_msg_info) { parser_msg_object.MessageRepetitonCycleTime = Convert.ToUInt32(process_command[process_command_length - 1]); } break; case "GenMsgNrOfRepetition": foreach (var parser_msg_object in parser_msg_info) { parser_msg_object.MessageRepetitonNumber = Convert.ToUInt32(process_command[process_command_length - 1]); } break; case "GenMsgDelayTime": foreach (var parser_msg_object in parser_msg_info) { parser_msg_object.MessageDelayTime = Convert.ToUInt32(process_command[process_command_length - 1]); } break; case "GenMsgStartDelayTime": foreach (var parser_msg_object in parser_msg_info) { parser_msg_object.MessageStartOffsetDelay = Convert.ToUInt32(process_command[process_command_length - 1]); } break; case "GenMsgSendType": attribute_index = 0; foreach (var parser_msg_object in parser_msg_info) { foreach (string message_send_type_object in message_send_type) { if (process_command[process_command_length - 1] == message_send_type_object) { set_message_attribute_by_id(parser_msg_object.MessageID, process_command[1], string.Format("{0}", attribute_index)); attribute_index = 0; break; } else { attribute_index++; } } } break; case "GenSigSendType": attribute_index = 0; foreach (var parser_sig_object in parser_sig_info) { // parser_sig_object.SignalSendProperty = process_command[process_command_length - 1]; foreach (string signal_send_type_object in signal_send_type) { if (process_command[process_command_length - 1] == signal_send_type_object) { /*전송 타입이 ENUM이므로 전송 타입에 해당하는 attribute_index를 저장한다 */ //set_signal_attribute_by_id(parser_sig_object.SignalParentID, process_command[1], string.Format("{0}", attribute_index)); parser_sig_object.SignalSendProperty = string.Format("{0}", attribute_index); attribute_index = 0; break; } else { attribute_index++; } } } break; case "GenSigStartValue": foreach (var parser_sig_object in parser_sig_info) { parser_sig_object.SignalStartValue = Convert.ToUInt32(process_command[process_command_length - 1]); } break; case "GenSigTimeoutValue": foreach (var parser_sig_object in parser_sig_info) { parser_sig_object.SignalTimeoutValue = Convert.ToUInt32(process_command[process_command_length - 1]); } break; case "GenMsgILSupport": attribute_index = 0; foreach (var parser_msg_object in parser_msg_info) { foreach (string il_support_type_object in il_support_type) { if (process_command[process_command_length - 1] == il_support_type_object) { set_message_attribute_by_id(parser_msg_object.MessageID, process_command[1], string.Format("{0}", attribute_index)); attribute_index = 0; break; } else { attribute_index++; } } } break; default: break; } } break; case "BA_REL_": break; case "BA_SG_REL_": break; case "SG_": select_sig_object = new ParserSignalInformation(); select_sig_object.SignalName = process_command[1]; select_sig_object.SignalStartOffsetBit = Convert.ToUInt32(process_command[2]); select_sig_object.SignalBitLength = Convert.ToUInt32(process_command[3]); if (process_command[4] == "0+") { select_sig_object.SignalByteOrder = "BYTE_ORDER_BIG_ENDIAN"; } else { select_sig_object.SignalByteOrder = "BYTE_ORDER_LITTLE_ENDIAN"; } /*수신노드 처리 */ if (select_msg_object.MessageNode == select_node_name) // 전송 { select_sig_object.SignalParentID = select_msg_object.MessageID; parser_sig_info.AddLast(select_sig_object); } else // 수신 { for (int index = 9; index < process_command_length; index++) { if (process_command[index] == select_node_name) { select_msg_object.MessageDirection = "RECEIVE"; select_sig_object.SignalParentID = select_msg_object.MessageID; parser_sig_info.AddLast(select_sig_object); break; } else { ; } } } break; case "CM_": break; } }