cdev-1.7.2n

This commit is contained in:
2022-12-13 12:44:04 +01:00
commit b3b88fc333
1357 changed files with 338883 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
ARCH = OS
SHOBJ = YES
include ../../include/makeinclude/Makefile.$(ARCH)
APPNAME = "Reflector Client/Server Example"
CXXINCLUDES = -I./
SO_SRCS = ReflectorService.cc
SO_LIBS = -L$(CDEVLIB) -lcdevGenericServer $(OSLIBS)
LIBS = -L$(CDEVLIB) -lcdevGenericServer $(CDEVLIBS) $(ACELIBS) $(OSLIBS)
ifeq ($(SHOBJ), YES)
TARGETS = $(BASELIB)/ReflectorService.so $(BASEBIN)/ReflectorServer
else
TARGETS = $(BASELIB)/libReflectorService.a $(BASEBIN)/ReflectorServer
endif
targets : $(TARGETS)
$(BASEBIN)/ReflectorServer : $(OBJDIR)/ReflectorServer.o
$(LINK.cc) $^ $(LIBS) -o $@
$(BASELIB)/ReflectorService.so : $(OBJDIR)/ReflectorService.o
$(LINK.so) -o $@ $^ -L$(CDEVLIB) -lcdevGenericServer $(OSLIBS)
@mkdir -p $(CDEVSHOBJ)/$(CDEVVERSION)
@cp $@ $(CDEVSHOBJ)/$(CDEVVERSION)/$(@F)
$(BASELIB)/libReflectorService.a : $(OBJDIR)/ReflectorService.o
$(LINK.a) $@ $(OBJDIR)/ReflectorService.o
@$(RANLIB) $@ > /dev/null

View File

@@ -0,0 +1,51 @@
.SUFFIXES: .cc .obj
APPNAME = Reflector Client/Server Example
ARCH = WINNT-4.0
SHOBJ = YES
BINARIES = $(BASEBIN)\ReflectorServer.exe \
$(CDEVLIB)\ReflectorService.dll \
$(CDEVLIB)\ReflectorService.lib
include ..\..\include\makeinclude\Makefile.WINNT-4.0
CXXINCLUDES = /I .\\
CXXEXTRA_DLL = /D "REFLECTOR_SERVICE_API=__declspec(dllexport)"
CXXEXTRA_LIB = /D "REFLECTOR_SERVICE_API="
!IF "$(SHOBJ)" == "YES"
TARGETS = $(BASEBIN)\ReflectorServer.exe \
$(CDEVLIB)\ReflectorService.dll
!ELSE
TARGETS = $(BASEBIN)\ReflectorServer.exe \
$(CDEVLIB)\ReflectorService.lib
!ENDIF
targets : $(TARGETS)
$(CDEVLIB)\ReflectorService.dll : $(OBJDIR)\ReflectorService.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)\ReflectorService.lib : $(OBJDIR)\ReflectorService.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...
$(BASEBIN)\ReflectorServer.exe : .exec\$(TARGETDIR)\ReflectorServer.obj
-@if exist $@ erase $@
@echo ^ ^ ^ ^ ^ ^ =^> Linking $(@F)
$(LINK) $(CDEVLIB)\cdev.lib $(CDEVLIB)\cdevGenericServer.lib \
$(LINK_EXE_FLAGS) /out:$@ $?
@echo ^ ^ ^ ^ ^ ^ ^ ^ ^ Done...

View File

@@ -0,0 +1,33 @@
service Reflector
{
tags {server}
}
class Reflectors
{
verbs {get, set}
attributes
{
default Reflector;
clientID Reflector;
servers Reflector;
connections Reflector;
attrib1 Reflector {server=TestServerX};
attrib2 Reflector {server=TestServerX};
attrib3 Reflector {server=TestServerX};
attrib4 Reflector {server=TestServerX};
attrib5 Reflector {server=TestServerX};
attrib6 Reflector {server=TestServerX};
}
messages
{
shutdown Reflector;
}
}
Reflectors :
device1,
device2,
device3
;

View File

@@ -0,0 +1,45 @@
#include <cdevServer.h>
// *****************************************************************************
// * class ReflectorServer :
// * This is the server class for the reflector. It simply receives messages
// * from a client and immediately returns them.
// *
// * The constructor passes the domain, server, port and rate to the
// * underlying cdevServer class to be processed. The cdevServer constructor
// * will add this server to the Name Server and will begin processing
// * messages when the cdevServer::runServer() method is executed.
// *
// * The processMessages method is the servers interface to the world... Each
// * time a complete message is received or the time specified in rate
// * expires, that method will be called.
// *****************************************************************************
class ReflectorServer : public cdevServer
{
public:
ReflectorServer ( char * domain, char * server, unsigned int port, double pulse )
: cdevServer(domain, server, port, pulse)
{
}
virtual void processMessages ( void )
{
cdevMessage * message;
while(dequeue(message)==0)
{
// message->asciiDump();
enqueue(message);
delete message;
}
}
};
int main()
{
ReflectorServer server("REFLECTOR", "TestServerX", 0, 60);
cdevServer::runServer();
return 0;
}

