Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions caPutLogApp/CONFIG_CAPUTLOG

This file was deleted.

5 changes: 1 addition & 4 deletions caPutLogApp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@ INC += caPutLogAs.h
DBD += caPutLog.dbd

# Add support for json format and arrays
# This requires EPICS base version 7.0.1 or higher
# This requires EPICS 7
ifdef BASE_7_0
USR_CPPFLAGS += -DJSON_AND_ARRAYS_SUPPORTED
caPutLog_SRCS += caPutJsonLogTask.cpp
caPutLog_SRCS += caPutJsonLogShellCommands.cpp
INC += caPutJsonLogTask.h
DBD += caPutJsonLog.dbd
endif

# Install config file for applications
CFG += CONFIG_CAPUTLOG

caPutLog_LIBS += $(EPICS_BASE_IOC_LIBS)
caPutLog_SYS_LIBS_WIN32 += ws2_32
Expand Down
20 changes: 4 additions & 16 deletions caPutLogApp/caPutLogAs.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@
#include <asTrapWrite.h>
#include <epicsVersion.h>

#define BASE_3_14 (EPICS_VERSION * 100 + EPICS_REVISION < 315)

#if !(BASE_3_14)
#include "dbChannel.h"
#endif

#define epicsExportSharedSymbols
#include "caPutLog.h"
Expand Down Expand Up @@ -114,13 +110,9 @@ void caPutLogAsStop()

static void caPutLogAs(asTrapWriteMessage *pmessage, int afterPut)
{
#if BASE_3_14
dbAddr *paddr = pmessage->serverSpecific;
#else
struct dbChannel *pchan = pmessage->serverSpecific;
dbAddr *paddr = &pchan->addr;
const char *pv_name = pchan->name;
#endif
LOGDATA *plogData;
long options, num_elm;
long status;
Expand All @@ -143,11 +135,7 @@ static void caPutLogAs(asTrapWriteMessage *pmessage, int afterPut)

epicsSnprintf(plogData->userid, MAX_USERID_SIZE, "%s", pmessage->userid);
epicsSnprintf(plogData->hostid, MAX_HOSTID_SIZE, "%s", pmessage->hostid);
#if BASE_3_14
dbNameOfPV(paddr, plogData->pv_name, PVNAME_STRINGSZ);
#else
epicsSnprintf(plogData->pv_name, PVNAME_STRINGSZ, "%s", pv_name);
#endif

if (VALID_DB_REQ(paddr->field_type)) {
plogData->type = paddr->field_type;
Expand Down Expand Up @@ -201,9 +189,7 @@ static void caPutLogAs(asTrapWriteMessage *pmessage, int afterPut)

int caPutLogMaxArraySize(short type)
{
#if !JSON_AND_ARRAYS_SUPPORTED
return 1;
#else
#if EPICS_VERSION >= 7
static int const arraySizeLookUpTable [] = {
MAX_ARRAY_SIZE_BYTES/MAX_STRING_SIZE, /* DBR_STRING */
MAX_ARRAY_SIZE_BYTES/sizeof(epicsInt8), /* DBR_CHAR */
Expand All @@ -222,9 +208,11 @@ int caPutLogMaxArraySize(short type)
if (type >= DBR_STRING || type <= DBR_ENUM){
return arraySizeLookUpTable[type];
} else {
errlogSevPrintf(errlogMajor, "caPutLogAs: Array size for type %d can not be determind\n", type);
errlogSevPrintf(errlogMajor, "caPutLogAs: Array size for type %d can not be determined\n", type);
return 1;
}
#else
return 1;
#endif
}

Expand Down
5 changes: 3 additions & 2 deletions caPutLogApp/caPutLogTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <shareLib.h>
#include <dbDefs.h>
#include <epicsTime.h>
#include <epicsVersion.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -12,7 +13,7 @@ extern "C" {
#define MAX_USERID_SIZE 32
#define MAX_HOSTID_SIZE 256

#if JSON_AND_ARRAYS_SUPPORTED
#if EPICS_VERSION >= 7
#define MAX_ARRAY_SIZE_BYTES 400
#else
#define MAX_ARRAY_SIZE_BYTES 0
Expand All @@ -35,7 +36,7 @@ typedef union {
epicsFloat64 v_double;
char v_string[MAX_STRING_SIZE];

#if JSON_AND_ARRAYS_SUPPORTED
#if EPICS_VERSION >= 7
epicsInt8 a_int8[MAX_ARRAY_SIZE_BYTES/sizeof(epicsInt8)];
epicsUInt8 a_uint8[MAX_ARRAY_SIZE_BYTES/sizeof(epicsUInt8)];
epicsInt16 a_int16[MAX_ARRAY_SIZE_BYTES/sizeof(epicsInt16)];
Expand Down