ActiveComport

 Product Overview

 How to use

 Online Samples

 Download (.exe)

 Brochure (.pdf)

 Manual (.htm)

 Release Notes

 Case Studies:
 


Support

 Knowledge Base

 Forum

 Contact Support


Purchase

 Licensing

 Pricing

 Order now


Related documents

 Case study: Using
 ActiveComport to send
 SMS's (by Sorceress
 Entertainment)


 AT commands

 Serial Communication
 Tutorials



  Download ActiveComport Serial Port Toolkit 3.1  (3015 KB - .exe file)
  Download Manual  (117 KB - .htm file)


Using ActiveComport Serial Port Toolkit with ColdFusion


ActiveComport is a software development kit (SDK) that enables the user to communicate to a device over a serial interface.
Such a device can be: a weight indicator, a modem, a scanner, or any other device that is equiped with a serial port. It can even be another PC, connected via a NULL modem cable.

ActiveComport features the following:

Direct COM port support (like 'COM1'), TAPI (Windows Telephony Device) support (like 'Standard 56000 bps Modem'), support for RS-232/RS422/RS485, up to 256 simultaneous ports, support for all types of Hayes compatible modems, support for serial cable, USB cable or Bluetooth connections, support for GSM/GPRS modems, support for Virtual COM ports (i.e. COM ports redirected through the network), hardware flow control (RTS/CTS, DTR/DSR), software flowcontrol (XON/XOFF), configurable baudrate/parity/stopbits, full buffered data transfer, text/binary data transfer.

ActiveComport can be well integrated into Visual Basic environments.
This document describes how the ActiveComport Toolkit can be integrated into ColdFusion.


Step 1: Download and install the ActiveComport Toolkit

Download the ActiveComport Toolkit from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.



Step 2: Create a new ColdFusion document

Create a new blank webdocument with the ".cfm" extention. First of all we are going to build the form whitch commands and properties of the device can be filled in. Then we are going to make a source code that connects to the device.


Step 3: Create the form

First of all we are going to make the following form:

    
    (Click on the picture to enlarge)

Type the following code to create and style the form:



<!---Begin of the script--->
<!---The stylesheet is typed down in the header--->
<!---The form is typed down in the body--->

<cfoutput>
<html>
    <head>
        <title>Active Comport Cold Fusion Sample</title>

        <style>
            <!--
                body{
                    font-family:verdana;
                    font-weight:normal;
                    font-size:xx-small;
                    color:navy;
                    text-align:center;
                }
											
                table{
                    font-family:verdana;
                    font-weight:normal;
                    font-size:xx-small;
                    color:navy;
                    border: 1px solid navy;
                }
											
                td{
                    font-family:verdana;
                    font-weight:normal;
                    font-size:xx-small;
                    color:navy;
                    border:1pxsolidnavy;
                }
	    										
                .form{
                    font-family:verdana;
                    font-weight:normal;
                    font-size:xx-small;
                    color:navy;
                    border:1pxsolidnavy;
                    background-color:white;														
                }	
																			
            //-->
        </style>
    </head>

    <body>
    
        <h2>Active Comport Coldfusion Sample</h2>
        <h3>Querya com device:</h3>			
        <formn ame=getcommand method=get>
        ___________________________________________________</br>
        <br>
        <b>Command:</b><br>
        <input type=text style="width:300px;"class=form name="Commando"><br>
									
        <b>Comport:</b><br>
        <select name=cbComport class=form style="width:300px;">
</cfoutput>

<!---If the form is submitted,the entered values will be filled in again automaticly--->
<cfif IsDefined("URL.cbComport")>
    <cfset strComport = URL.cbComport>
    <cfoutput>
            <option value="#strComport#">#strComport#</option>
    </cfoutput>
</cfif>

<cfoutput>
            <option value="COM1">Com1</option>
            <option value="COM2">Com2</option>
            <option value="COM3">Com3</option>
            <option value="COM4">Com4</option>
            <option value="COM5">Com5</option>
            <option value="COM6">Com6</option>
            <option value="COM7">Com7</option>
            <option value="COM8">Com8</option>
            <option value="COM9">Com9</option>																																																																																																								
        </select><br>
									
        <b>Baudrate</b><br>
        <select name=cbBaudrate class=form style="width: 300px;">

</cfoutput>

<!---If the form is submitted, the entered values will be filled in again automaticly--->
<cfif IsDefined("URL.cbBaudrate")>
    <cfsetstr Baudrate=URL.cbBaudrate>
    <cfoutput>
        <option value="#strBaudrate#">#strBaudrate#</option>
    </cfoutput>
