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  (3008 KB - .exe file)
  Download Manual  (118 KB - .htm file)


Using the ActiveComport Serial Port Toolkit with Visual CSharp .NET


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.

The ActiveComport Toolkit can be well integrated into .NET environments.
This document describes how the ActiveComport Toolkit can be integrated into into Visual C# .NET projects.


Step 1: Download and install the ActiveComport Toolkit

Download the 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 Visual C# .NET Project

Launch Microsoft Visual Studio (for instance 'Microsoft Visual Studio 2005') from the Start menu. Choose 'New' from the 'File' menu and click on 'Project'. In the 'New Project' dialog, select a Visual Studio template (for instance: 'Console Application'). Select a name for the application (for instance: 'DemoApp') and a name for the solution (for instance: 'DemoSolution'). Also, select the directory where you want to store the project (for instance: 'C:\MyProjects):

    
    (Click on the picture to enlarge)



Step 3: Refer to the ActiveComport Library and create the objects

Now that a new project has been created, you must add a reference to the ActiveComport Toolkit in the project to be able to use the ActiveComport object. To do so, choose 'Add Reference...' from the 'Project' menu. In the 'Add Reference' dialog that pops up, select the 'COM' tab and select the 'ActiveComport 2.2 Type Library' as shown in the following picture:

    
    (Click on the picture to enlarge)

Click 'OK' to close the 'Add Reference' dialog.

On top of your code, type the following line to use the ActiveComport namespace:
   using ACOMPORTLib;
In your Main function, declare and create the following object:
   public ComPort m_objComport;
	
   m_objComport = new ComPortClass();


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

You can now send and/or receive data to and/or from a serial interface.

The following code shows how to query a modem:
using System;
using ACOMPORTLib;

namespace ActiveComport_Demo
{
	/// 
	/// Summary description for Class1.
	/// 
	class Class1
	{
		/// 
		/// The main entry point for the application.
		/// 
		/// 
		static public ComPort m_objComport;

		static public void WriteStr(System.String str)
		{
			m_objComport.WriteString(str);
			Console.WriteLine("-> " + str + "\n" );
		}

		static public void ReadStr()
		{
			System.String str;
			str = "notempty";
			m_objComport.Sleep(200);
			while( str != "" )
			{
				str = m_objComport.ReadString();
				if( str != "")
					Console.WriteLine( "<- " + str + "\n");
			}
		}

		[STAThread]
		static void Main(string[] args)
		{
			//
			// TODO: Add code to start application here
			//
			m_objComport = new ComPortClass();
			m_objComport.BaudRate = 9600;
			m_objComport.Device = "COM1";
			m_objComport.LogFile = "C:\\ComportLog.txt";

			m_objComport.Open();

			if( m_objComport.LastError == 0 )
			{
				Console.WriteLine( "Open: SUCCESS\n" );
			}
			else
			{
				Console.WriteLine( "Open failed, Error : " + m_objComport.GetErrorDescription( m_objComport.LastError ) + "\n" );
			}


			if( m_objComport.LastError == 0 ) 
			{

				WriteStr( "atz" );
				ReadStr();

				WriteStr( "at&f" );
				ReadStr();

				Console.WriteLine( "Close\n" );
				m_objComport.Close();
			}

			m_objComport.Sleep( 2000 ); 
		}
	}
}
There are many working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/acomport.


NOTE: Demo Projects are created with Microsoft Visual Studio 2002

The ActiveComport project ships with a set of Microsoft Visual Studio .NET samples, including samples for Microsoft Visual C# .NET. The projects are created with Microsoft Visual Studio 2002.
Users with a later version of Microsoft Visual Studio can open such a project. The Visual Studio Conversion Wizard will guide you through the process of converting the project to the version used.






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.