USB Ports

Posted by Jens Dahlin on 01-Mar-2013 03:42

Anybody played around with System.IO.Ports?

I know that a specfic thing is connected to an unspecified port. But it don't know how to check for it.

I've gotten this far:


USING System.IO.Ports.*.


DEFINE VARIABLE c AS CHARACTER EXTENT.
DEFINE VARIABLE p AS CLASS System.IO.Ports.SerialPort.


c = SerialPort:GetPortNames().
DEFINE VARIABLE i AS INTEGER     NO-UNDO.

DO i = 1 TO EXTENT(c):

DISP i ":" c[i].

p = NEW SerialPort(c[i]).

/*p:WhatToDo(?). */

DELETE OBJECT p.

PAUSE.


END.

Ideas?

All Replies

Posted by Stefan Marquardt on 01-Mar-2013 03:47

Jens,

Serial.IO sends events (receiving data) in another thread.
OpenEdge can't handle this.

Perhaps it's only wasting time trying to use this with OpenEdge.

Stefan

Posted by Jens Dahlin on 01-Mar-2013 04:04

I have an external API for handling the actual communication. The problem is that connecting to the device is only supported on a per port basis (COM4, COM5 etc) and not via an device string.

In this case I really only need to check what's connected to my ports. (I can see it in the Device manager as attached).

Posted by Stefan Marquardt on 01-Mar-2013 05:00

Jens@airtours.se schrieb:

In this case I really only need to check what's connected to my ports. (I can see it in the Device manager as attached).


Then this is the wrong class if you need more than detecting DTR.
Which USB Device created the virtual COM Port isn't visible in this class, for this i use the Registry class.

Posted by Jens Dahlin on 01-Mar-2013 05:13

You don't happen to have an example?

Thanks

Posted by Stefan Marquardt on 01-Mar-2013 05:18

Because i use the ports in C# it's in this language where i search virtual com ports for Honeywell scanners:

RegistryKey reg = Registry.LocalMachine;

RegistryKey reg1 = reg.OpenSubKey("HARDWARE\\DEVICEMAP\\SERIALCOMM");

foreach (String valuename in reg1.GetValueNames())

{

if (valuename.Contains("\\Device\\honeywell_cdc_AcmSerial"))

iScannerRegistry++;

}

You need to convert this to ABL.NET

Posted by PeterWokke on 10-Nov-2015 02:39

Has someone convert this in ABL?

Posted by Lieven De Foor on 27-Nov-2015 02:07

@Peter: that shouldn't be too hard to do on your own? You could equally use GET-KEY-VALUE() to read from the registry in the old fashioned way...

This thread is closed