Delphi Xe5 Serial Communication Protocol

Anyone have any idea how to access serial port in android with delphi XE5? I'm using a Cubieboard with android 4.1

  1. Delphi Xe5 Serial Communication Protocols
EversonNovkaEversonNovka

1 Answer

WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011. WebSocket is designed to be implemented in web browsers and web servers, but it can be used by any client or server application.

I have successfully used Winsoft ComPort for Android to perform a serial USB communication.

Serial

Check out the code.

At the component Properties, you must include essential characteristics that creates your Serial port communication.

Such as : device name, databits, baudrate, parity and stop bits, for example.

MachadoMachado

Not the answer you're looking for? Browse other questions tagged androiddelphiserial-portdelphi-xe5 or ask your own question.

A few years back for one of my applications I moved my serial handling to a thread when a certain app had to respond very quickly to certain serial events.

It was in BDS2006, with an older version (some 3.x?) It was done by having code like this in the tthread.execute:

Protocol

Initialization was like

The rxchar method reads using comport1.readstr()

Delphi Xe5 Serial Communication Protocols

I recently had to dig this up, and noticed it didn't work in my Delphi XE, which has tcomport4. Looking in the source I saw remarks thatcomport4 has changed the way it deals with its internal threads ('overlapped' property), but the default seems to be 'true' has a comment 'classic', and I

Download motion sensor game for asha 3110

assumed that means compatible with older versions.

Note that the protocols are binary, and all string,char<-> ansistring,ansichar changes have been done like I did in the normal mainthread version

Now the real questions:

  1. does anybody have tcomport4 working in a thread ?
  2. Are there obvious mistakes in the above?
  3. or do I need to migrate to a different component?

I'm still debugging what is going on, but am in a hurry, which is while I post this in the hope of quickly getting pointers.

Update

I reinstalled an old turbo delphi copy, and verified it worked there with v3. I fixed a small bug though in the codepath that went a bit different from what I thought (not in the above code)

This allows me to describe the behaviour between dxe/comportv4 and bds2006/comportv3 better; the v4 code generates much more read events (hundreds/second). It seems that the read doesn't delete the read chars from the incoming queue or so.

Update 2

I did a quick test with the newest version, and did the necessary rearranging (kill string function use for an essentially binary protocol). I got stuck for a while because the application crashed on startup, but that is because I use gnugettext, and Comport packages a different (non unicode even?) version. But after that it works.

Unfortunately the changes are a bit to risky to propagate back to the production version (completely written protocol decoding), so I'll have to test with inbetween versions (between 4.0 and 4.11f). I'll do that in due time, any suggestion which version was the last readstr(ansistring) one?

Update 3

In the end I simply renamed the 4.11f units and use them in parallel to the old version, using the 4.11f for the threaded codebases and the old one to maintain existing code.

Long term I might simply take the waitforevent code and make an own version. The main problem with it is that it is afaik not possible to see if the wait terminated on timeout, stopevent or whatever. This means you need another timer if you want to e.g. send on regular intervals.

Protocols
Marco van de Voort
Marco van de VoortMarco van de Voort

1 Answer

You need to upgrade to the latest stable 4.11 release here.

Warren PWarren P

Not the answer you're looking for? Browse other questions tagged delphitcomport or ask your own question.