Re: PC Com Port data capture....



"sf" <junk@junk> wrote in news:11lsa6nqdui3h90@xxxxxxxxxxxxxxxxxx:

> Looking for someone with experience in PICK D3 to take an
> existing program that runs on a PICK port, "listening" for data
> input and writes the received input to a record in the D3
> database that is then used in other applications. Moving to D3
> windows, we need this application to "listen" on the comm or
> serial port of a PC and take the same information and write it
> to the database record.
>

I don't know if this will help you or not, but here is a program I
did to capture call detail information from a serial port on our
PBX.

* Capture CDR Information From Lucent Definity G3V6 PBX
*
* PROGRAM CALL.RECORDER
*
* Monitors serial port to capture call detail records from PBX,
* reformat and write them to a D3 file for subsequent analysis.
* Serial port may be specified on the command line. If the port
* is not specified, the default port #6 is used. The program is
* intended to be run in a phantom process. It may be brought to
* an orderly halt by writing an empty item with an ID of "STOP"
* to the CALL.DETAIL file. It will be acted on after a record
* is written or after 30 seconds with no call recorded.
*
* ** Program Constants
AM = CHAR(254); VM = CHAR(253); CR = CHAR(13)
MPORT = 57
ERRMSG = ""
FOREVER = 0
* Get command line arguments and store in dynamic array
TCLREAD ARG
SAVEARG = ARG
CONVERT ',' TO ' ' IN ARG
ARG = TRIM(ARG)
CONVERT ' ' TO AM IN ARG
PROGNAME = ARG<1>
DEL ARG<1>
NUMARG = DCOUNT(ARG,AM)
IF NUMARG # 0 THEN MPORT = ARG<1>
* ** Open files
ERMSG = ""
OPEN "CALL.DETAIL" TO F.CDR ELSE ERMSG := " CALL.DETAIL"
IF ERMSG # "" THEN
PRINT "Unable to open:":ERMSG
STOP
END
* ** turn off software handshaking on capture port
VERB = "xonoff (":MPORT:"F"
EXECUTE VERB RETURNING MSG CAPTURING DSP
SLEEP 1
* ** turn off carrier detect on capture port
VERB = "dcd-off ":MPORT
EXECUTE VERB RETURNING MSG CAPTURING DSP
SLEEP 1
* ** unlink the capture port from its normal Pick process
VERB = "unlink-pibdev ":MPORT:",":MPORT
EXECUTE VERB RETURNING MSG CAPTURING DSP
SLEEP 1
* ** attach capture port to this process
VERB = "dev-att ":MPORT
EXECUTE VERB RETURNING MSG CAPTURING DSP
SLEEP 1
* ** Main Processing Logic
LOOP UNTIL FOREVER
TEMP = ""
* ** read characters from the port until a carriage return
* ** is seen or until we have been idle for 60 seconds
GET TEMP FROM MPORT UNTIL CR WAITING 60 THEN
* ** format and write the output record
CDR = ""
C.DATE = TEMP[1,2]:"/":TEMP[3,2]:"/":TEMP[5,2]
CDR<1> = ICONV(C.DATE,'d2/'); * date
CDR<2> = ICONV(TEMP[8,4],'mt'); * time
CDR<3> = TRIM(TEMP[13,5],"0","L"); * call duration
CDR<4> = TRIM(TEMP[19,15]); * calling #
CDR<5> = TRIM(TEMP[35,18]); * dialled #
CDR<6> = TRIM(TEMP[54,4]); * trunk
CDR<7> = TRIM(TEMP[59,5]); * vdn
CDR.ID = SYSTEM(21)
WRITE CDR ON F.CDR,CDR.ID
END
* ** check for the STOP flag and shutdown if found
READ JUNK FROM F.CDR,"STOP" THEN
FOREVER = 1
DELETE F.CDR,"STOP"
END
REPEAT
* ** Detach the capture port from this process
VERB = "dev-det ":MPORT
EXECUTE VERB RETURNING MSG CAPTURING DSP
SLEEP 1
* ** relink capture port to its own process
VERB = "link-pibdev ":MPORT:",":MPORT
EXECUTE VERB RETURNING MSG CAPTURING DSP
STOP

Feel free to use any parts that are helpful.

--
===========================================================
Norman Morgan <> http://www.norm-morgan.com
===========================================================
Sometimes I wake up grumpy. Other times I let her sleep.
===========================================================

.



Relevant Pages

  • Re: donna update
    ... So glad she is home where she can rest and sleep, ... hope she completely recovers very quickly. ... they also re-evaluated my port. ... being subjected to port replacements if they weren't ...
    (alt.support.arthritis)
  • Re: No inbound emails from outside domain - SOLVED
    ... Two keys - I found that I had an Exchange Server Publishing Rule in ... Somehow, someway, port 25 and port 80 were disabled. ... joe and head home for food and sleep. ... Mike, get yourself a good hardware firewall appliance or use ISA on a separate, dedicated server. ...
    (microsoft.public.windows.server.sbs)
  • Re: Freebsd IP Forwarding performance (question, and some info) [7-stable, current, em, smp]
    ... INADDR_ANY and a specific port. ... sendtoon a specific address and port on a socket that has been bound to ... bogus exit code) and adds a sleep after send failure. ... unless HZ is too small or the queue is too large. ...
    (freebsd-net)
  • [FS] Apple PowerMac G4 1ghz MDD 410GB 1.75GB
    ... Will be very shortly selling my Apple PowerMac G4 MDD G4 1ghz. ... Belkin 2 Port USB2 Card ... Downside you can't sleep the machine with anything plugged into the ... usb2, it'll sleep fine with nothing plugged in. ...
    (uk.adverts.computer.mac)
  • Re: COM port goes to sleep and doesnt wake up
    ... UART on wake. ... Often simply resetting the DCB settings on wake for the port ... When the device goes to sleep (either by inactivity timeout or by ... > pressing the on/off button) and is then woken up by pressing the on/off ...
    (microsoft.public.dotnet.framework.compactframework)