</cfif>

<cfoutput>
                <option value="0">Default</option>
                <option value="110">110</option>
                <option value="300">300</option>
                <option value="600">600</option>
                <option value="1200">1200</option>
                <option value="2400">2400</option>
                <option value="4800">4800</option>
                <option value="9600">9600</option>
                <option value="14400">14400</option>
                <option value="19200">19200</option>
                <option value="38400">38400</option>
                <option value="57600">57600</option>
                <option value="64000">64000</option>
                <option value="115200">115200</option>
                <option value="128000">128000</option>
                <option value="256000">256000</option>													
            </select><br>
									
            <b>Logfile:</b><br>

</cfoutput>

<!---If the form is submitted,the entered values will be filled in again automaticly--->
<cfif IsDefined("URL.txtLogfile")>
    <cfset txtLogfile=URL.txtLogfile>
    <cfoutput>
        <input type=text style="width:300px;"class=form name="txtLogfile" value=#txtLogfile#>
    </cfoutput>
<cfelse>
    <cfoutput>
        <input type=text style="width:300px;" class=form name="txtLogfile" value="C:\logfile.txt">
    </cfoutput>
</cfif>

<cfoutput>
    <br>
    <input type=submit value="Submitcommand!"class=form><br>
    ___________________________________________________</br>									
    </form>

</cfoutput>



Step 4: Send an AT command to a connected Hayes compatible modem

Once you have entered the commands you want to send to the modem, we can send the command. To do this we need to create an object in the sourcecode. The object comport. In coldfusion an object is created with the tag <cfobject>. So to create the object we need to add the following code:

<cfobject class="ActiveXperts.Comport" type="com" name="objComport" Action="Create">
The next step is to open the device and send the command. When the command is sent we need to read the device's reply. And last, but not least, we need to close the device. You can see in the source below that the <cfobject> tag is used:

The following code shows how to query a modem:

<!--- Before executing the given command, we are going to make sure if there IS any command --->
<cfif isDefined("URL.Commando")>

    <!--- Below the command is executed --->
    <!--- The baudrate is being set --->
    <!--- The right comport is going to be filled in --->
    <!--- The logfile is being set --->
    <!--- The command is being executed --->
    <!--- The result is going to be written to an array --->

    <cfobject class="ActiveXperts.Comport" type="com" name="objComport" Action="Create">
    <cfscript>
        objComport.baudrate = URL.cbBaudrate;
        objComport.Device = URL.cbComport;
        objComport.LogFile = URL.txtLogfile;
			 
        objComport.Open();
        objComport.WriteString(URL.Commando);
        objComport.Sleep(1000);

        arrReply = ArrayNew(1);
        i = 0;
        Do
        {
            i = i + 1;
            arrReply[i] = objComport.ReadString();
        }
        While (objComport.Lasterror eq 0);
			 
        objComport.Close();
    </cfscript>

    <!--- The results are going to be echo'd --->
    <!--- The result array is being sequentialy traversed --->
    <cfoutput>
        <b>Reply:</b><br>
    </cfoutput>

    <cfloop from="1" to="#ArrayLen(arrReply)#" index="i"> 
       <cfoutput>#arrReply[i]#<br></cfoutput> 
    </cfloop>

    <!--- Possible errors are being displayed --->
    <cfset intError = objComport.LastError>
    <cfset strError = objComport.GetErrorDescription(objComport.LastError)>
    <cfoutput>
    ___________________________________________________</br>
    <br>
    <b>Results:</b><br>
    Error: #intError# : #strError#!
    </cfoutput> 

<!--- The if statement is being closed --->
</cfif>

<!--- the body and the html tag are being closed --->
<cfoutput>
</body>
</html>
</cfoutput>
You can download the ColdFusion sample from our FTP site. There are many other working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/acomport.





The ActiveComport tool is COM port development component (SDK). This control can be used by any Windows development platform, including Visual Basic .NET, Visual CSharp .NET, ASP .NET (VB,CS), ASP, Visual Basic, Visual Studio/Visual C++, Borland Delphi and C++ Builder, PHP, VBA (Visual Basic for Applications), ColdFusion, HTML, VBScript and any other ActiveX/COM compliant platform. The ActiveComport Toolkit is an ActiveXperts Software B.V. Product.

Copyright ©1999-2007 ActiveXperts Software. All rights reserved.