Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Marco P. on June 30, 2011, 10:58:05 am



Title: COM Port
Post by: Marco P. on June 30, 2011, 10:58:05 am
Hello,
which is the best way to send command or message to a COM Port on the local PC?

Thanks a lot.
Marco Perissinotto


Title: Re: COM Port
Post by: . on July 01, 2011, 11:17:21 am
Marco,

by "local PC", do you mean the PC where the front end runs or where the runtime runs ?

Anyway, in both case there is nothing out of the box available. You will need to use 3rd party components (or write your own).

On the runtime side, you may either write your own C extension or have a look at the Java API if there is nothing that could fit your needs.

On the front-end side:
- if you're running GDC, you can write your C++ DLL Extension - you can for instance use http://gitorious.org/inbiza-labs/qserialport to do it in Qt to speak the same language as GDC. This would be the cleanest solution. You could use a separate executable, redirect output to a file and get the file via file transfer, but this would not be my preferred way.

- if you're running GWC, I'm afraid the browser limitations are too high for that (except if you're running IE and use GFXAC, so you can use the same DLL as the GDC one, but the scope is very limited).

Hope this helps,
Regards,
Pierre-Nicolas


Title: Re: COM Port
Post by: Reuben B. on July 10, 2011, 11:41:27 am
Hi Marco,

The relevant piece of documentation for the C++ DLL extension and integrating to GDC that Pierre-Nicolas suggested is https://4js.com/online_documentation/fjs-gdc-manual-html/User/FEExtensions.html

However I think there maybe a simpler solution.  If you can get to the point where you can execute a command on the local PC where the GDC is running from the command line e.g. echo message > com1 (or something other script or executable) then you can call that from the GDC using the execute or shellexec frontCall. https://4js.com/online_documentation/fjs-fgl-manual-html/User/FrontEndFunctions.html#STANDARD

Reuben