View File

@@ -0,0 +1,24 @@
#include <ReflectorService.h>
// *****************************************************************************
// * newReflectorService:
// * This function will be called by the cdevSystem object to create an
// * initial instance of the ReflectorService.
// *****************************************************************************
extern "C" cdevService * newReflectorService (char * name, cdevSystem * system)
{
return new ReflectorService(name, *system);
}
// *****************************************************************************
// * ReflectorService::ReflectorService :
// * This is teh constructor for the ReflectorService. It initializes the
// * underlying cdevClientService by specifying that it is in the domain of
// * REFLECTOR.
// *****************************************************************************
ReflectorService::ReflectorService ( char * name, cdevSystem & system)
: cdevClientService("REFLECTOR", name, system)
{
system.reportError(CDEV_SEVERITY_INFO, "ReflectorService", NULL,
"Constructing a new ReflectorService");
}

View File

@@ -0,0 +1,26 @@
#include <cdevClientService.h>
#ifndef REFLECTOR_SERVICE_API
#define REFLECTOR_SERVICE_API
#endif
// *****************************************************************************
// * newReflectorService :
// * This function will be called by the cdevSystem object to create an
// * initial instance of the ReflectorService.
// *****************************************************************************
extern "C" REFLECTOR_SERVICE_API cdevService * newReflectorService ( char * name, cdevSystem * system );
// *****************************************************************************
// * class ReflectorService :
// * This class simply inherits from the cdevClientService and must define
// * only a constructor and destructor.
// *****************************************************************************
class ReflectorService : public cdevClientService
{
public:
ReflectorService ( char * name, cdevSystem & system = cdevSystem::defaultSystem());
protected:
virtual ~ReflectorService ( void ) {};
};

View File

@@ -0,0 +1,46 @@
#! /bin/csh
if ( $?CDEV == 0 ) then
echo "CDEV Environment Variable is NOT Defined"
exit 0
endif
if ( $?CDEVDDL ) then
setenv OLDCDEVDDL $CDEVDDL
endif
setenv CDEVDDL `pwd`/Reflector.ddl
echo "-------------------------------------------------------------------------"
echo " This test will send a collection of packets to the Reflector Server... "
echo " The Server should return the same data to the client unmodified. "
echo "-------------------------------------------------------------------------"
cdevUtil "debug on" \
"device1 get attrib1 value=0 status=1 controlHigh=2 controlLow=3 alarmHigh=4 alarmLow=5" \
"device1 get attrib2 value=10 status=11 controlHigh=12 controlLow=13 alarmHigh=14 alarmLow=15" \
"device1 get attrib3 value=20 status=21 controlHigh=22 controlLow=23 alarmHigh=24 alarmLow=25" \
"device1 get attrib4 value=30 status=31 controlHigh=32 controlLow=33 alarmHigh=34 alarmLow=35" \
"device1 get attrib5 value=40 status=41 controlHigh=42 controlLow=43 alarmHigh=44 alarmLow=45" \
"device1 get attrib6 value=50 status=51 controlHigh=52 controlLow=53 alarmHigh=54 alarmLow=55" \
"device2 get attrib1 value=0 status=1 controlHigh=2 controlLow=3 alarmHigh=4 alarmLow=5" \
"device2 get attrib2 value=10 status=11 controlHigh=12 controlLow=13 alarmHigh=14 alarmLow=15" \
"device2 get attrib3 value=20 status=21 controlHigh=22 controlLow=23 alarmHigh=24 alarmLow=25" \
"device2 get attrib4 value=30 status=31 controlHigh=32 controlLow=33 alarmHigh=34 alarmLow=35" \
"device2 get attrib5 value=40 status=41 controlHigh=42 controlLow=43 alarmHigh=44 alarmLow=45" \
"device2 get attrib6 value=50 status=51 controlHigh=52 controlLow=53 alarmHigh=54 alarmLow=55" \
"device3 get attrib1 value=0 status=1 controlHigh=2 controlLow=3 alarmHigh=4 alarmLow=5" \
"device3 get attrib2 value=10 status=11 controlHigh=12 controlLow=13 alarmHigh=14 alarmLow=15" \
"device3 get attrib3 value=20 status=21 controlHigh=22 controlLow=23 alarmHigh=24 alarmLow=25" \
"device3 get attrib4 value=30 status=31 controlHigh=32 controlLow=33 alarmHigh=34 alarmLow=35" \
"device3 get attrib5 value=40 status=41 controlHigh=42 controlLow=43 alarmHigh=44 alarmLow=45" \
"device3 get attrib6 value=50 status=51 controlHigh=52 controlLow=53 alarmHigh=54 alarmLow=55" \
"quit"
if ( $?OLDCDEVDDL ) then
setenv CDEVDDL $OLDCDEVDDL
endif
echo "-------------------------------------------------------------------------"
echo " End of test..."
echo "-------------------------------------------------------------------------"