Hi Stefan.
I'm using the serial connection. Today I've noted that the timestamp in the Log and Consoles is triggered only by send end receive events but non by a direct writing to the console with addMessageToLogAndConsoles(QString text). I have in mind to filter the incoming serial data for a data acquisition application BEFORE writing the data in the main console (or log file).
The simplest approach could be to uncheck the send and receive boxes in console and log preferences and use only the addMessageToLogAndConsoles(QString text) inside a dataReceivedSlot(data) function.
Unfortunatly I've noted that timestamp is not triggered in this way. Is it possible to (optionally) activate the timestamp generation inside the addMessageToLogAndConsoles(QString text)?
A clever approach could be to introduce a javascript callback routine for modifiyng the incoming data BEFORE printing it in the console or log file. I do not know if this could be done inside the dataReceivedSlot(data) function. A similar solution could be used before printing the sent data.
I've noted that you used this approach in the sequences for filtering data before sending it (sendData(data)).
I know this is tedious for you at this time, but having the possibility to modify incoming data immediately before storing it could be a great improvement (i.e. you can convert sensor data from voltages to concentrations in realtime; simulate a schmitt trigger, triggerring DSO signals etc etc)
What do you think?
Kindest Regards,
Pier Andrea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
a addMessageToLogAndConsoles triggers a timestamp if the time stamp interval has elapsed. If you set the interval to 0 then a timestamp is generated every call. But it is a good idea to give addMessageToLogAndConsoles an extra argument (to generate a timestamp independently from the time stamp interval).
Filter script: This is a good idea (but a lot of work). Do you need this quickly?
Best regards,
Stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Stefan,
You are doing a great work. Thank you so much.
No more suggestion for a while, I promise, Just tests and feedback.
Thank you again.
Kindest regards.
Pier Andrea
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
try
{
//start the periodically timer which calls the function timeout
var timer = scriptThread.createTimer()
timer.timeout.connect(timeout);
scriptThread.appendTextToConsole('Timer started ');
timer.start(1000);
}
catch(e)
{
//Check if this script is executed in the send window.
var isSequenceSendScript = true;
try
{
if(table)
{//The user has started the script in the send window.
table.messageBox("error", "this is not a sequence send script, this script can only executed in the script window");
}
}
catch(e)
{
isSequenceSendScript = false;
}
if(!isSequenceSendScript)
{
scriptThread.appendTextToConsole("exception while starting the script: " + e);
scriptThread.stopScript()
}
}
Did I Make some mistake?
Kindest Regards,
Pier Anrea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have loaded your script into ScriptCommunicator (ScriptCommunicator_02_17_test_revision_586_windows.zip) and I have timestamps in the log and the console (see attachement).
Do you use the correct version of ScriptCommunicator?
Best regards
Hi Stefan,
the version is correct. I think I have found the problem. I think in your console and log options the SEND checkbox is checked. Try to uncheck it and restart the script: non more timestamp!
Thank you,
Kindest Regards,
Pier Andrea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have uploaded a new pre release (ScriptCommunicator_02_17_test_revision_595_windows.zip) which includes a custom console and a custom log. Under exampleScripts\CustomLogAndConsole you can find an example script.
Best regards,
Stefan
Last edit: Stefan Zieker 2015-06-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Stefan,
I've downloaded your last test version and the potential of your CustomLogAndConsole approach is great. I need to understand a little bit about the usage:
1) Do I have to check (not uncheck as indicated in the example script) the custom checkbox in console/log settings?
2) Do I have to select the script CustomLogAndConsole.js by using the search button and have the path of the script in the corrsponding textbox?
3) When the parameter (isSend = isUserMessage = isFromCan = false) then the data is from a NON CAN serial connection or (also) from TCP/UDP?
I Have understood this, plese correct me if I'm wrong. The function "createString" in the file is a callback called BEFORE a console or a log print when the custom console/log is selected. The script CustomLogAndConsole.js is not a standard script or a sequence script but only a callback.
Just an observation: because your software starts to be complex I suggest you to SEPARATE the scripts in different folders i.e.:
In this way the approach is less confusing for the final user.
I think, at moment this is the most important and the CORE FUNCTION for a data acquisition system, I'll try to do some tests but, the approach is absolutely amazing. Immagine...Just changing this callback function you could change the message sent and formatting the returning data!!!
Absolutely clever!
I'll write a message ASAP with my preliminary tests.
Thank you again.
Kindest Regards,
Pier Andrea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have to check the corresponding checkbox (to reload a changed script you have to uncheck and then check again the corresponding checkbox or press the search button)
yes
In this case the data has been received from serial, TCP or UDP
The function 'createString' is a callback function, but you can have variables outside of this function e.g. to store the received data (in contrast to a sequence script (after sending the data a sequence script is unloaded)). Only the return value is written into the custom log or the custom console.
The separation of the scripts is a good idea.
Best regards,
Stefan
Last edit: Stefan Zieker 2015-06-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Stefan,
I've started to try your new custom console/log and is a great new toy for my purposes. Just an observation: in the custom console we lose the timestamp. Just a small suggestion, is it difficult for you to pass the timeStamp as extra parameter (formatted string as indicated in the console/log settings) to the createString function? In this way you could have access to all data for making a dataline in a CSV (log) file:
resultString = timeStamp + formattedData
If it is too difficult you could create a global variable in which memorize the last timeStamp (at the desidered granulation level:100, 200, nnnn milliseconds) and recall the formatted string value by a function like GetLastTimestamp().
I'm sorry if I'm tedious and I know you are working a lot for making big changes. But I think you are close to have the full control over the entire logging process with a high level of customization/personalization.
Thank you again for your efforts.
Kindest Regards,
Pier Andrea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Stefan,
a minor bug this time. When you set the focus on the textarea of the custom console (simply by clicking inside) and you press a key (any key) the applicaton crashes.
I tried this with and without the Serialport connected.
Kindest Regards,
Pier Andrea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Stefan,
In my preliminary test the new custom log/console script works perfectly!
Do you have a reference about the HTML tags that it is possible to use in the custom console? (Standard HTML 5 tags?)
Thank you again.
Kindest Regards,
Pier Andrea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the console is a QTextEdit. The documentation says a subset of HTML 3.2 and 4 (but I could not find what subset exactly means). My experience is that you can use the standard HTML 5 tags.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Stefan,
Just a curiosity.
In your log is possible to write a TEXT or/and HTML file. I think that CustomLogAndConsole .js script could offer the possbility to write the HTML content not only in the custom console but also in the HTML log file.
I suggest you to allow this by passing an extra paramenter to the createString routine or, better, to change the actual arguments from booleans to integers ie:
isLog = 0 // no log files
isLog = 1 // TEXT LOG
isLog = 2 // HTML LOG
isLog = 3 // TEXT + HTML LOG
In the same manner You could simplify other arguments in this way i.e. the isSend, isUserMessage, isFromCan arguments could be merged in a single argument:
Please Note that the function for me is perfect in the actual form, but I show you some potential extra improvements.
Thank you for your patience and your great work.
Kindest Regards.
Pier Andrea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
isLog can just have 0 or 1 (that means the created string is added to the custom console or to the custom log). The format of the custom log is determined by the custom script (you can create whatever you want, ScriptCommunicator writes the log string directly into the custom log file).
If you select the HTML and the custom log in the settings dialog then you will have a custom and a HTML log. The custom script has to access to the HTML log.
isReceivedFromCAN is only given because the first bytes in the data array are the CAN meta data (e.g. CAN id). For the script it is not relevant with which interface (in addition to CAN) the data has been received or has been sent with. Therefor messageType should be:
messageType = 0 // received from interface (all but CAN)
messageType = 1 // sent with interface (all but CAN)
messageType = 2 // received from CAN
messageType = 3 // sent with CAN
messageType = 4 // isUserMessage
Best regards,
Stefan
Last edit: Stefan Zieker 2015-06-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Stefan,
a minor observation.
When you start a script without UI from script window and you remove the running script, it is impossible to stop it. I suggest you two potential solutions:
1) Disable the remove script menuitem when the script is running or paused
2) Check if the script is running and, in affirmative case, Stop the script BEFORE removing it in the menuitem associated routine.
Kindest Regards,
Pier Andrea.
Last edit: Anonymous 2015-06-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Stefan,
Today I played a little bit with your last version and I made a simple logic analyzer by mixing HTML and Javascript in the custom console (see the attached picture).
In the attached zip file you can find two scripts:
1) RNDByteGenerator.js (main script)
2) CustomLogAndConsole.js (custom console/log script)
3) A media directory with for gif files used by the previous script (please put this directory in the main ScriptCommunicator Folder)
If you activate the custom logging console you could have a SEMI GRAPHIC console with PICTURES INSIDE!
The result is very funny!
Kindest Regards,
Pier Andrea.
Hi Stefan,
another (16-bit) packet analyzer with MSB-LSB frame.
I'll play a little more with small payload packets (8-64 bits).
It is fantastic for developing serial protocols for controlling remote MCUs by using binary streams of data with an intuitive and immediate representation.
Kindest Regards,
Pier Andrea,
thx for the bug report. And wow it was not my intention that you can do such great things with the custom console. Can I put your custom console test in the example scripts folder of ScriptCommunicator?
PS: I will a add a function to read the folder of the custom console script. Then you can add the images relative to the custom console script.
Best regards,
Stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan.
I'm using the serial connection. Today I've noted that the timestamp in the Log and Consoles is triggered only by send end receive events but non by a direct writing to the console with addMessageToLogAndConsoles(QString text). I have in mind to filter the incoming serial data for a data acquisition application BEFORE writing the data in the main console (or log file).
The simplest approach could be to uncheck the send and receive boxes in console and log preferences and use only the addMessageToLogAndConsoles(QString text) inside a dataReceivedSlot(data) function.
Unfortunatly I've noted that timestamp is not triggered in this way. Is it possible to (optionally) activate the timestamp generation inside the addMessageToLogAndConsoles(QString text)?
i.e.:
addMessageToLogAndConsoles(QString text, bool timestamp=false) ?
A clever approach could be to introduce a javascript callback routine for modifiyng the incoming data BEFORE printing it in the console or log file. I do not know if this could be done inside the dataReceivedSlot(data) function. A similar solution could be used before printing the sent data.
I've noted that you used this approach in the sequences for filtering data before sending it (sendData(data)).
I know this is tedious for you at this time, but having the possibility to modify incoming data immediately before storing it could be a great improvement (i.e. you can convert sensor data from voltages to concentrations in realtime; simulate a schmitt trigger, triggerring DSO signals etc etc)
What do you think?
Kindest Regards,
Pier Andrea.
Hi Pier,
a addMessageToLogAndConsoles triggers a timestamp if the time stamp interval has elapsed. If you set the interval to 0 then a timestamp is generated every call. But it is a good idea to give addMessageToLogAndConsoles an extra argument (to generate a timestamp independently from the time stamp interval).
Filter script: This is a good idea (but a lot of work). Do you need this quickly?
Best regards,
Stefan
Hi Pier,
I have uploaded ScriptCommunicator_02_17_test_revision_586_windows.zip, which includes:
Best regards,
Stefan
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
You are doing a great work. Thank you so much.
No more suggestion for a while, I promise, Just tests and feedback.
Thank you again.
Kindest regards.
Pier Andrea
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
the following script is unable to trigger a timestamp generaton in the main console:
/**********
This script demonstrates the generation of a timestamp on demand.************/
function stopScript()
{
scriptThread.appendTextToConsole("Timer stopped ");
}
function timeout()
{
}
try
{
//start the periodically timer which calls the function timeout
var timer = scriptThread.createTimer()
timer.timeout.connect(timeout);
scriptThread.appendTextToConsole('Timer started ');
timer.start(1000);
}
catch(e)
{
//Check if this script is executed in the send window.
var isSequenceSendScript = true;
try
{
if(table)
{//The user has started the script in the send window.
table.messageBox("error", "this is not a sequence send script, this script can only executed in the script window");
}
}
catch(e)
{
isSequenceSendScript = false;
}
if(!isSequenceSendScript)
{
scriptThread.appendTextToConsole("exception while starting the script: " + e);
scriptThread.stopScript()
}
}
Did I Make some mistake?
Kindest Regards,
Pier Anrea.
Hi Pier,
I have loaded your script into ScriptCommunicator (ScriptCommunicator_02_17_test_revision_586_windows.zip) and I have timestamps in the log and the console (see attachement).
Do you use the correct version of ScriptCommunicator?
Best regards
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
the version is correct. I think I have found the problem. I think in your console and log options the SEND checkbox is checked. Try to uncheck it and restart the script: non more timestamp!
Thank you,
Kindest Regards,
Pier Andrea.
Hi Pier,
I have uploaded a new pre release (ScriptCommunicator_02_17_test_revision_592_windows.zip).
Best regards,
Stefan
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
Your new test release works like a charm!
Thank you,
Kindest Regards,
Pier Andrea.
Hi Pier,
I have uploaded a new pre release (ScriptCommunicator_02_17_test_revision_595_windows.zip) which includes a custom console and a custom log. Under exampleScripts\CustomLogAndConsole you can find an example script.
Best regards,
Stefan
Last edit: Stefan Zieker 2015-06-16
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
I've downloaded your last test version and the potential of your CustomLogAndConsole approach is great. I need to understand a little bit about the usage:
1) Do I have to check (not uncheck as indicated in the example script) the custom checkbox in console/log settings?
2) Do I have to select the script CustomLogAndConsole.js by using the search button and have the path of the script in the corrsponding textbox?
3) When the parameter (isSend = isUserMessage = isFromCan = false) then the data is from a NON CAN serial connection or (also) from TCP/UDP?
I Have understood this, plese correct me if I'm wrong. The function "createString" in the file is a callback called BEFORE a console or a log print when the custom console/log is selected. The script CustomLogAndConsole.js is not a standard script or a sequence script but only a callback.
Just an observation: because your software starts to be complex I suggest you to SEPARATE the scripts in different folders i.e.:
1)Example Scripts
2)Sequence Scripts
3)Custom Console/logs scripts
In this way the approach is less confusing for the final user.
I think, at moment this is the most important and the CORE FUNCTION for a data acquisition system, I'll try to do some tests but, the approach is absolutely amazing. Immagine...Just changing this callback function you could change the message sent and formatting the returning data!!!
Absolutely clever!
I'll write a message ASAP with my preliminary tests.
Thank you again.
Kindest Regards,
Pier Andrea.
Hi Pier,
The function 'createString' is a callback function, but you can have variables outside of this function e.g. to store the received data (in contrast to a sequence script (after sending the data a sequence script is unloaded)). Only the return value is written into the custom log or the custom console.
The separation of the scripts is a good idea.
Best regards,
Stefan
Last edit: Stefan Zieker 2015-06-16
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
I've started to try your new custom console/log and is a great new toy for my purposes. Just an observation: in the custom console we lose the timestamp. Just a small suggestion, is it difficult for you to pass the timeStamp as extra parameter (formatted string as indicated in the console/log settings) to the createString function? In this way you could have access to all data for making a dataline in a CSV (log) file:
resultString = timeStamp + formattedData
If it is too difficult you could create a global variable in which memorize the last timeStamp (at the desidered granulation level:100, 200, nnnn milliseconds) and recall the formatted string value by a function like GetLastTimestamp().
I'm sorry if I'm tedious and I know you are working a lot for making big changes. But I think you are close to have the full control over the entire logging process with a high level of customization/personalization.
Thank you again for your efforts.
Kindest Regards,
Pier Andrea.
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
a minor bug this time. When you set the focus on the textarea of the custom console (simply by clicking inside) and you press a key (any key) the applicaton crashes.
I tried this with and without the Serialport connected.
Kindest Regards,
Pier Andrea.
Hi Pier,
I have uploaded a new pre release (ScriptCommunicator_02_17_test_revision_702_windows.zip).
Best regards,
Stefan
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
In my preliminary test the new custom log/console script works perfectly!
Do you have a reference about the HTML tags that it is possible to use in the custom console? (Standard HTML 5 tags?)
Thank you again.
Kindest Regards,
Pier Andrea.
Hi Pier,
the console is a QTextEdit. The documentation says a subset of HTML 3.2 and 4 (but I could not find what subset exactly means). My experience is that you can use the standard HTML 5 tags.
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
Just a curiosity.
In your log is possible to write a TEXT or/and HTML file. I think that CustomLogAndConsole .js script could offer the possbility to write the HTML content not only in the custom console but also in the HTML log file.
I suggest you to allow this by passing an extra paramenter to the createString routine or, better, to change the actual arguments from booleans to integers ie:
isLog = 0 // no log files
isLog = 1 // TEXT LOG
isLog = 2 // HTML LOG
isLog = 3 // TEXT + HTML LOG
In the same manner You could simplify other arguments in this way i.e. the isSend, isUserMessage, isFromCan arguments could be merged in a single argument:
messageType = 0 // isSend
messageType = 1 // isReceivedFromSerial
messageType = 2 // isReceivedFromCAN
messageType = 3 // isUserMessage
if you want, in the future you can add other custom values in a simple way without adding extra parameters:
messageType = 4 // isReceivedFromTCP
messageType = 5 // isReceivedFromUDP etc.
Please Note that the function for me is perfect in the actual form, but I show you some potential extra improvements.
Thank you for your patience and your great work.
Kindest Regards.
Pier Andrea.
Hi Pier,
isLog can just have 0 or 1 (that means the created string is added to the custom console or to the custom log). The format of the custom log is determined by the custom script (you can create whatever you want, ScriptCommunicator writes the log string directly into the custom log file).
If you select the HTML and the custom log in the settings dialog then you will have a custom and a HTML log. The custom script has to access to the HTML log.
isReceivedFromCAN is only given because the first bytes in the data array are the CAN meta data (e.g. CAN id). For the script it is not relevant with which interface (in addition to CAN) the data has been received or has been sent with. Therefor messageType should be:
messageType = 0 // received from interface (all but CAN)
messageType = 1 // sent with interface (all but CAN)
messageType = 2 // received from CAN
messageType = 3 // sent with CAN
messageType = 4 // isUserMessage
Best regards,
Stefan
Last edit: Stefan Zieker 2015-06-17
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
Thank you for your reply. I agree with you about this solution.
I'l try the log file generation asap.
Kindest Regards,
Pier Andrea.
Hi Pier,
I have uploaded a new pre release (ScriptCommunicator_02_17_test_revision_703_windows.zip).
Best regards,
Stefan
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
a minor observation.
When you start a script without UI from script window and you remove the running script, it is impossible to stop it. I suggest you two potential solutions:
1) Disable the remove script menuitem when the script is running or paused
2) Check if the script is running and, in affirmative case, Stop the script BEFORE removing it in the menuitem associated routine.
Kindest Regards,
Pier Andrea.
Last edit: Anonymous 2015-06-17
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
Today I played a little bit with your last version and I made a simple logic analyzer by mixing HTML and Javascript in the custom console (see the attached picture).
In the attached zip file you can find two scripts:
1) RNDByteGenerator.js (main script)
2) CustomLogAndConsole.js (custom console/log script)
3) A media directory with for gif files used by the previous script (please put this directory in the main ScriptCommunicator Folder)
If you activate the custom logging console you could have a SEMI GRAPHIC console with PICTURES INSIDE!
The result is very funny!
Kindest Regards,
Pier Andrea.
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Stefan,
another (16-bit) packet analyzer with MSB-LSB frame.
I'll play a little more with small payload packets (8-64 bits).
It is fantastic for developing serial protocols for controlling remote MCUs by using binary streams of data with an intuitive and immediate representation.
Kindest Regards,
Pier Andrea,
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
Hi Pier,
thx for the bug report. And wow it was not my intention that you can do such great things with the custom console. Can I put your custom console test in the example scripts folder of ScriptCommunicator?
PS: I will a add a function to read the folder of the custom console script. Then you can add the images relative to the custom console script.
Best regards,
Stefan