Multiple Instances Of The Driver In The Same App; Port Lockout - Honeywell UMC800 Reference Manual

Rs232 communications
Hide thumbs Also See for UMC800:
Table of Contents

Advertisement

PC Communication Driver
{
// Application error.
if(lRet & ERR_CODE)
// Instrument rejected message and returned error code.
ErrorCode = (int)(lRet & ERR_CODE);
else
// Bad address or sequence number in return packet.
}
}

3.2.5 Multiple Instances of the Driver in the Same App

This driver is completely re-entrant. Suppose there are two separate communication interfaces on COM1
and COM2 respectively for two UMC800 controllers. The app can handle this by creating two instances of
the driver class and attaching them to separate ports:
#include "commapi.h"
CElnApi Drv1("COM1",
CElnApi Drv2("COM2",

3.2.6 Port Lockout

The communication driver relies on the operating system to perform port lockouts in the event that
two concurrently running applications attempt to access the same port simultaneously. For example,
a configuration utility and a live data viewing utility may each instantiate a CElnApi object, and both
CElnApi's may be attached to the same port. However, they may not both open the port simultaneously,
because the operating system will not issue a valid port handle to app (a)'s driver before app (b)'s driver has
closed the port and returned its handle to the system. This means that if app (a) is still talking when app (b)
tries to start talking, app (b) will get a physical error from CElnApi::OpenPort(). App (b) can then go into a
polling loop waiting for the port to become available, or it can issue an error message to the user.
Always check the return value of this CElnApi::OpenPort(). If someone else has already opened the port,
you cannot get access to it until they close the port. When you are done communicating, close the port. All
other threads, including other apps, will be locked out as long as you have the port open.
20
// COM1.
2000,
// 2000 mS timeout.
5,
// 5 retries.
1000);
// 1000 mS Delay between retries.
// COM2.
2000,
// 2000 mS timeout.
5,
// 5 retries.
1000);
// 1000 mS Delay between retries.
RS232 Communications Reference Manual
8/99

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rs232

Table of Contents