IOConnection for Windows®

IOConnection is a high level programming tool that simplifies the development and creation of software for Star printers.
IOConnection exposes an easy-to-use API that gives you fundamental communications access to the printer. IOConnection is supporting the ESC/POS Emulation.

Operating Environment

Supported models

TSP043

 

OS Requirement

Windows XP (32bit only)
Windows Vista (32bit/64bit)
Windows 7 (32bit/64bit)
Windows 8 (Desktop UI 32bit/64bit)

 

Development Environments

The files that are necessary for developing applications are stored in the "/redistributables" folder.
However, the files to use are different depending on the development language and environment. Refer to the following tables for the files to use and their storage locations.

32bit applications
Visual C++
/bin_Win32/IOPortConnection.dll
/lib_Win32/IOPortConnection.lib
/include/IOPortConnection.h

64bit applications
Visual C++
/bin_x64/IOPortConnection.dll
/lib_x64/IOPortConnection.lib
/include/IOPortConnection.h

 

Visual C++

The sample file has been written in Visual Studio 2005
To use IOConnection in your Visual C++ project: include the ”IOPortConnection.h” header file, link against the ”IOPortConnection.lib” library file. When you run it, put ”IOPortConnection.dll” into the same folder where the application locates. ”IOPortConnection.h” header file is written in-line with the function declarations.

Programming & Usage

Here we explain to you some functions which are commonly used within your use of IOConnection.
For the API commands that have not been mentioned here, please refer to Development Environment for the details of each cpntents.

  1. OpenPort

    Your usage of IOConnection always begins by opening a port.

    ■ Openning a port

    In Visual C++
    Using OpenPort function
    If OpenPort failed, it will simply reture ”0” to indicate failure.


    The following reasons may cause the OpenPort fails.

    1. The specified port does not exist.
    2. Port setting is incorrect.
    3. Any of the underlying OS system calls fail themselves (System Error).
    4. When another process has already opened the port that you're attempting to use.

    The reason 'd' is a failure that you can likely recover from.

    ■ Distinguishing OpenPort Errors (When the Port is used by other process).

    In Visual C++
    The GetLastError function you called returns the result of ' ERROR_ALREADY_EXISTS ' back to you.


  2. The usage of IOConnection API

    IOConnection API is described in different ways depends on each environments.

    ■ The usage of IOConnection API ( Beside OpenPort)

    In Visual C++
    all other APIs take the port handle as the first parameter.


  3. ClosePort

    When you have finished using the port, you must close it.

    ■ Port closing

    In Visual C++
    This is done by calling the ClosePort API.

    You are recommended to close ports as soon as you've finished using them in order to avoid the ports conflict in your system.

Specifying method in OpenPort

The OpenPort function accepts three parameters: the port name, the port settings, and the communication timeout.
We want to explain the port naming and settings parameters by the difference of the interface.

Serial
■ Port Name

Specifying the serial port name like ”COM1” or ”COM2”


■ Port Setting

These fields are assembled with 'baudRate', 'parity', 'dataBits', 'stopBits', 'flowControl'.
Each fields are a comma-separated string described with 'baudRate', 'parity', 'dataBits', 'stopBits', 'flowControl'.
( For example: "9600,n,8,1,h")

Baud rates: This field can be one of: "115200", "57600", "38400", "19200", "9600", "4800".

Parity: This field can be one of:"n", "e", "o".

  • n: For none.
  • e: For even.
  • o: For odd.

Data bit This field can be one of: "7" or "8".

Stop bit: The stopBits field must be specified as "1".

FlowControl: This field can be one of:"n", "h".

  • n: For no flow control
  • h: For hardware flow control (DSR)


USB Printer Class
■ Port Name

The port name parameter is formed by combining "usbprn:" with your printer's Windows printer queue name.
For the sample program attached, the printer queue name was created with 1 byte character however, two byte characters also can be used.
For example, when you want to specify a Windows queue name as "Star TSP043", you may create it as:

"usbprn:Star TSP043"


■ Port Setting

The port settings parameter must be the empty string.


Parallel
■ Port Name

Specifying the parallel port name like "LPT1" or "LPT2".


■ Port Setting

The port settings parameter must be the empty string.


Ethernet
■ Port Name

The port name parameter is formed by combining "TCP:" with your printer's IP address.
For example, if your printer is established on the 192.168.1.102 address then you would pass

"TCP:192.168.1.102" in as the port name parameter.


■ Port Setting

The port settings parameter must be the empty string.


Restrictions & Precautions

The following is the description of the restrictions for this release.
Please read it carefully before you use this printer.

  • This software may conflict with other software that shipped with or for your printer model. If you choose to deploy this alongside other software, please conduct thorough testing to confirm that no such conflicts exist.

When you are using a serial interface

  • When you are using "ResetDevice function", "True" will alway be returned back to you even the printer power is turned off or the printer is connected with your computor.

Version History

Ver. No.Date of RevisionChanges
Version 1.0.0.0April. 2012Single Release 1st Version.
Version 1.1.0.0February. 2013Added a Ethernet interface.

Legal Information

Copyright 2013 Star Micronics Co., Ltd.
Any company names and product names mentioned herein may be the trademarks or respective owers.
Windows® is a registered trademark of the Micosoft Corporation.