cdev-1.7.2n
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#include <cdevSystem.h>
|
||||
#include <cdevDevice.h>
|
||||
#include <cdevData.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
cdevDevice *dir = cdevDevice::attachPtr("cdevDirectory");
|
||||
cdevData input, output;
|
||||
|
||||
cdevData::insertTag(0x1001, "PV");
|
||||
|
||||
// ***********************************************************
|
||||
// * Insert the name of the device and message to be resolved.
|
||||
// ***********************************************************
|
||||
input.insert("device", "diag1");
|
||||
input.insert("message", "get value");
|
||||
|
||||
// ***********************************************************
|
||||
// * Submit the request to the cdevDirectory object using the
|
||||
// * send command, and output the result (using asciiDump) if
|
||||
// * successful.
|
||||
// ***********************************************************
|
||||
if(dir->send("serviceData", input, output)==CDEV_SUCCESS)
|
||||
{
|
||||
output.asciiDump(stdout);
|
||||
} else {
|
||||
fprintf(stderr, "Send Failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
service ca {
|
||||
tags { PV }
|
||||
}
|
||||
|
||||
/* All items share these verbs and attributes */
|
||||
class Basic {
|
||||
verbs { get, set, monitorOn, monitorOff }
|
||||
|
||||
attributes {
|
||||
value ca {PV=<>.VAL};
|
||||
}
|
||||
}
|
||||
|
||||
Basic :
|
||||
diag1 { t10a:sad:test }
|
||||
;
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
########################################################################
|
||||
# Makefile for shared object
|
||||
########################################################################
|
||||
CDEVROOT = $(CDEV)
|
||||
include $(CDEVROOT)/examples/Makefile.common
|
||||
|
||||
CXXEXTRA = $(CLASS_INCLUDES) $(EPICSINCLUDES)
|
||||
|
||||
LIBS = -L$(CDEVLIB) -lcdev -lEpicsCa \
|
||||
-L$(EPICSLIB) -lca -lDb -lCom -lm -ly -ll
|
||||
|
||||
TARGETS = ascii2Bin bin2Ascii cdevDirectoryTest Gillies
|
||||
|
||||
targets: $(TARGETS)
|
||||
|
||||
ascii2Bin : ascii2Bin.o
|
||||
@rm -f $@
|
||||
@echo "=> $(CXX) -o $@ $<"
|
||||
@$(PROOF) $(CXX) $(CXXFLAGS) $(CXXEXTRA) $< $(CDEVLIB)/libcdev.a $(LIBS) -o $@
|
||||
@rm -rf ptrepository
|
||||
|
||||
bin2Ascii : bin2Ascii.o
|
||||
@rm -f $@
|
||||
@echo "=> $(CXX) -o $@ $<"
|
||||
@$(PROOF) $(CXX) $(CXXFLAGS) $(CXXEXTRA) $< $(CDEVLIB)/libcdev.a $(LIBS) -o $@
|
||||
@rm -rf ptrepository
|
||||
|
||||
cdevDirectoryTest : cdevDirectoryTest.o
|
||||
@rm -f $@
|
||||
@echo "=> $(CXX) -o $@ $<"
|
||||
@$(CXX) $(CXXFLAGS) $(CXXEXTRA) $^ -L$(CDEVLIB) -lcdev -lm -ll -ly -o $@
|
||||
@rm -rf ptrepository
|
||||
|
||||
Gillies : Gillies.o
|
||||
@rm -f $@
|
||||
@echo "=> $(CXX) -o $@ $<"
|
||||
@$(CXX) $(CXXFLAGS) $(CXXEXTRA) $^ -L$(CDEVLIB) -lcdev -lm -ll -ly -o $@
|
||||
@rm -rf ptrepository
|
||||
|
||||
SpaceTest : SpaceTest.o
|
||||
@rm -f $@
|
||||
@echo "=> $(CXX) -o $@ $<"
|
||||
@$(CXX) $(CXXFLAGS) $(CXXEXTRA) $^ -L$(CDEVLIB) -lcdev -lm -ll -ly -o $@
|
||||
@rm -rf ptrepository
|
||||
|
||||
implementTest : implementTest.o
|
||||
@rm -f $@
|
||||
@echo "=> $(CXX) -o $@ $<"
|
||||
@$(CXX) $(CXXFLAGS) $(CXXEXTRA) $^ -L$(CDEVLIB) -lcdev -lm -ll -ly -o $@
|
||||
@rm -rf ptrepository
|
||||
|
||||
queryTest : queryTest.o
|
||||
@rm -f $@
|
||||
@echo "=> $(CXX) -o $@ $<"
|
||||
@$(CXX) $(CXXFLAGS) $(CXXEXTRA) $^ -L$(CDEVLIB) -lcdev -lm -ll -ly -o $@
|
||||
@rm -rf ptrepository
|
||||
|
||||
clean:
|
||||
@rm -rf $(TARGETS) *.o *.a *~ core ptrepository
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
.SUFFIXES: .cc .objbj
|
||||
|
||||
ARCH = WINNT-4.0
|
||||
SHOBJ = YES
|
||||
APPNAME = CDEV Test Applications
|
||||
TARGETS = ascii2Bin.exe bin2Ascii.exe cdevDirectoryTest.exe
|
||||
|
||||
include ..\..\include\makeinclude\Makefile.WINNT-4.0
|
||||
|
||||
targets: $(TARGETS)
|
||||
|
||||
$(CDEVBIN):
|
||||
@mkdir -p $@
|
||||
|
||||
ascii2Bin.exe: .exec\$(TARGETDIR)\ascii2Bin.obj
|
||||
@$(LINK) \
|
||||
$(CDEVLIB)\cdev.lib $(LINK_EXE_FLAGS) /out:$@ \
|
||||
.exec\$(TARGETDIR)\ascii2Bin.obj
|
||||
|
||||
bin2Ascii.exe: .exec\$(TARGETDIR)\bin2Ascii.obj
|
||||
@$(LINK) \
|
||||
$(CDEVLIB)\cdev.lib $(LINK_EXE_FLAGS) /out:$@ \
|
||||
.exec\$(TARGETDIR)\bin2Ascii.obj
|
||||
|
||||
cdevDirectoryTest.exe: .exec\$(TARGETDIR)\cdevDirectoryTest.obj
|
||||
@$(LINK) \
|
||||
$(CDEVLIB)\cdev.lib $(LINK_EXE_FLAGS) /out:$@ \
|
||||
.exec\$(TARGETDIR)\cdevDirectoryTest.obj
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#include <cdevDirectoryTool.h>
|
||||
|
||||
int main ( int argc, char ** argv )
|
||||
{
|
||||
int result = 0;
|
||||
char * inputFile = NULL;
|
||||
char * outputFile = NULL;
|
||||
|
||||
for(int i=1; i<argc; i++)
|
||||
{
|
||||
if(!strcmp(argv[i], "-o")) outputFile = argv[++i];
|
||||
else inputFile = argv[i];
|
||||
}
|
||||
|
||||
if(inputFile==NULL || outputFile==NULL)
|
||||
{
|
||||
fprintf(stdout, "ascii2Bin Error:\n => Bad or missing arguments\n => Format is: ascii2Bin inputFile -o outputFile\n");
|
||||
result = -1;
|
||||
}
|
||||
else {
|
||||
cdevDirectoryTable table;
|
||||
|
||||
fprintf(stdout, "\nascii2Bin: Compiling %s to %s\n", inputFile, outputFile);
|
||||
fflush (stdout);
|
||||
|
||||
if(table.load (inputFile)==CDEV_SUCCESS) table.binaryDump(outputFile);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#include <cdevDirectoryTool.h>
|
||||
|
||||
int main ( int argc, char ** argv )
|
||||
{
|
||||
int result = 0;
|
||||
char * inputFile = NULL;
|
||||
char * outputFile = NULL;
|
||||
|
||||
for(int i=1; i<argc; i++)
|
||||
{
|
||||
if(!strcmp(argv[i], "-o")) outputFile = argv[++i];
|
||||
else inputFile = argv[i];
|
||||
}
|
||||
|
||||
if(inputFile==NULL || outputFile==NULL)
|
||||
{
|
||||
fprintf(stdout, "\nbin2Ascii Error:\n => Bad or missing arguments\n => Format is: bin2Ascii inputFile -o outputFile\n");
|
||||
result = -1;
|
||||
}
|
||||
else {
|
||||
cdevDirectoryTable table;
|
||||
FILE * fp;
|
||||
|
||||
fprintf(stdout, "bin2Ascii: Converting %s to %s\n", inputFile, outputFile);
|
||||
fflush (stdout);
|
||||
|
||||
if(table.load (inputFile)==CDEV_SUCCESS && (fp=fopen(outputFile, "w"))!=NULL)
|
||||
{
|
||||
table.asciiDump(fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Executable
+205
@@ -0,0 +1,205 @@
|
||||
#include <cdevDevice.h>
|
||||
#include <cdevRequestObject.h>
|
||||
|
||||
int getDirectoryDevices ( char ** & devices, size_t & nDevices );
|
||||
int getDeviceClass ( char * device, char *& className );
|
||||
void reportOnDevice ( char * device );
|
||||
|
||||
int main()
|
||||
{
|
||||
char ** devices;
|
||||
size_t nDevices;
|
||||
|
||||
cdevData::insertTag(9810, "RDONLY");
|
||||
cdevData::insertTag(9811, "PV");
|
||||
cdevData::insertTag(9812, "server");
|
||||
|
||||
if(getDirectoryDevices(devices, nDevices)==CDEV_SUCCESS)
|
||||
{
|
||||
fprintf(stdout, " CDEV Devices in DDL \n");
|
||||
fprintf(stdout, "=============================\n");
|
||||
for(int i=0; i<nDevices; i++)
|
||||
{
|
||||
reportOnDevice(devices[i]);
|
||||
delete devices[i];
|
||||
}
|
||||
delete devices;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int getDirectoryDevices ( char ** & devices, size_t & nDevices )
|
||||
{
|
||||
int result;
|
||||
cdevData out;
|
||||
cdevDevice & dir = cdevDevice::attachRef("cdevDirectory");
|
||||
|
||||
devices = NULL;
|
||||
nDevices = 0;
|
||||
|
||||
if((result = dir.send("query", NULL, out))==CDEV_SUCCESS)
|
||||
{
|
||||
out.getElems("value", &nDevices);
|
||||
devices = new char *[nDevices];
|
||||
out.get("value", devices);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int getDeviceClass ( char * device, char *& className )
|
||||
{
|
||||
int result;
|
||||
cdevData in, out;
|
||||
cdevDevice & dir = cdevDevice::attachRef("cdevDirectory");
|
||||
|
||||
className = NULL;
|
||||
in.insert("device", device);
|
||||
if((result = dir.send("queryClass", in, out))==CDEV_SUCCESS)
|
||||
{
|
||||
out.get("value", &className);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int getClassVerbs ( char * className, char ** & verbs, size_t &nVerbs )
|
||||
{
|
||||
int result;
|
||||
cdevData in, out;
|
||||
cdevDevice & dir = cdevDevice::attachRef("cdevDirectory");
|
||||
|
||||
verbs = NULL;
|
||||
nVerbs = 0;
|
||||
|
||||
in.insert("class", className);
|
||||
if((result = dir.send("queryVerbs", in, out))==CDEV_SUCCESS)
|
||||
{
|
||||
out.getElems("value", &nVerbs);
|
||||
verbs = new char *[nVerbs];
|
||||
out.get("value", verbs);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int getClassAttributes ( char * className, char ** & attributes, size_t &nAttributes )
|
||||
{
|
||||
int result;
|
||||
cdevData in, out;
|
||||
cdevDevice & dir = cdevDevice::attachRef("cdevDirectory");
|
||||
|
||||
attributes = NULL;
|
||||
nAttributes = 0;
|
||||
|
||||
in.insert("class", className);
|
||||
if((result = dir.send("queryAttributes", in, out))==CDEV_SUCCESS)
|
||||
{
|
||||
out.getElems("value", &nAttributes);
|
||||
attributes = new char *[nAttributes];
|
||||
out.get("value", attributes);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int getClassMessages ( char * className, char ** & messages, size_t &nMessages )
|
||||
{
|
||||
int result;
|
||||
cdevData in, out;
|
||||
cdevDevice & dir = cdevDevice::attachRef("cdevDirectory");
|
||||
|
||||
messages = NULL;
|
||||
nMessages = 0;
|
||||
|
||||
in.insert("class", className);
|
||||
if((result = dir.send("queryMessages", in, out))==CDEV_SUCCESS)
|
||||
{
|
||||
out.getElems("value", &nMessages);
|
||||
messages = new char *[nMessages];
|
||||
out.get("value", messages);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int getServiceData ( char * device, char *message, char *&service, char *&data)
|
||||
{
|
||||
int result;
|
||||
cdevData in, out;
|
||||
cdevDevice & dir = cdevDevice::attachRef ("cdevDirectory");
|
||||
in.insert("device", device);
|
||||
in.insert("message", message);
|
||||
|
||||
service = NULL;
|
||||
data = NULL;
|
||||
|
||||
if((result = dir.send("service", in, out))==CDEV_SUCCESS)
|
||||
{
|
||||
out.get("value", &service);
|
||||
out.remove();
|
||||
if((result = dir.send("serviceData", in, out))==CDEV_SUCCESS)
|
||||
{
|
||||
int dataLen = 1;
|
||||
cdevDataIterator iter(&out);
|
||||
|
||||
data = (char *)malloc(dataLen);
|
||||
*data = 0;
|
||||
iter.init();
|
||||
|
||||
while(iter.tag()!=NULL)
|
||||
{
|
||||
char *tPtr, *dPtr = NULL;
|
||||
cdevData::tagI2C(iter.tag(), tPtr);
|
||||
out.get(iter.tag(), &dPtr);
|
||||
|
||||
dataLen += strlen(tPtr)+strlen(dPtr)+3;
|
||||
data = (char *)realloc(data, dataLen);
|
||||
|
||||
sprintf(&data[strlen(data)], "%s=%s ", tPtr, dPtr);
|
||||
delete dPtr;
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
else delete service;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void reportOnDevice ( char * device )
|
||||
{
|
||||
int i;
|
||||
char * className;
|
||||
char ** verbs, **attributes, **messages;
|
||||
size_t nVerbs, nAttributes, nMessages;
|
||||
|
||||
getDeviceClass(device, className);
|
||||
getClassVerbs (className, verbs, nVerbs);
|
||||
getClassAttributes(className, attributes, nAttributes);
|
||||
getClassMessages(className, messages, nMessages);
|
||||
|
||||
fprintf(stdout, "Device: %s\n", device);
|
||||
fprintf(stdout, " Class : %s\n", className);
|
||||
for(i=0; i<nVerbs; i++)
|
||||
{
|
||||
if(i==0) fprintf(stdout, " Verbs : %s\n", verbs[i]);
|
||||
else fprintf(stdout, " %s\n", verbs[i]);
|
||||
delete verbs[i];
|
||||
}
|
||||
for(i=0; i<nAttributes; i++)
|
||||
{
|
||||
if(i==0) fprintf(stdout, " Attributes: %s\n", attributes[i]);
|
||||
else fprintf(stdout, " %s\n", attributes[i]);
|
||||
delete attributes[i];
|
||||
}
|
||||
for(i=0; i<nMessages; i++)
|
||||
{
|
||||
if(i==0) fprintf(stdout, " Messages : %s\n", messages[i]);
|
||||
else fprintf(stdout, " %s\n", messages[i]);
|
||||
delete messages[i];
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
delete className;
|
||||
delete verbs;
|
||||
delete attributes;
|
||||
delete messages;
|
||||
}
|
||||
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
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
|
||||
;
|
||||
|
||||
collection new1 :
|
||||
IPM1S01, IPM1S02, IPM1S03, IPM1S05, IPM1S07,
|
||||
IPM1S08, IPM1S09,
|
||||
device0, device1, device2, device3, device4,
|
||||
device5, device6, device7, device8, device9
|
||||
;
|
||||
Reference in New Issue
Block a user