<div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi T Lee, your code suggestion was implemented various mails ago, a flag was implemented in the code, and it's works of course as i said<br><br></div>but now i want to experiment with the event and watchers,and I REPEAT, part of the problem was solved, xzMarce provided the "very advanced info" (seems that i did not reply to the list, sorry for that)<br><br></div><div>my apologies, i did not reply the solution and assumed that all read it! posted now here:<br><br><div><div><div><div><div><div>So: thanks to zxMarce i got the "why", the time to respond from the printer are not fixed and due for all commands we need/xpected a response from the printer<br><br></div>the problem it's all the fiscal kit have a maximunt time to "waith to data" (i think it's how write it in english)<br></div>so in my classes must be defined at each inherits implementatino and must override the waith of the <br></div>read event to xpect data on the buffer<br><br></div>As noted, this it's a problem taking in consideration the object model of the gambas (in java was easy with interfaces)<br></div>so the proper way it's to implement also not only the write operation, the Read operation too in each class inherints <br><br></div>Now, my question: can i override the "Read" event in each class without impact in performance and object class model?</div><br></div>So T Lee and others, unfortunatelly i'm programing in blind mode, i explain:<br><br></div>a fiscal kit printer it's a ad-hoc system, so them you must be with it to property understand.. <br></div>so then, due that i try to explain the behaviour of the serial and signals to build a better, A BETTER implementqation for linux<br><br></div>i'm a very active contributor, but in linux there's too much "mysql+php" and we need more advanced solutions not yet provided!<br><br></div>we need a more expanded view and vision ok, right?<br><br></div>so thanks to xzMarce for the info, and if you want to know wicht info, was posted by me two mails ago from here!<br><br></div>DP: for all of here in gambas list:  lazarus: puff it's like return to the stone eera, but with airplane, so i'll will the "dragon that fly" ( "how hard its to be a good"), the lazarus forums does not have any advanced project, more that a accounting system named "Leonux" and "BRP-sopftware" (that last are not free), so apart if you have a code made in fpc version X.1 the next version will break your compilation and must recompile it! in conclusion seems more a headhache!<br><div><div><div><div><div><div><div><div><div><div><div><br>2018-08-13 20:10 GMT-04:00 T Lee Davidson <span dir="ltr"><<a href="mailto:t.lee.davidson@gmail.com" target="_blank">t.lee.davidson@gmail.com</a>></span>:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Here, try this simple program, PICCORO:<br>
<br>
<br>
[code]<br>
' Gambas module file<br>
<br>
Public SComm As SerialPort<br>
Public databuffer As String = ""<br>
Public DataHasBeenRead As Boolean = False<br>
<br>
Public Sub Main()<br>
<br>
  SComm = New SerialPort As "SComm"<br>
  SComm.PortName = "/dev/ttyS1"<br>
  SComm.Speed = 9600<br>
  SComm.Parity = 0<br>
  SComm.DataBits = 8<br>
  SComm.StopBits = 1<br>
  SComm.FlowControl = 2<br>
  Try SComm.Open()<br>
  If Error Then<br>
    Print "Error: " & Error.Text<br>
    Quit<br>
  Endif<br>
<br>
  Print #SComm, Chr(2) & "_" & Chr(3)<br>
<br>
  Do<br>
    Wait 0.1<br>
  Loop Until DataHasBeenRead<br>
  Print databuffer<br>
<br>
End<br>
<br>
Public Sub SComm_Read()<br>
<br>
  Read #SComm, databuffer, Lof(SComm)<br>
  DataHasBeenRead = True<br>
<br>
End<br>
[/code]<br>
<br>
Does it work? If so, then problem solved.<br>
<br>
I'm done. Good luck.<br>
<br>
<br>
___<br>
Lee<br>
<br>
P.S. Tony was certainly not "srcreaming garbage" [sic], just pointing out facts of your behavior.<br>
<br>
The world may not be the "little hole of mysql", but Gambas works with the major non-proprietary and open-source databases MySQL<br>
and PostgreSQL. If you need it to work with proprietary databases, you are invited to develop and contribute the code to do so.<br>
<br>
Or, perhaps Lazarus would meet your expectations. However, I doubt the dedicated and helpful people at the Lazarus forum would<br>
tolerate your unappreciative and obnoxious attitude for very long.<br>
<span class="gmail-"><br>
On 08/13/2018 03:28 PM, PICCORO McKAY Lenz wrote:<br>
> Tony all the information was given:<br>
> <br>
> 1 it's a fiscal printer, there's no sense in give you that are a epson dot matrix due you need the kit's in place to test<br>
> <br>
> 2 i tested and make many mothns ago a POS systems so test with command line the kit was done! please!<br>
> <br>
> 3) of course commands are ver very correct! i receive data but not as planned by the event as T Lee said!<br>
> <br>
> about the odbc, i provide the odbc driver info, TDS do you noted and read the issues?<br>
> and connection string info, i not the only that suffers the odbc problem, the world are not the "little hole of mysql" right!<br>
> <br>
> please seems are you the guy that are "srcreaming garbage"<br>
> <br>
> Lenz McKAY Gerardo (PICCORO)<br>
> <a href="http://qgqlochekone.blogspot.com" rel="noreferrer" target="_blank">http://qgqlochekone.blogspot.<wbr>com</a><br>
> <br>
</span>> 2018-08-13 15:22 GMT-04:00 Tony Morehen <<a href="mailto:tmorehen@ajm-software.com">tmorehen@ajm-software.com</a> <mailto:<a href="mailto:tmorehen@ajm-software.com">tmorehen@ajm-software.<wbr>com</a>>>:<br>
<span class="gmail-">> <br>
>     I give up trying to help you.  I asked 3 questions.  You ignored two and said there is no point in answering the other.  How<br>
>     can anyone help you when you refuse to provide any information?<br>
> <br>
>     It's like the ODBC problems you've been yelling and screaming about.  You don't even give basic information like what odbc<br>
>     driver you are using, including version.<br>
> <br>
> <br>
>     On 2018-08-13 02:48 PM, PICCORO McKAY Lenz wrote:<br>
>>     well it's a fiscal printer, so there's no sense in tell you taht it's a epson dot matrix<br>
>><br>
>>     i put more delay and now event raised! i mean, 0.5 ms in main module event in the property event!<br>
>>     and 0.1 ms in the read function..<br>
>><br>
>>     but if i put tyhe delay in any other place that are not in the main there's no read event raised!<br>
>><br>
>>     ans somethings does not happened (very rare times)<br>
>><br>
>>     Lenz McKAY Gerardo (PICCORO)<br>
</span>>>     <a href="http://qgqlochekone.blogspot.com" rel="noreferrer" target="_blank">http://qgqlochekone.blogspot.<wbr>com</a> <<a href="http://qgqlochekone.blogspot.com" rel="noreferrer" target="_blank">http://qgqlochekone.blogspot.<wbr>com</a>><br>
>><br>
>>     2018-08-13 13:52 GMT-04:00 Tony Morehen <<a href="mailto:tmorehen@ajm-software.com">tmorehen@ajm-software.com</a> <mailto:<a href="mailto:tmorehen@ajm-software.com">tmorehen@ajm-software.<wbr>com</a>>>:<br>
<span class="gmail-">>><br>
>>         Perhaps you could upload the latest version of your code?<br>
>><br>
>>         What printer are you testing this against?<br>
>><br>
>>         Have you tried connecting via a terminal program to your printer?  This will double check your connection settings and<br>
>>         let you see the actual response to the commands you are sending.  Another test is to use a serial port monitor or<br>
>>         sniffer to view your program's serial port activity.<br>
>><br>
>><br>
>>         On 2018-08-13 11:35 AM, PICCORO McKAY Lenz wrote:<br>
>>><br>
</span>>>>         2018-08-13 11:16 GMT-04:00 T Lee Davidson <<a href="mailto:t.lee.davidson@gmail.com">t.lee.davidson@gmail.com</a> <mailto:<a href="mailto:t.lee.davidson@gmail.com">t.lee.davidson@gmail.<wbr>com</a>>>:<br>
<span class="gmail-">>>><br>
>>>             You create the printer object, open its port, write to the printer requesting a status report, and then<br>
>>>             *immediately* you<br>
>>><br>
>>>             manually read the response. After that, for some odd reason, you read the "dataread" property twice, and then the<br>
>>>             program ends.<br>
>>><br>
>>>          ok but remove later those calls and does not triggered the read event!, inclusivelly if i put a loop in the main<br>
>>>         module that waiuth "something"<br>
>>><br>
>>>             If you don't call the "rp" function, the program drops through the two "dataread" property reads and ends. When<br>
>>>             did you expect<br>
>>>             the _Read event would have a chance to be raised?<br>
>>><br>
>>>         was just a experiment, i removed in furter test as i said<br>
>>>          <br>
>>><br>
>>>             Not sure exactly what you mean with that statement, but it may be the very idea I am trying to impress upon you.<br>
>>>             Your manual<br>
>>>             read subroutine gives the printer 500 milliseconds to respond. Why don't you give the Main module at least 500<br>
>>>             milliseconds to<br>
>>>             allow the printer to respond and raise the _Read event?<br>
>>><br>
>>>         i put a loop into as i said in the previous paragraph, but still does not happened!<br>
>>><br>
>>>          <br>
>>><br>
>>>             Or, why not use a semaphore that is visible to the Main module and loop until the _Read event has had an<br>
>>>             opportunity to fill the<br>
>>>             "databuffer"?<br>
>>><br>
>>>         oh, of course was working in this way, was my first code, ok great but i wish to deal with the read event ..<br>
>>>          <br>
>>><br>
>>>             You may not have specified that the SerialPort stream should be watched, but it would be logical that Gambas<br>
>>>             automatically<br>
>>>             WATCHes a SerialPort in order to be be able to raise the _Read event. (<a href="http://gambaswiki.org/wiki/lang/open" rel="noreferrer" target="_blank">http://gambaswiki.org/wiki/<wbr>lang/open</a><br>
</span>>>>             <<a href="http://gambaswiki.org/wiki/lang/open" rel="noreferrer" target="_blank">http://gambaswiki.org/wiki/<wbr>lang/open</a>>)<br>
<div class="gmail-HOEnZb"><div class="gmail-h5">>>><br>
>>>          yeah yeah, when i said "hang at end" i mean that with gambas 3.8 when last sentence executed the programs ends<br>
>>>         normally, with 3.11 the programs "seems end" but the "play" button of the ide still are deactivate and the ide<br>
>>>         indicates program does not end...<br>
>>><br>
>>><br>
>>><br>
>>>         ----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
>><br>
>><br>
>><br>
>>         ----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
>><br>
>><br>
> <br>
> <br>
> <br>
> <br>
> <br>
> ----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
> <br>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</div></div></blockquote></div><br></div></div></div></div></div></div></div></div></div></div></div></div></div>