cdev-1.7.2n
This commit is contained in:
Executable
+29
@@ -0,0 +1,29 @@
|
||||
ifneq ("$(VERBOSE)", "YES")
|
||||
MAKE := $(MAKE) -s VERBOSE=NO
|
||||
endif
|
||||
|
||||
all:
|
||||
@echo "=> Building CDEV Gateway Client/Server"
|
||||
@$(MAKE) -C server $@
|
||||
@$(MAKE) -C service $@
|
||||
@echo "<= Done...\n"
|
||||
|
||||
apps:
|
||||
@echo "=> Building Test Applications"
|
||||
@$(MAKE) -C test
|
||||
@echo "<= Done...\n"
|
||||
|
||||
clean:
|
||||
@echo "=> Cleaning CDEV Gateway Directories"
|
||||
@$(MAKE) -C server $@
|
||||
@$(MAKE) -C service $@
|
||||
@$(MAKE) -C test $@
|
||||
@echo "<= Done...\n"
|
||||
|
||||
purge:
|
||||
@echo "=> Purging CDEV Gateway Directories"
|
||||
@$(MAKE) -C server $@
|
||||
@$(MAKE) -C service $@
|
||||
@$(MAKE) -C test $@
|
||||
@rm -rf bin
|
||||
@echo "<= Done...\n"
|
||||
@@ -0,0 +1,37 @@
|
||||
!IF "$(VERBOSE)" != "YES"
|
||||
MAKE = $(MAKE) -s VERBOSE=NO
|
||||
!ENDIF
|
||||
|
||||
BASEDIR = $(MAKEDIR)
|
||||
|
||||
SERVER_DIR = $(BASEDIR)\server
|
||||
SERVICE_DIR = $(BASEDIR)\service
|
||||
APP_DIR = $(BASEDIR)\test
|
||||
|
||||
CLEAN_DIRS = $(SERVER_DIR)\
|
||||
$(SERVICE_DIR)\
|
||||
$(APP_DIR)
|
||||
|
||||
|
||||
all:
|
||||
@echo =^> Building CDEV Gateway Client/Server
|
||||
@for %d in ($(SERVER_DIR) $(SERVICE_DIR)) do @cd %d & $(MAKE) /NOLOGO /f NMakefile.mak
|
||||
@echo ^<= Done...
|
||||
|
||||
|
||||
apps:
|
||||
@echo =^> Building Test Applications
|
||||
@for %d in ($(APP_DIR)) do @cd %d & $(MAKE) /NOLOGO /f NMakefile.mak
|
||||
@echo ^<= Done...
|
||||
|
||||
|
||||
clean:
|
||||
@echo =^> Cleaning CDEV Gateway Directories
|
||||
@for %d in ($(CLEAN_DIRS)) do @cd %d & $(MAKE) /NOLOGO /f NMakefile.mak clean
|
||||
@echo ^<= Done...
|
||||
|
||||
purge:
|
||||
@echo =^> Purging CDEV Gateway Directories
|
||||
@for %d in ($(CLEAN_DIRS)) do @cd %d & $(MAKE) /NOLOGO /f NMakefile.mak purge
|
||||
-@rmdir /s /q $(BASEDIR)\bin
|
||||
@echo ^<= Done...
|
||||
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 948 B |
+875
@@ -0,0 +1,875 @@
|
||||
<! This document generated using mif2html Version 1.0 - Walt Akers - 1996 !>
|
||||
<head>
|
||||
<title>CDEV Gateway</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#E0E0FF">
|
||||
|
||||
<body>
|
||||
<! ************************ FILE : cdevGatewayTITLE.mif *****************************!>
|
||||
<br><hr><br>
|
||||
<table width=100%>
|
||||
<tr><td>
|
||||
<! ***** Empty Column ***** !>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start ADDRESS-VERSION ***!><font size=+2 color=Black>
|
||||
CDEV Gateway
|
||||
</p>
|
||||
<font size=+1>
|
||||
</p>
|
||||
A Message Router/Concentrator for CDEV Clients
|
||||
</p>
|
||||
|
||||
</p>
|
||||
Walt Akers, Chip Watson, Jie Chen
|
||||
</p>
|
||||
|
||||
</p>
|
||||
Version 1.0 February 13, 1997
|
||||
</p>
|
||||
|
||||
</p>
|
||||
TJNAF - Thomas Jefferson National Accelerator Facility
|
||||
</p>
|
||||
|
||||
<!*** Finish ADDRESS-VERSION ***!></p></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
<! *************************** TABLE OF CONTENTS ****************************!>
|
||||
<br><hr><br>
|
||||
<table width=100%>
|
||||
<tr><td>
|
||||
<! ***** Empty Column ***** !>
|
||||
</td>
|
||||
<td valign=top align=center>
|
||||
<!*** Start CLASS-TOC-TITLE ***!><font size=+3><strong>
|
||||
Table of Contents
|
||||
<!*** Finish CLASS-TOC-TITLE ***!></p></strong></font>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
<! ***** Empty Column ***** !>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<table>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
1.
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF1">CDEV Gateway Fundamentals</a>
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF2">Overview of the CDEV Gateway</a>
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF3">Purpose of the CDEV Gateway</a>
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF4">Features of the CDEV Gateway Service</a>
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
2.
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF5">Building the CDEV Gateway Service</a>
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF6">Location of Files</a>
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF7">Steps to Building the Server and Service</a>
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
3.
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF8">Starting the CDEV Gateway</a>
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF9">Starting the Gateway Server</a>
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF10">Start-up Arguments for the Gateway Server</a>
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
4.
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF11">Troubleshooting Server Start-up</a>
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
5.
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF24">DDL Entries for the CDEV Gateway Client</a>
|
||||
<!*** Finish HEADING1TOC ***!><br></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start UHEADING2TOC ***!><font size=+1 color=Black>
|
||||
<a href="cdevGateway.html#TOCREF25">Setting Up the DDL </a>
|
||||
<!*** Finish UHEADING2TOC ***!><br></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
<! **************************** LIST OF FIGURES *****************************!>
|
||||
<br><hr><br>
|
||||
<table width=100%>
|
||||
<tr><td>
|
||||
<! ***** Empty Column ***** !>
|
||||
</td>
|
||||
<td valign=top align=center>
|
||||
<!*** Start CLASS-LOF-TITLE ***!><font size=+3><strong>
|
||||
List of Figures
|
||||
<!*** Finish CLASS-LOF-TITLE ***!></p></strong></font>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
<! ***** Empty Column ***** !>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FIGURELOF ***!><font size=+1 color=Black>
|
||||
Figure 2:
|
||||
<a href="cdevGateway.html#LOFREF1">Simple DDL file for the Gateway Service</a>
|
||||
<!*** Finish FIGURELOF ***!><br></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
<! ************************ FILE : ./cdevGateway.mif *****************************!>
|
||||
<br><hr><br>
|
||||
<table width=100%>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
1.
|
||||
<!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
<a name="TOCREF1">
|
||||
CDEV Gateway Fundamentals
|
||||
</a> <!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2 ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF2">
|
||||
Overview of the
|
||||
CDEV Gateway
|
||||
</a> <!*** Finish UHEADING2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
The CDEV Gateway is a server that acts as an intermediary between a CDEV
|
||||
application and remote services. A single network connection is established between
|
||||
the client and the gateway through which all CDEV requests will be routed. When the
|
||||
gateway receives a request from the client, it establishes the appropriate connection
|
||||
to the actual service, makes the request, and returns the result to the client
|
||||
application.
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2 ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF3">
|
||||
Purpose of the
|
||||
CDEV Gateway
|
||||
</a> <!*** Finish UHEADING2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
The CDEV Gateway was designed to support the JAVA/CDEV API. Because JAVA
|
||||
code must be small in order to load and execute efficiently, it was critical to move as
|
||||
much code as possible out of JAVA and into a CDEV "proxy" which could perform
|
||||
connection management and dynamic library loading. This allows the JAVA
|
||||
application to access new services provided in C++ without adding any new code.
|
||||
</p>
|
||||
The JAVA/CDEV library locates the CDEV Gateway by using a hostname and port that
|
||||
is provided in an environment variable. After determining the location of the server,
|
||||
JAVA will establish a connection to the gateway and then begin transmitting its CDEV
|
||||
requests in standard CLIP (CDEV Linear Internet Protocol).
|
||||
</p>
|
||||
The gateway can also be used by standard C or C++ CDEV applications to perform
|
||||
message routing. This approach can lessen the number of connections to actual
|
||||
control system devices and reduce network traffic significantly. The gateway is located
|
||||
by the gateway service by looking up its name (as specified in the CDEV DDL) in the
|
||||
global name server (The current name server is distributed as part of the CDEV
|
||||
Generic Server in the CDEV distribution).
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2 ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF4">
|
||||
Features of the
|
||||
CDEV Gateway
|
||||
Service
|
||||
</a> <!*** Finish UHEADING2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<table>
|
||||
<tr><td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
<img src="bullet.jpg">
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
The CDEV Gateway is constructed using the CDEV Generic Server Engine and
|
||||
the CLIP Protocol.
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
<img src="bullet.jpg">
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
Each gateway server registers its name, host and port with the CDEV Name
|
||||
Server when it is started.
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
<img src="bullet.jpg">
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
The name of the specific gateway to be used is associated with a CDEV device/
|
||||
message combination by using the "server" field of the class-data in the CDEV
|
||||
DDL file. Syntax is described later in this document.
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
<img src="bullet.jpg">
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
The gateway service will establish one connection to a named gateway to perform
|
||||
all transactions.
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
<img src="bullet.jpg">
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
The client application uses a special DDL file that redirects all signals to the
|
||||
gateway service. This allows the gateway server to maintain the actual control
|
||||
system connections from a centralized location.
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
<img src="bullet.jpg">
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BULLETED ***!><font size=+1 color=Black>
|
||||
The gateway server may have a standard DDL that redirects requests to the
|
||||
actual service OR it may have a special DDL that routes requests to another
|
||||
gateway. The system has currently been tested by routing messages through as
|
||||
many as ten gateways before reaching the actual control system. Note that
|
||||
performance begins to degrade substantially after routing through five gateways -
|
||||
but is still reasonable.
|
||||
<!*** Finish BULLETED ***!></p></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
2.
|
||||
<!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
<a name="TOCREF5">
|
||||
Building the CDEV Gateway Service
|
||||
</a> <!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2 ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF6">
|
||||
Location of Files
|
||||
</a> <!*** Finish UHEADING2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
The source code for the Gateway Service is provided with the CDEV distribution
|
||||
starting with version 1.5. The source code is located in the directory $CDEV/
|
||||
applications/cdevGateway. The following steps should be taken to build the Gateway
|
||||
Server and Service.
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2 ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF7">
|
||||
Steps to Building
|
||||
the Server and
|
||||
Service
|
||||
</a> <!*** Finish UHEADING2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<table>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
1.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
Obtain and install the CDEV distribution - Version 1.5 or higher.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
2.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
Follow the installation steps to build CDEV on your system. This includes setting
|
||||
all of the environment variables required by CDEV.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
3.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
Follow the installation steps to build the CDEV Generic Server and deploy the
|
||||
CDEV Name Server.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
4.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
There is a collection of platform specific makefiles in the directory <em>$CDEV/
|
||||
extensions/cdevGenericServer/include/makeinclude</em>. Link the makefile that is
|
||||
appropriate to your architecture to the file Makefile.OS in THAT directory.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
<!*** Start INDENTED ***!><font size=+1 color=Black>
|
||||
For example, to link to the makefile for HP-UX, you would type the following
|
||||
command.
|
||||
</p>
|
||||
|
||||
</p>
|
||||
<em>cd $CDEV/extensions/cdevGenericServer/makeinclude</em>
|
||||
</p>
|
||||
<em>ln -s Makefile.hpux Makefile.OS</em>
|
||||
</p>
|
||||
|
||||
<!*** Finish INDENTED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
5.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
Change directories to <em>$CDEV/applications/cdevGateway</em>.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
6.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
Type make to compile and link the CDEV Gateway Service shared object and the
|
||||
CDEV Gateway Server. Note that you must be using GNU make in order to build
|
||||
this distribution.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
Upon completion the Makefile will generate the shared object for the gateway service
|
||||
and will install it into your CDEVSHOBJ directory. The gateway server will be
|
||||
compiled, linked and installed in the directory $CDEV/applications/cdevGateway/bin/
|
||||
ARCH/cdevGateway. At this point you are ready to start the gateway server.
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
3.
|
||||
<!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
<a name="TOCREF8">
|
||||
Starting the CDEV Gateway
|
||||
</a> <!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2 ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF9">
|
||||
Starting the
|
||||
Gateway Server
|
||||
</a> <!*** Finish UHEADING2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
The following steps should be taken to execute the cdevGateway.
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
<table>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED1 ***!><font size=+1 color=Black>
|
||||
1.
|
||||
<!*** Finish NUMBERED1 ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED1 ***!><font size=+1 color=Black>
|
||||
Ensure that the required CDEV and CDEV Generic Server environment variables
|
||||
have been set. These include:
|
||||
<!*** Finish NUMBERED1 ***!></p></font>
|
||||
<table>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME_2 ***!><font size=+1 color=Black><strong>
|
||||
CDEVDDL
|
||||
<!*** Finish FUNC_NAME_2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF_2 ***!><font size=+1 color=Black>
|
||||
This is the name of the DDL file that indicates where
|
||||
messages should be routed. Typically, this DDL will
|
||||
route the messages to the actual control system
|
||||
devices.
|
||||
<!*** Finish FUNC_DEF_2 ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME_2 ***!><font size=+1 color=Black><strong>
|
||||
CDEVSHOBJ
|
||||
<!*** Finish FUNC_NAME_2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF_2 ***!><font size=+1 color=Black>
|
||||
This is the location of the CDEV shared object files.
|
||||
<!*** Finish FUNC_DEF_2 ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME_2 ***!><font size=+1 color=Black><strong>
|
||||
CDEV_NAME_SERVER
|
||||
<!*** Finish FUNC_NAME_2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF_2 ***!><font size=+1 color=Black>
|
||||
This is the host where the CDEV Name Server is
|
||||
running.
|
||||
<!*** Finish FUNC_DEF_2 ***!></p></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
2.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
Move to the directory where the CDEV Gateway Server binary is located: by
|
||||
default $CDEV/applications/cdevGateway/bin/ARCH, where ARCH is the name of
|
||||
the host architecture.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
3.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start NUMBERED ***!><font size=+1 color=Black>
|
||||
Type the command ./cdevGateway at the command line. This will start a gateway
|
||||
server with the name <strong><em>Gateway1</strong></em><em> </em>on the current host using TCP/IP port 9573. This
|
||||
information can be confirmed by using the <strong><em>dumpServer</strong></em> command that is
|
||||
provided with the CDEV Generic Server Engine to display the contents of the
|
||||
CDEV Name Server.
|
||||
<!*** Finish NUMBERED ***!></p></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
At this point the cdevGateway should be ready for use by client applications.
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2 ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF10">
|
||||
Start-up
|
||||
Arguments for the
|
||||
Gateway Server
|
||||
</a> <!*** Finish UHEADING2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
The user can specify the name of port used by the CDEV Gateway from the command
|
||||
line when the server is started. The gateway server will accept the following
|
||||
parameters from start-up.
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
<table>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME_2 ***!><font size=+1 color=Black><strong>
|
||||
s=<em>server name</em>
|
||||
<!*** Finish FUNC_NAME_2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF_2 ***!><font size=+1 color=Black>
|
||||
This allows the caller to specify the server name that
|
||||
will be registered with the name server. By default
|
||||
the server name is <strong><em>Gateway1</strong></em>.
|
||||
<!*** Finish FUNC_DEF_2 ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME_2 ***!><font size=+1 color=Black><strong>
|
||||
p=<em>port number</em>
|
||||
<!*** Finish FUNC_NAME_2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF_2 ***!><font size=+1 color=Black>
|
||||
This allows the caller to specify the port that the
|
||||
server will use to receive incoming requests. By
|
||||
default the port used by the server is <strong><em>9573</strong></em>.
|
||||
<!*** Finish FUNC_DEF_2 ***!></p></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
4.
|
||||
<!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
<a name="TOCREF11">
|
||||
Troubleshooting Server Start-up
|
||||
</a> <!*** Finish HEADING1 ***!></p></strong></font>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
When the server is started it may display one or more error conditions that will prevent
|
||||
it from operating properly.
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
<table>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF12">
|
||||
Error:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_PROTO ***!><font size=+1 color=Black><em>
|
||||
syntax error at line:#
|
||||
<!*** Finish FUNC_PROTO ***!></p></em></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF13">
|
||||
Meaning:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF ***!><font size=+1 color=Black>
|
||||
This message indicates that the CDEVDDL file that is being
|
||||
used by the gateway is formatted improperly.
|
||||
<!*** Finish FUNC_DEF ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF14">
|
||||
Solution:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF ***!><font size=+1 color=Black>
|
||||
Edit the CDEVDDL file and correct any formatting errors that
|
||||
may exist.
|
||||
<!*** Finish FUNC_DEF ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF15">
|
||||
Error:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_PROTO ***!><font size=+1 color=Black><em>
|
||||
ERROR: Gateway1 server already exists in GATEWAY domain
|
||||
<!*** Finish FUNC_PROTO ***!></p></em></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF16">
|
||||
Meaning:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF ***!><font size=+1 color=Black>
|
||||
This message indicates that a gateway server with the name
|
||||
Gateway1 has already been started and is currently registered
|
||||
with the CDEV Name Server.
|
||||
<!*** Finish FUNC_DEF ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF17">
|
||||
Solution:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF ***!><font size=+1 color=Black>
|
||||
The gateway will continue to attempt to register itself with the
|
||||
name server every 30 seconds. If the message continues to
|
||||
appear, then restart the gateway using the s parameter to
|
||||
specify a different server name OR shutdown the other
|
||||
gateway that is using the same name.
|
||||
<!*** Finish FUNC_DEF ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF18">
|
||||
Error:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_PROTO ***!><font size=+1 color=Black><em>
|
||||
Could not communicate with name server
|
||||
</p>
|
||||
ERROR: Failed to execute "REGISTER SERVER" operation
|
||||
<!*** Finish FUNC_PROTO ***!></p></em></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF19">
|
||||
Meaning:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF ***!><font size=+1 color=Black>
|
||||
This message indicates that the CDEV Name Server could not
|
||||
be accessed either because it is not running or because the
|
||||
CDEV_NAME_SERVER environment variable does not specify
|
||||
the correct host.
|
||||
<!*** Finish FUNC_DEF ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF20">
|
||||
Solution:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF ***!><font size=+1 color=Black>
|
||||
Ensure that the CDEV_NAME_SERVER environment variable
|
||||
is set and indicates the host where the name server is running.
|
||||
If this is correct, check to ensure that the name server is
|
||||
actually running on the specified host.
|
||||
<!*** Finish FUNC_DEF ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF21">
|
||||
Error:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_PROTO ***!><font size=+1 color=Black><em>
|
||||
Error: Server Gateway1 - Unable to open listening socket
|
||||
<!*** Finish FUNC_PROTO ***!></p></em></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF22">
|
||||
Meaning:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF ***!><font size=+1 color=Black>
|
||||
This message indicates that the port that the name server is
|
||||
attempting to use to listen for new connections is already in
|
||||
use.
|
||||
<!*** Finish FUNC_DEF ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start FUNC_NAME ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF23">
|
||||
Solution:
|
||||
</a> <!*** Finish FUNC_NAME ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start FUNC_DEF ***!><font size=+1 color=Black>
|
||||
Use the command line arguments to specify a different listening
|
||||
port.
|
||||
<!*** Finish FUNC_DEF ***!></p></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
|
||||
</p>
|
||||
|
||||
</p>
|
||||
|
||||
</p>
|
||||
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top align=right>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
5.
|
||||
<!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start HEADING1 ***!><font size=+3 color=Black><strong>
|
||||
<a name="TOCREF24">
|
||||
DDL Entries for the CDEV Gateway Client
|
||||
</a> <!*** Finish HEADING1 ***!></p></strong></font>
|
||||
</td></tr>
|
||||
<tr><td valign=top>
|
||||
<!*** Start UHEADING2 ***!><font size=+1 color=Black><strong>
|
||||
<a name="TOCREF25">
|
||||
Setting Up the
|
||||
DDL
|
||||
</a> <!*** Finish UHEADING2 ***!></p></strong></font>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
The following example illustrates how to add a service entry to identify the CDEV
|
||||
Gateway Service and how to use the class-data to specify the server that the gateway
|
||||
service will use for routing messages.
|
||||
</p>
|
||||
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
<!*** Start FIGURE ***!><font size=+0 color=Black><em>
|
||||
Figure 2:
|
||||
<a name="LOFREF1">
|
||||
Simple DDL file for the Gateway Service
|
||||
<table border=1><tr><td>
|
||||
<table>
|
||||
<tr><td>
|
||||
<! ***** Empty Column ***** !>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<!*** Start PROGRAM ***!><pre><font size=+0 color=Black><strong><em>
|
||||
/*
|
||||
* This is the service definition, it tells CDEV that there is
|
||||
* a service named Gateway and that it will use the cdevData
|
||||
* tag 'server' to locate the gateway using the CDEV Name Server.
|
||||
*/
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
/*
|
||||
* This class definition identifies the class gatewayClass which
|
||||
* supports the "get","set", "monitorOn" and "monitorOff"
|
||||
* commands on attributes "attrib0" and "attrib1". Note that
|
||||
* requests made to attrib0 will be routed through "Gateway1"
|
||||
* and requests made to attrib1 will be routed through
|
||||
* "Gateway2".
|
||||
*/
|
||||
class gatewayClass
|
||||
{
|
||||
verbs {get, set, monitorOn, monitorOff}
|
||||
attributes
|
||||
{
|
||||
attrib0 Gateway {server=Gateway1};
|
||||
attrib1 Gateway {server=Gateway2};
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, the CDEV DDL identifies two devices that are of type
|
||||
* gatewayClass. Any time one of the supported messages is passed
|
||||
* to one of these devices it will be routed through a CDEV
|
||||
* Gateway.
|
||||
*/
|
||||
gatewayClass : device0, device1;
|
||||
<!*** Finish PROGRAM ***!></strong></em></font></pre>
|
||||
</td></tr>
|
||||
</table>
|
||||
</tr></td></table>
|
||||
<AFrame 1>
|
||||
</a> <!*** Finish FIGURE ***!></p></em></font>
|
||||
<!*** Start BODY ***!><font size=+1 color=Black>
|
||||
|
||||
<!*** Finish BODY ***!></p></font>
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#! /bin/csh
|
||||
|
||||
if( -f fmbatch.dat) rm fmbatch.dat
|
||||
if( -d html) rm -rf html
|
||||
mkdir -p html
|
||||
cp $CDEV/doc/bullet.jpg html
|
||||
|
||||
foreach x (`find . -name \*.doc -a ! -name \*TOC.doc -a ! -name \*LOF.doc`)
|
||||
echo "Open $x" >> fmbatch.dat
|
||||
echo "SaveAs ma $x html/`basename $x .doc`.mif" >> fmbatch.dat
|
||||
end
|
||||
|
||||
fmbatch fmbatch.dat
|
||||
|
||||
cd html
|
||||
|
||||
foreach x (`find . -name \*.mif -a ! -name \*TITLE.mif`)
|
||||
mif2html -t 'CDEV Gateway Documentation' -o `basename $x .mif`.html `basename $x .mif`TITLE.mif \-TOC \-LOF $x
|
||||
end
|
||||
|
||||
rm *.mif
|
||||
Binary file not shown.
Executable
+15
@@ -0,0 +1,15 @@
|
||||
ARCH = OS
|
||||
SHOBJ = YES
|
||||
|
||||
include $(CDEV)/extensions/cdevGenericServer/include/makeinclude/Makefile.$(ARCH)
|
||||
|
||||
APPNAME = "CDEV Gateway Server"
|
||||
CXXINCLUDES = -I./
|
||||
LIBS = -L$(CDEVLIB) -lcdevGenericServer $(CDEVLIBS) $(OSLIBS)
|
||||
|
||||
TARGETS = $(CDEVBIN)/cdevGateway
|
||||
|
||||
targets : $(TARGETS)
|
||||
|
||||
$(CDEVBIN)/cdevGateway : $(OBJDIR)/cdevGateway.o
|
||||
$(LINK.cc) -o $@ $^ $(LIBS)
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
.SUFFIXES: .cc .obj
|
||||
|
||||
APPNAME = "CDEV Gateway Program"
|
||||
ARCH = WINNT-4.0
|
||||
SHOBJ = YES
|
||||
|
||||
BINARIES = $(CDEVBIN)\cdevGateway.exe
|
||||
|
||||
include ..\..\..\extensions\cdevGenericServer\include\makeinclude\Makefile.WINNT-4.0
|
||||
|
||||
CXXINCLUDES = /I .\\
|
||||
|
||||
targets : $(BINARIES)
|
||||
|
||||
$(CDEVBIN)\cdevGateway.exe : .exec\$(TARGETDIR)\cdevGateway.obj
|
||||
-@if exist $@ erase $@
|
||||
@echo ^ ^ ^ ^ ^ ^ =^> Linking $(@F)
|
||||
$(LINK) $(CDEVLIB)\cdev.lib $(CDEVLIB)\cdevGenericServer.lib \
|
||||
$(LINK_EXE_FLAGS) /out:$@ $?
|
||||
@echo ^ ^ ^ ^ ^ ^ ^ ^ ^ Done...
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
#include <cdevDevice.h>
|
||||
#include <cdevRequestObject.h>
|
||||
#include <cdevCollection.h>
|
||||
#include <cdevCollectionRequest.h>
|
||||
|
||||
#include "cdevGateway.h"
|
||||
|
||||
GatewayServer *gatewayServer;
|
||||
|
||||
// *****************************************************************************
|
||||
// * GatewayServer::GatewayServer :
|
||||
// * This is the constructor for the gateway server. It initializes the
|
||||
// * underlying cdevServer object and sets the nextCollectionInt variable
|
||||
// * to zero.
|
||||
// *
|
||||
// * The constructor will also extract all of the file descriptors from the
|
||||
// * cdevSystem object and will create a GatewayHandler for each of them...
|
||||
// * The fdChangedCallback method will be register with the cdevSystem to
|
||||
// * ensure that these GatewayHandlers will be regularly updated/removed
|
||||
// * as they become connected and disconnected.
|
||||
// *****************************************************************************
|
||||
GatewayServer::GatewayServer ( char * domain, char * server, unsigned short port, double pulse )
|
||||
: cdevServer(domain, server, port, pulse), nextCollectionInt(0)
|
||||
{
|
||||
int fdBufSize = 256;
|
||||
int * fdBuf = NULL;
|
||||
|
||||
// *********************************************************************
|
||||
// * Get the list of all file descriptors that are in use by the
|
||||
// * cdevSystem class.
|
||||
// *********************************************************************
|
||||
do {
|
||||
fdBuf = new int[fdBufSize];
|
||||
if(cdevSystem::defaultSystem().getFd(fdBuf, fdBufSize)!=CDEV_SUCCESS)
|
||||
{
|
||||
delete fdBuf;
|
||||
fdBufSize *= 2;
|
||||
fdBuf = NULL;
|
||||
}
|
||||
} while (fdBuf==NULL);
|
||||
|
||||
// *********************************************************************
|
||||
// * Create a GatewayHandler to manage each of the file descriptors
|
||||
// * that was provided by the cdevSystem class, and register them with
|
||||
// * the Reactor.
|
||||
// *********************************************************************
|
||||
for(int i=0; i<fdBufSize; i++)
|
||||
{
|
||||
GatewayHandler * hdlr;
|
||||
hdlr = new GatewayHandler(cdevSystem::defaultSystem(), fdBuf[i]);
|
||||
Reactor.registerHandler(hdlr, cdevEventHandler::READ_MASK);
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
// * Install the static fdChangedCallback method to be called each time
|
||||
// * one of the cdevSystem's file descriptors is added or deleted.
|
||||
// *********************************************************************
|
||||
cdevSystem::defaultSystem().addFdChangedCallback(fdChangedCallback, this);
|
||||
|
||||
// *********************************************************************
|
||||
// * Delete the temporary file descriptor buffer before returning.
|
||||
// *********************************************************************
|
||||
delete fdBuf;
|
||||
}
|
||||
|
||||
// *****************************************************************************
|
||||
// * GatewayServer::~GatewayServer :
|
||||
// * This is the virtual destructor for the cdevGateway class. It does
|
||||
// * nothing except serve as a placeholder to ensure that the delete
|
||||
// * mechanism calls the most senior object.
|
||||
// *****************************************************************************
|
||||
GatewayServer::~GatewayServer ( void )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// *****************************************************************************
|
||||
// * GatewayServer::fdChangedCallback :
|
||||
// * This method will be called by CDEV anytime one of the file descriptors
|
||||
// * associated with the cdevSystem is added or deleted. This method may
|
||||
// * then add or delete the file descriptor from the Reactor object.
|
||||
// *****************************************************************************
|
||||
void GatewayServer::fdChangedCallback (int fd, int opened, void * arg )
|
||||
{
|
||||
GatewayServer * server = (GatewayServer *)arg;
|
||||
|
||||
if(opened)
|
||||
{
|
||||
GatewayHandler * hdlr;
|
||||
hdlr = new GatewayHandler(cdevSystem::defaultSystem(), fd);
|
||||
server->Reactor.registerHandler(hdlr, cdevEventHandler::READ_MASK);
|
||||
}
|
||||
else server->Reactor.removeHandler(fd);
|
||||
}
|
||||
|
||||
|
||||
// *****************************************************************************
|
||||
// * GatewayServer::handleTimeout :
|
||||
// * This is the handleTimeout method. It is called by the cdevReactor
|
||||
// * periodically to make sure that all events are being handled.
|
||||
// *****************************************************************************
|
||||
int GatewayServer::handleTimeout ( void )
|
||||
{
|
||||
cdevSystem::defaultSystem().pend(0.001);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// *****************************************************************************
|
||||
// * GatewayServer::processMessages :
|
||||
// * This is the processMessages method. It receives the inbound requests
|
||||
// * from the clients and then calls CDEV to process the requests.
|
||||
// *****************************************************************************
|
||||
void GatewayServer::processMessages ( void )
|
||||
{
|
||||
int data_handled = 0;
|
||||
cdevMessage * request;
|
||||
while(dequeue(request)==0)
|
||||
{
|
||||
if(!strcmp(request->getMessage(), "register") ||
|
||||
!strcmp(request->getMessage(), "unregister"))
|
||||
{
|
||||
enqueue(request);
|
||||
delete (request);
|
||||
}
|
||||
else
|
||||
{
|
||||
int result (CDEV_SUCCESS);
|
||||
cdevCallback cb (gatewayCallback, request);
|
||||
int deviceCount (request->getDeviceCount());
|
||||
char ** deviceList = request->getDeviceList();
|
||||
char * message = request->getMessage();
|
||||
cdevData * context = request->getContext();
|
||||
cdevData * dataOut = request->getData();
|
||||
cdevRequestObject * req = NULL;
|
||||
|
||||
if(deviceCount<=0 || deviceList==NULL || message==NULL)
|
||||
{
|
||||
result = CDEV_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(deviceCount==1)
|
||||
{
|
||||
req = cdevRequestObject::attachPtr(deviceList[0], message);
|
||||
}
|
||||
else {
|
||||
char name[32];
|
||||
sprintf(name, "~Collection%i", nextCollectionInt++);
|
||||
cdevCollection *col = cdevCollection::attachPtr(name);
|
||||
col->add(deviceCount, deviceList);
|
||||
req = col->getRequestObject(message);
|
||||
}
|
||||
if(context) req->setContext(*context);
|
||||
result = req->sendCallback(dataOut, cb);
|
||||
if(result==CDEV_SUCCESS) data_handled++;
|
||||
}
|
||||
|
||||
if(result != CDEV_SUCCESS)
|
||||
{
|
||||
request->setCompletionCode(result);
|
||||
enqueue(request);
|
||||
delete request;
|
||||
}
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
// * Note: The developer MUST do a pend at this point in order to
|
||||
// * have the file descriptors updated... However, the wait time can be
|
||||
// * very, very short.
|
||||
// *********************************************************************
|
||||
if(data_handled) cdevSystem::defaultSystem().pend(0.000001);
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************************************
|
||||
// * GatewayServer::gatewayCallback :
|
||||
// * This is the callback function that is called each time a request has
|
||||
// * been processed by CDEV. The cdevMessage that was used to make the
|
||||
// * request is stored in the userarg parameter and this method will pass
|
||||
// * the result to the cdevGateway for processing.
|
||||
// *
|
||||
// * When the isTransactionDone flag is set to TRUE, this method will
|
||||
// * delete the cdevMessage object.
|
||||
// *****************************************************************************
|
||||
void GatewayServer::gatewayCallback ( int status, void *userarg, cdevRequestObject &, cdevData &data)
|
||||
{
|
||||
cdevMessage * message = (cdevMessage *)userarg;
|
||||
|
||||
|
||||
message->setCompletionCode(status);
|
||||
message->setData(&data, 1);
|
||||
message->setOperationCode(cdevCallback::isTransactionDone()?1:0);
|
||||
gatewayServer->enqueue(message);
|
||||
message->setData(NULL);
|
||||
|
||||
if(cdevCallback::isTransactionDone()) delete message;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
char serverName[255];
|
||||
int serverPort = 9573;
|
||||
int mismatch = 0;
|
||||
|
||||
strcpy(serverName, "Gateway1");
|
||||
|
||||
for(int i=1; i<argc && !mismatch; i++)
|
||||
{
|
||||
char * ptr;
|
||||
switch(*argv[i])
|
||||
{
|
||||
case 's':
|
||||
if((ptr = strchr(argv[i], '='))!=NULL && *(++ptr))
|
||||
{
|
||||
strcpy(serverName, ptr);
|
||||
}
|
||||
else mismatch = 1;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if((ptr = strchr(argv[i], '='))!=NULL && *(++ptr))
|
||||
{
|
||||
if((serverPort = atoi(ptr))==0)
|
||||
{
|
||||
mismatch = 1;
|
||||
}
|
||||
}
|
||||
else mismatch = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
mismatch = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(mismatch)
|
||||
{
|
||||
fprintf(stderr, "%s <s=server name> <p=server port>\\n", argv[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gatewayServer = new GatewayServer("GATEWAY", serverName, serverPort, 60);
|
||||
gatewayServer->runServer();
|
||||
}
|
||||
return mismatch?-1:0;
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#if !defined (_CDEV_GATEWAY_H)
|
||||
#define _CDEV_GATEWAY_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cdevSystem.h>
|
||||
#include <cdevServer.h>
|
||||
|
||||
class GatewayServer : public cdevServer
|
||||
{
|
||||
private:
|
||||
int nextCollectionInt;
|
||||
|
||||
public:
|
||||
GatewayServer ( char * domain, char * server, unsigned short port, double pulse );
|
||||
virtual ~GatewayServer ( void );
|
||||
virtual int handleTimeout ( void );
|
||||
virtual void processMessages ( void );
|
||||
|
||||
static void gatewayCallback ( int, void *, cdevRequestObject &, cdevData &);
|
||||
static void fdChangedCallback ( int fd, int opened, void * arg );
|
||||
};
|
||||
|
||||
|
||||
|
||||
class GatewayHandler : public cdevEventHandler
|
||||
{
|
||||
friend class GatewayServer;
|
||||
|
||||
public:
|
||||
GatewayHandler (cdevSystem & Sys, int Fd) : sys(Sys), fd(Fd) {}
|
||||
virtual ~GatewayHandler (void) {};
|
||||
virtual int getHandle (void) const { return fd; }
|
||||
virtual int handleInput (void) { sys.pend(1.0); return 0; }
|
||||
virtual int handleOutput (void) { sys.pend(1.0); return 0; }
|
||||
virtual int handleClose (void) { return 0; }
|
||||
|
||||
protected:
|
||||
int fd;
|
||||
cdevSystem & sys;
|
||||
};
|
||||
|
||||
#endif /* _CDEV_GATEWAY_H */
|
||||
Binary file not shown.
+17
@@ -0,0 +1,17 @@
|
||||
#include <GatewayService.h>
|
||||
|
||||
extern "C" cdevService * newGatewayService ( char * name, cdevSystem * system )
|
||||
{
|
||||
return new GatewayService(name, *system);
|
||||
}
|
||||
|
||||
GatewayService::GatewayService ( char * name, cdevSystem & system)
|
||||
: cdevClientService("GATEWAY", name, system)
|
||||
{
|
||||
system.reportError(CDEV_SEVERITY_INFO, "GatewayService", NULL,
|
||||
"Constructing a new GatewayService");
|
||||
}
|
||||
|
||||
GatewayService::~GatewayService ( void )
|
||||
{
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
#include <cdevClientService.h>
|
||||
|
||||
#ifndef GATEWAY_SERVICE_API
|
||||
#define GATEWAY_SERVICE_API
|
||||
#endif
|
||||
|
||||
extern "C" GATEWAY_SERVICE_API cdevService * newGatewayService ( char * name, cdevSystem * system );
|
||||
|
||||
class GatewayService : public cdevClientService
|
||||
{
|
||||
public:
|
||||
GatewayService ( char * name, cdevSystem & system = cdevSystem::defaultSystem());
|
||||
|
||||
protected:
|
||||
virtual ~GatewayService ( void );
|
||||
};
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
ARCH = OS
|
||||
SHOBJ = YES
|
||||
|
||||
include $(CDEV)/extensions/cdevGenericServer/include/makeinclude/Makefile.$(ARCH)
|
||||
|
||||
APPNAME = "CDEV Gateway Service"
|
||||
CXXINCLUDES = -I./
|
||||
|
||||
# ******************************************************************************
|
||||
# * The BINARIES definition names all of the binary files that should be deleted
|
||||
# * whenever "make clean" is executed.
|
||||
# ******************************************************************************
|
||||
BINARIES = $(CDEVLIB)/libGatewayService.a \
|
||||
$(CDEVLIB)/GatewayService.so
|
||||
|
||||
ifeq ($(SHOBJ), YES)
|
||||
LIBS = -L$(CDEVLIB) -lcdevGenericServer $(CDEVLIBS) $(OSLIBS)
|
||||
TARGETS = $(CDEVLIB)/GatewayService.so
|
||||
else
|
||||
LIBS = -L$(CDEVLIB) -lcdevGenericServer $(CDEVLIBS) $(OSLIBS)
|
||||
TARGETS = $(CDEVLIB)/libGatewayService.a
|
||||
endif
|
||||
|
||||
targets : $(TARGETS)
|
||||
|
||||
$(CDEVLIB)/GatewayService.so : $(OBJDIR)/GatewayService.o
|
||||
$(LINK.so) -o $@ $^ -L$(CDEVLIB) -lcdevGenericServer $(NETLIBS)
|
||||
@mkdir -p $(CDEVSHOBJ)/$(CDEVVERSION)
|
||||
@cp $@ $(CDEVSHOBJ)/$(CDEVVERSION)/$(@F)
|
||||
|
||||
$(CDEVLIB)/libGatewayService.a : $(OBJDIR)/GatewayService.o
|
||||
$(LINK.a) $@ $^
|
||||
@$(RANLIB) $@ > /dev/null
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
.SUFFIXES: .cc .obj
|
||||
|
||||
APPNAME = "CDEV Gateway Service"
|
||||
ARCH = WINNT-4.0
|
||||
SHOBJ = YES
|
||||
|
||||
BINARIES = $(CDEVLIB)\GatewayService.lib \
|
||||
$(CDEVLIB)\GatewayService.dll
|
||||
|
||||
include ..\..\..\extensions\cdevGenericServer\include\makeinclude\Makefile.WINNT-4.0
|
||||
|
||||
CXXINCLUDES = /I .\\
|
||||
CXXEXTRA_DLL = /D "GATEWAY_SERVICE_API=__declspec(dllexport)"
|
||||
CXXEXTRA_LIB = /D "GATEWAY_SERVICE_API="
|
||||
|
||||
!IF "$(SHOBJ)" == "YES"
|
||||
TARGETS = $(CDEVLIB)\GatewayService.dll
|
||||
!ELSE
|
||||
TARGETS = $(CDEVLIB)\GatewayService.lib
|
||||
!ENDIF
|
||||
|
||||
targets : $(TARGETS)
|
||||
|
||||
$(CDEVLIB)\GatewayService.dll : $(OBJDIR)\GatewayService.obj
|
||||
@echo ^ ^ ^ =^> Linking $(@F)
|
||||
-@if exist $@ erase $@
|
||||
-@if not exist $(@D) mkdir $(@D)
|
||||
@$(LIB32) $(CDEVLIB)\cdev.lib $(CDEVLIB)\cdevGenericServer.lib\
|
||||
$(LINK_DLL_FLAGS) /out:$@ /implib:$(@D)\$(@B).lib $?
|
||||
-@copy $@ $(CDEVSHOBJ)\$(CDEVVERSION)\$(@F) > nul
|
||||
@echo ^ ^ ^ ^ ^ ^ Done...
|
||||
|
||||
$(CDEVLIB)\GatewayService.lib : $(OBJDIR)\GatewayService.obj
|
||||
@echo ^ ^ ^ =^> Linking $(@F)
|
||||
-@if exist $@ erase $@
|
||||
-@if not exist $(@D) mkdir $(@D)
|
||||
@$(LIB32) $(CDEVLIB)\cdev.lib $(CDEVLIB)\cdevGenericServer.lib\
|
||||
$(LINK_LIB_FLAGS) /out:$@ $?
|
||||
@echo ^ ^ ^ ^ ^ ^ Done...
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
ARCH = OS
|
||||
SHOBJ = YES
|
||||
|
||||
include $(CDEV)/extensions/cdevGenericServer/include/makeinclude/Makefile.$(ARCH)
|
||||
|
||||
APPNAME = "CDEV Gateway Test Applications"
|
||||
CXXINCLUDES = -I./ -I../
|
||||
LIBS = -L$(CDEVLIB) -lcdevGenericServer $(CDEVLIBS) $(OSLIBS)
|
||||
OUTPUTDIR = ../bin/$(TARGETDIR)
|
||||
TARGETS = $(OUTPUTDIR)/TestProgram $(OUTPUTDIR)/monitorTest
|
||||
|
||||
targets : $(TARGETS)
|
||||
|
||||
|
||||
$(OUTPUTDIR)/TestProgram : $(OBJDIR)/TestProgram.o
|
||||
$(LINK.cc) $^ -o $@ $(LIBS)
|
||||
|
||||
$(OUTPUTDIR)/monitorTest : $(OBJDIR)/monitorTest.o
|
||||
$(LINK.cc) $^ -o $@ $(LIBS)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
service MonitorTest
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class GatewayBase
|
||||
{
|
||||
verbs {get}
|
||||
attributes
|
||||
{
|
||||
ClientInfo Gateway {server=Gateway1};
|
||||
ServerInfo Gateway {server=Gateway1};
|
||||
}
|
||||
}
|
||||
class MonitorTests
|
||||
{
|
||||
verbs {get, set, monitorOn, monitorOff}
|
||||
attributes
|
||||
{
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
attrib0 Gateway {server=Gateway1};
|
||||
attrib1 MonitorTest {server=MonitorTestServer};
|
||||
attrib2 Gateway {server=Gateway1};
|
||||
attrib3 Gateway {server=Gateway1};
|
||||
attrib4 Gateway {server=Gateway1};
|
||||
attrib5 Gateway {server=Gateway1};
|
||||
attrib6 Gateway {server=Gateway1};
|
||||
attrib7 Gateway {server=Gateway1};
|
||||
attrib8 Gateway {server=Gateway1};
|
||||
attrib9 Gateway {server=Gateway1};
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MonitorTests :
|
||||
device0, device1, device2, device3, device4,
|
||||
device5, device6, device7, device8, device9
|
||||
;
|
||||
|
||||
GatewayBase : Gateway1;
|
||||
@@ -0,0 +1,34 @@
|
||||
service MonitorTest
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class MonitorTests
|
||||
{
|
||||
verbs {get, set, monitorOn, monitorOff}
|
||||
attributes
|
||||
{
|
||||
default MonitorTest;
|
||||
servers MonitorTest;
|
||||
attrib0 MonitorTest {server=MonitorTestServer};
|
||||
attrib1 MonitorTest {server=MonitorTestServer};
|
||||
attrib2 MonitorTest {server=MonitorTestServer};
|
||||
attrib3 MonitorTest {server=MonitorTestServer};
|
||||
attrib4 MonitorTest {server=MonitorTestServer};
|
||||
attrib5 MonitorTest {server=MonitorTestServer};
|
||||
attrib6 MonitorTest {server=MonitorTestServer};
|
||||
attrib7 MonitorTest {server=MonitorTestServer};
|
||||
attrib8 MonitorTest {server=MonitorTestServer};
|
||||
attrib9 MonitorTest {server=MonitorTestServer};
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect MonitorTest;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MonitorTests :
|
||||
device0, device1, device2, device3, device4,
|
||||
device5, device6, device7, device8, device9
|
||||
;
|
||||
@@ -0,0 +1,29 @@
|
||||
.SUFFIXES: .cc .obj
|
||||
|
||||
APPNAME = CDEV Gateway Test Applications
|
||||
ARCH = WINNT-4.0
|
||||
SHOBJ = YES
|
||||
OUTPUTDIR = ..\bin\$(TARGETDIR)
|
||||
BINARIES = $(OUTPUTDIR)\TestProgram.exe $(OUTPUTDIR)\monitorTest.exe
|
||||
|
||||
include ..\..\..\extensions\cdevGenericServer\include\makeinclude\Makefile.WINNT-4.0
|
||||
|
||||
TARGETS = $(BINARIES)
|
||||
CXXINCLUDES = /I .\\
|
||||
|
||||
targets : $(BINARIES)
|
||||
|
||||
$(OUTPUTDIR)\TestProgram.exe : .exec\$(TARGETDIR)\TestProgram.obj
|
||||
-@if not exist $(OUTPUTDIR) mkdir $(OUTPUTDIR)
|
||||
-@if exist $@ erase $@
|
||||
@echo ^ ^ ^ ^ ^ ^ =^> Linking $(@F)
|
||||
$(LINK) $(CDEVLIB)\cdev.lib $(CDEVLIB)\cdevGenericServer.lib \
|
||||
$(LINK_EXE_FLAGS) /out:$@ $?
|
||||
@echo ^ ^ ^ ^ ^ ^ ^ ^ ^ Done...
|
||||
|
||||
$(OUTPUTDIR)\monitorTest.exe : .exec\$(TARGETDIR)\monitorTest.obj
|
||||
-@if exist $@ erase $@
|
||||
@echo ^ ^ ^ ^ ^ ^ =^> Linking $(@F)
|
||||
$(LINK) $(CDEVLIB)\cdev.lib $(CDEVLIB)\cdevGenericServer.lib \
|
||||
$(LINK_EXE_FLAGS) /out:$@ $?
|
||||
@echo ^ ^ ^ ^ ^ ^ ^ ^ ^ Done...
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#include <cdevSystem.h>
|
||||
#include <cdevRequestObject.h>
|
||||
#include <cdevDevice.h>
|
||||
#include <cdevGroup.h>
|
||||
#include <cdevCommon.h>
|
||||
|
||||
int fouled = 0;
|
||||
int expectedHits = 0;
|
||||
int hits = 0;
|
||||
unsigned totalCount = 0;
|
||||
|
||||
void callback ( int status, void * arg, cdevRequestObject &, cdevData &)
|
||||
{
|
||||
hits++;
|
||||
if(status!=CDEV_SUCCESS)
|
||||
{
|
||||
printf("ERROR: Transmission failure of %i\n", (int)arg);
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, ".");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
cdevCallback cb(callback, NULL);
|
||||
cdevRequestObject &treq = cdevRequestObject::attachRef("IPM1S01", "get VAL");
|
||||
|
||||
|
||||
fprintf(stdout, "sending...\n");
|
||||
for(int i=0; i<1000; i++) treq.sendCallback(NULL, cb);
|
||||
fprintf(stdout, "waiting...\n");
|
||||
while(hits<1000) cdevSystem::defaultSystem().pend(.1);
|
||||
fprintf(stdout, "done.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway1};
|
||||
GMES Gateway {server=Gateway1};
|
||||
PMES Gateway {server=Gateway1};
|
||||
betax Gateway {server=Gateway1};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
attrib Gateway {server=Gateway1};
|
||||
ServerInfo Gateway {server=Gateway1};
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01, R121
|
||||
;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway2};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01
|
||||
;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway3};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01
|
||||
;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway4};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01
|
||||
;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway5};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01
|
||||
;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway6};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01
|
||||
;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway7};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01
|
||||
;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway8};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01
|
||||
;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
service Gateway
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class Gateways
|
||||
{
|
||||
verbs {get, set}
|
||||
attributes
|
||||
{
|
||||
VAL Gateway {server=Gateway9};
|
||||
default Gateway;
|
||||
servers Gateway;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Gateway;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Gateways :
|
||||
IPM1S01
|
||||
;
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#include <cdevSystem.h>
|
||||
#include <cdevRequestObject.h>
|
||||
#include <cdevDevice.h>
|
||||
#include <cdevGroup.h>
|
||||
#include <cdevCommon.h>
|
||||
#include <cdevClock.h>
|
||||
|
||||
int callbackCount = 0;
|
||||
|
||||
void monitorCallback (int status, void *, cdevRequestObject &, cdevData &)
|
||||
{
|
||||
if (status==CDEV_SUCCESS) callbackCount++;
|
||||
}
|
||||
|
||||
#define POSTCOUNT 1
|
||||
#define REPEATCOUNT 2
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
if(argc<4)
|
||||
{
|
||||
printf("Format is: %s [device] [attrib] [time in seconds]\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
int seconds = atoi(argv[3]);
|
||||
if(seconds==0)
|
||||
{
|
||||
printf("Format is: %s [device] [attrib] [time in seconds]\n", argv[0]);
|
||||
printf("Time period of 0 specified...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cdevCallback cb(monitorCallback, NULL);
|
||||
char command[255];
|
||||
|
||||
sprintf(command, "monitorOn %s", argv[2]);
|
||||
cdevRequestObject & mOnReq = cdevRequestObject::attachRef(argv[1], command);
|
||||
|
||||
sprintf(command, "monitorOff %s", argv[2]);
|
||||
cdevRequestObject & mOffReq = cdevRequestObject::attachRef(argv[1], command);
|
||||
|
||||
printf("Receiving monitors on device: %s, attribute: %s for %i seconds...\n", argv[1], argv[2], seconds);
|
||||
cdevClock timer;
|
||||
timer.schedule(NULL, (double)seconds);
|
||||
mOnReq.sendCallback(NULL, cb);
|
||||
while(!timer.expired()) cdevSystem::defaultSystem().poll();
|
||||
mOffReq.sendCallback(NULL, cb);
|
||||
|
||||
printf("Received %i callbacks in %i seconds - %f callbacks/second\n", callbackCount, seconds, (double)callbackCount/seconds);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user