add dbSubExample
This commit is contained in:
@@ -15,7 +15,9 @@ include $(TOP)/configure/CONFIG
|
||||
#----------------------------------------------------
|
||||
# Create and install (or just install)
|
||||
# databases, templates, substitutions like this
|
||||
DB += dbExample1.db dbExample2.db
|
||||
DB += dbExample1.db
|
||||
DB += db dbExample2.db
|
||||
DB += dbSubExample.db
|
||||
|
||||
#----------------------------------------------------
|
||||
# Declare template files which do not show up in DB
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
record(sub,"$(user):subExample")
|
||||
{
|
||||
field(INAM,"mySubInit")
|
||||
field(SNAM,"mySubProcess")
|
||||
}
|
||||
@@ -35,6 +35,7 @@ PROD_IOC = example
|
||||
|
||||
example_SRCS += xxxRecord.c
|
||||
example_SRCS += devXxxSoft.c
|
||||
example_SRCS += dbSubExample.cpp
|
||||
|
||||
# <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
|
||||
example_SRCS += example_registerRecordDeviceDriver.cpp
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <registryFunction.h>
|
||||
#include <subRecord.h>
|
||||
|
||||
extern "C" {
|
||||
typedef long (*processMethod)(subRecord *precord);
|
||||
long mySubInit(subRecord *precord,processMethod process);
|
||||
long mySubProcess(subRecord *precord);
|
||||
void mySubRecordFunctionsRegister(void);
|
||||
}
|
||||
|
||||
long mySubInit(subRecord *precord,processMethod process)
|
||||
{
|
||||
printf("%s mySubInit process %p\n",precord->name,process);
|
||||
return(0);
|
||||
}
|
||||
|
||||
long mySubProcess(subRecord *precord)
|
||||
{
|
||||
printf("%s mySubProcess\n",precord->name);
|
||||
return(0);
|
||||
}
|
||||
|
||||
void mySubRecordFunctionsRegister(void)
|
||||
{
|
||||
|
||||
if(!registryFunctionAdd("mySubInit",(REGISTRYFUNCTION)mySubInit))
|
||||
errlogPrintf("mySubRecordFunctionsRegister registryFunctionAdd failed\n");
|
||||
if(!registryFunctionAdd("mySubProcess",(REGISTRYFUNCTION)mySubProcess))
|
||||
errlogPrintf("mySubRecordFunctionsRegister registryFunctionAdd failed\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Register commands on application startup
|
||||
*/
|
||||
class mySubRegister {
|
||||
public:
|
||||
mySubRegister() { mySubRecordFunctionsRegister(); }
|
||||
};
|
||||
static mySubRegister mySubRegisterObj;
|
||||
|
||||
@@ -4,5 +4,6 @@ dbLoadRecords("../../db/dbExample1.db","user=_USER_Host")
|
||||
dbLoadRecords("../../db/dbExample2.db","user=_USER_Host,no=1,scan=1 second")
|
||||
dbLoadRecords("../../db/dbExample2.db","user=_USER_Host,no=2,scan=2 second")
|
||||
dbLoadRecords("../../db/dbExample2.db","user=_USER_Host,no=3,scan=5 second")
|
||||
dbLoadRecords("../../db/dbSubExample.db","user=_USER_Host")
|
||||
iocInit()
|
||||
#seq sncExample,"user=_USER_Host"
|
||||
|
||||
@@ -4,5 +4,6 @@ dbLoadRecords("db/dbExample1.db","user=_USER_")
|
||||
dbLoadRecords("db/dbExample2.db","user=_USER_,no=1,scan=1 second")
|
||||
dbLoadRecords("db/dbExample2.db","user=_USER_,no=2,scan=2 second")
|
||||
dbLoadRecords("db/dbExample2.db","user=_USER_,no=3,scan=5 second")
|
||||
dbLoadRecords("db/dbSubExample.db","user=_USER_")
|
||||
iocInit()
|
||||
#seq sncExample,"user=_USER_"
|
||||
|
||||
@@ -20,6 +20,7 @@ dbLoadRecords("db/dbExample1.db","user=_USER_")
|
||||
dbLoadRecords("db/dbExample2.db","user=_USER_,no=1,scan=1 second")
|
||||
dbLoadRecords("db/dbExample2.db","user=_USER_,no=2,scan=2 second")
|
||||
dbLoadRecords("db/dbExample2.db","user=_USER_,no=3,scan=5 second")
|
||||
dbLoadRecords("db/dbSubExample.db","user=_USER_")
|
||||
|
||||
cd startup
|
||||
iocInit
|
||||
|
||||
Reference in New Issue
Block a user