Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show ASCII text string in UDS response window #1300

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/BUSMASTER/UDS_Protocol/UDSMainWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ void CUDSMainWnd::OnBnClickedSendUD()
KillTimer(ID_TIMER_TP); //Added to kill the timer everyTime I've pressed the SEND button
FSending = TRUE; // This flag is used to know if a message has been sent from the UDSMainWnd
Bytes_to_Show= ("\r\n 1 -> ");
StringToShow.Empty();
BytesShown_Line = 1;
m_abDatas = " ";
CurrentService = m_omMsgDataEdit.Left(NO_OF_CHAR_IN_BYTE); //Baiasu
Expand Down Expand Up @@ -640,7 +641,7 @@ Modifications :
void CUDSMainWnd::OnTimer(UINT_PTR nIDEvent)
{

//Env�a TesterPresent
//Env�a TesterPresent
if(nIDEvent ==ID_TIMER_TP && psTxCanMsgUds->m_psTxMsg != NULL) //Prepare the message
{

Expand Down
3 changes: 2 additions & 1 deletion Sources/BUSMASTER/UDS_Protocol/UDSMainWnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern int SizeFC;
extern int P2_Time;
extern int P2_Time_Extended;
extern CString Bytes_to_Show;
extern CString StringToShow;

/** This variable is used to know if a message has been sent from the UDSMainWnd */
extern bool FSending;
Expand Down Expand Up @@ -107,7 +108,7 @@ class CUDSMainWnd : public CDialog

CFont m_Font;

// Declaraci�n de funciones
// Declaraci�n de funciones
(void)vInitializeUDSfFields();

/**
Expand Down
15 changes: 13 additions & 2 deletions Sources/BUSMASTER/UDS_Protocol/UDS_Protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ int Current_Channel;
bool FSending = FALSE;

CString Bytes_to_Show= ("\r\n 1-> ");
CString StringToShow;

/** This variable is used to determinate how many continuos frames will be received */
float TotalFrames;
Expand Down Expand Up @@ -194,6 +195,17 @@ void CUDS_Protocol::Show_ResponseData(unsigned char psMsg[], unsigned char Datal
for (int ByteCounter = posFirstByte+1; ByteCounter<loc ; ByteCounter++)
{
UCHAR TempByte = (psMsg[ByteCounter]) ;

// Check if the character can be printed, otherwise use '?' instead
if ( (TempByte >= 0x20) && (TempByte <= 0x7E) )
{
StringToShow += TempByte;
}
else
{
StringToShow += '?';
}

int Temp_char2Int = TempByte;
intResp = sprintf (hex,"%02X ",Temp_char2Int);
Bytes_to_Show = Bytes_to_Show + hex;
Expand All @@ -216,8 +228,7 @@ void CUDS_Protocol::Show_ResponseData(unsigned char psMsg[], unsigned char Datal

}
}
omMainWnd->m_abDatas = Bytes_to_Show + '\0';

omMainWnd->m_abDatas = Bytes_to_Show + "\r\n\r\n" + StringToShow;
omMainWnd->UpdateData(false);
}
}
Expand Down