cdev-1.7.2n
This commit is contained in:
Executable
+76
@@ -0,0 +1,76 @@
|
||||
ARCH = hpux-sl
|
||||
include $(CDEV)/examples/Makefile.common
|
||||
|
||||
SRCROOT = $(CDEV)/extensions/cdevGenericServer
|
||||
CDEVSHOBJ = /usr/user4/mccops/lib/$(TARGETDIR)
|
||||
APPNAME = "CDEV Sample Service"
|
||||
|
||||
LIBDIR = $(CDEVLIB)
|
||||
INCDIR = $(SRCROOT)/include
|
||||
LIBS = -L$(LIBDIR) -lSimpleService \
|
||||
-L$(CDEVLIB) -lcdev \
|
||||
-ly -ll -L/lib -lm
|
||||
|
||||
LINKLIBS = -L$(LIBDIR) -lSimpleService\
|
||||
-ly -ll -L/lib -lm
|
||||
|
||||
CLASS_INCLUDES = -I./ -I$(INCDIR) -I$(CDEV)/extensions/SimpleService
|
||||
CXXEXTRA = -pta $(EPICSINCLUDES) $(ACE_INCLUDES) $(CLASS_INCLUDES)
|
||||
|
||||
SRCS = SampleService.cc
|
||||
|
||||
OBJS = SampleService.o
|
||||
|
||||
% : %.cc
|
||||
@rm -f $@
|
||||
@echo "=> $(CXX) $< -o $@"
|
||||
@$(CXX) $(CXXFLAGS) $(CXXEXTRA) $< -o $@ -L$(ACE_LIBDIR) $(ACE_LIBS)
|
||||
|
||||
ifeq ($(SHOBJ), YES)
|
||||
OUTPUTLIB = SampleService.so
|
||||
targets: buildingService $(CDEVSHOBJ)/$(CDEVVERSION)/SampleService.so
|
||||
|
||||
else
|
||||
OUTPUTLIB = libSampleService.a
|
||||
targets: buildingService $(CDEV)/lib/$(TARGETDIR)/libSampleService.a
|
||||
|
||||
endif
|
||||
|
||||
buildingService:
|
||||
@echo "BUILDING LIBRARY \"$(OUTPUTLIB)\"..."
|
||||
|
||||
objClean :
|
||||
@echo ""
|
||||
@echo "=> Removing old object files prior to building library"
|
||||
@rm -rf $(OBJS)
|
||||
|
||||
$(CDEVSHOBJ)/$(CDEVVERSION)/SampleService.so : $(OBJS) $(SRCS)
|
||||
@rm -f $@
|
||||
@echo "=> Building shared object $@"
|
||||
@echo " => Pleasuring templates for $@"
|
||||
@echo "int main() {return 0; }" >dummy.cc
|
||||
@$(CXX) $(CXXFLAGS) $(CXXEXTRA) dummy.cc $(SRCS) -Wl,+s -ptr./ptSampleService -ptr./ptrepository $(LIBS)
|
||||
@rm -rf a.out dummy.*
|
||||
@if test -f ./ptSampleService/*.o; \
|
||||
then \
|
||||
echo " => Linking $@ from objects and template objects"; \
|
||||
$(CXX) -b -o $@ $(OBJS) ptSampleService/*.o $(LINKLIBS); \
|
||||
else \
|
||||
echo " => Linking $@ from objects"; \
|
||||
$(CXX) -b -o $@ $(OBJS) $(LINKLIBS); \
|
||||
fi
|
||||
@echo " => $@ finished"
|
||||
|
||||
$(CDEV)/lib/$(TARGETDIR)/libSampleService.a : hail buildingService objClean $(OBJS)
|
||||
@rm -f $@
|
||||
@echo "=> Building archive library $@"
|
||||
@echo " => Linking $@ from objects"
|
||||
@ar ruv libSampleService.a $(OBJS)
|
||||
@chmod a+r libSampleService.a
|
||||
@echo " => $@ finished"
|
||||
|
||||
clean:
|
||||
@echo "=> Sample Service"
|
||||
@echo " => Removing old objects and binaries"
|
||||
@rm -rf $(OBJS) $(CDEVSHOBJ)/$(TARGETDIR)/SampleService.so a.out *.o *~ core ptrepository ptSampleService
|
||||
@echo " => Done"
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
service ca
|
||||
{
|
||||
tags {PV, READONLY}
|
||||
}
|
||||
|
||||
service Sample
|
||||
{
|
||||
tags {server}
|
||||
}
|
||||
|
||||
class BPM
|
||||
{
|
||||
verbs {get, set, monitorOn, monitorOff}
|
||||
attributes
|
||||
{
|
||||
attrib0 ca {PV = <>.VAL};
|
||||
attrib1 ca {PV = <>.VAL};
|
||||
attrib2 ca {PV = <>.VAL};
|
||||
attrib3 ca {PV = <>.VAL};
|
||||
attrib4 ca {PV = <>.VAL};
|
||||
attrib5 ca {PV = <>.VAL};
|
||||
attrib6 ca {PV = <>.VAL};
|
||||
attrib7 ca {PV = <>.VAL};
|
||||
attrib8 ca {PV = <>.VAL};
|
||||
attrib9 ca {PV = <>.VAL};
|
||||
}
|
||||
}
|
||||
|
||||
class Samples
|
||||
{
|
||||
verbs {get, set, monitorOn, monitorOff}
|
||||
attributes
|
||||
{
|
||||
default Sample;
|
||||
servers Sample;
|
||||
attrib0 Sample;
|
||||
attrib1 Sample;
|
||||
attrib2 Sample;
|
||||
attrib3 Sample;
|
||||
attrib4 Sample;
|
||||
attrib5 Sample;
|
||||
attrib6 Sample;
|
||||
attrib7 Sample;
|
||||
attrib8 Sample;
|
||||
attrib9 Sample;
|
||||
}
|
||||
messages
|
||||
{
|
||||
disconnect Sample;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BPM :
|
||||
IPM1S01, IPM1S02, IPM1S03, IPM1S05, IPM1S07,
|
||||
IPM1S08, IPM1S09
|
||||
;
|
||||
|
||||
Samples :
|
||||
device0, device1, device2, device3, device4,
|
||||
device5, device6, device7, device8, device9
|
||||
;
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
#include "SampleService.h"
|
||||
|
||||
cdevService * newSampleService ( char * name, cdevSystem * system )
|
||||
{
|
||||
return new SampleService(name, *system);
|
||||
}
|
||||
|
||||
|
||||
SampleService::SampleService ( char * name, cdevSystem & system )
|
||||
: cdevSimpleService(name, system), var(0)
|
||||
{
|
||||
}
|
||||
|
||||
SampleService::~SampleService ( void )
|
||||
{
|
||||
}
|
||||
|
||||
void SampleService::handleOneEvent ( void )
|
||||
{
|
||||
cdevTransaction * transaction;
|
||||
char * device;
|
||||
char * message;
|
||||
cdevData * data;
|
||||
|
||||
if(dequeue(transaction, device, message, data)==CDEV_SUCCESS)
|
||||
{
|
||||
data->insert("device", device);
|
||||
data->insert("message", message);
|
||||
data->insert("value", var++);
|
||||
enqueue(CDEV_SUCCESS, transaction, device, message, data);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
#include <cdevSimpleService.h>
|
||||
|
||||
extern "C" cdevService *newSampleService ( char * name, cdevSystem * system );
|
||||
|
||||
class SampleService : public cdevSimpleService
|
||||
{
|
||||
int var;
|
||||
|
||||
public:
|
||||
SampleService ( char * name, cdevSystem & system );
|
||||
virtual ~SampleService ( void );
|
||||
virtual void handleOneEvent( void );
|
||||
};
|
||||
Reference in New Issue
Block a user