EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: caPutLog support for gateway
From: "Konrad, Martin" <[email protected]>
To: "[email protected]" <[email protected]>, "[email protected]" <[email protected]>
Cc: "Priller, John" <[email protected]>
Date: Wed, 26 Mar 2014 13:57:33 +0000
Hi Ben, Hi Andrew!

I'd like to bring your attention to two patches John Priller has 
developed for caPutLog and cagateway:

1. This patch makes a few modifications to caPutLog to allow it to be 
used by non-IOC applications like cagateway. See attached patch or [1] 
for details.

2. This patch adds the option to use caPutLog with the gateway. See [2] 
for details.

Note that patch 2 requires patch 1 to be merged.

Best regards,

Martin

[1] https://stash.nscl.msu.edu/users/konrad/repos/caputlog/commits
[2] 
https://code.launchpad.net/~info-martin-konrad/+junk/epics-gateway-putlog

-- 
Martin Konrad
Control System Engineer
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824-1321, USA
Tel. 517-908-7253
Email: [email protected]
From c957b6bd993db31ecef0368f25307c2a89d495ae Mon Sep 17 00:00:00 2001
From: John Priller <[email protected]>
Date: Fri, 7 Mar 2014 15:49:43 +0000
Subject: [PATCH] Additions/modifications to allow use with non-IOC
 applications

---
 caPutLogApp/Makefile       |  8 ++++++++
 caPutLogApp/caPutLogAs.c   | 14 +++++++++++++-
 caPutLogApp/caPutLogAs.h   |  3 +++
 caPutLogApp/caPutLogTask.c | 15 ++++++++++++---
 caPutLogApp/caPutLogTask.h |  2 +-
 5 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/caPutLogApp/Makefile b/caPutLogApp/Makefile
index 3242e70..7faeb67 100644
--- a/caPutLogApp/Makefile
+++ b/caPutLogApp/Makefile
@@ -13,6 +13,14 @@ caPutLog_SRCS += caPutLogShellCommands.c
 
 INC = caPutLog.h
 
+# added caPutLogTask.h so external callers have definition
+# of LOGDATA struct
+INC += caPutLogTask.h
+
+# added caPutLogAs.h so external callers have definition
+# of caPutLogDataCalloc function
+INC += caPutLogAs.h
+
 DBD += caPutLog.dbd
 
 include $(TOP)/configure/RULES
diff --git a/caPutLogApp/caPutLogAs.c b/caPutLogApp/caPutLogAs.c
index fe2d94e..d52e83f 100644
--- a/caPutLogApp/caPutLogAs.c
+++ b/caPutLogApp/caPutLogAs.c
@@ -32,6 +32,10 @@
  *				time stamp. If less than current then set current
  *				time for the time stamp in registering structure.
  *	12/12/02	kor	Added caPutLogVersion() routine.
+ *	
+ *	03/13/14	jp	added caPutLogDataCalloc() so non-IOC tasks
+ *				like pv gateway can use this module to log
+ *				puts.
  */
 #include <stdlib.h>
 #include <stddef.h>
@@ -100,7 +104,7 @@ static void caPutLogAs(asTrapWriteMessage *pmessage, int afterPut)
     long status;
 
     if (!afterPut) {                    /* before put */
-        plogData = freeListCalloc(logDataFreeList);
+        plogData = caPutLogDataCalloc();
         if (plogData == NULL) {
             errlogPrintf("caPutLog: memory allocation failed\n");
             pmessage->userPvt = NULL;
@@ -160,3 +164,11 @@ void caPutLogDataFree(LOGDATA *plogData)
 {
     freeListFree(logDataFreeList, plogData);
 }
+
+/* added for use by non-IOC clients like pv gateway */
+/* these need a LOGDATA struct pointer from our logDataFreeList to send to caPutLogTaskSend() */
+LOGDATA* caPutLogDataCalloc(void)
+{
+  return freeListCalloc(logDataFreeList);
+}
+
diff --git a/caPutLogApp/caPutLogAs.h b/caPutLogApp/caPutLogAs.h
index 98b110d..9f0357d 100644
--- a/caPutLogApp/caPutLogAs.h
+++ b/caPutLogApp/caPutLogAs.h
@@ -13,6 +13,9 @@ epicsShareFunc int epicsShareAPI caPutLogAsInit();
 epicsShareFunc void epicsShareAPI caPutLogAsStop();
 epicsShareFunc void epicsShareAPI caPutLogDataFree(LOGDATA *pLogData);
 
+/* added for non-IOC clients like pv gateway to log puts */
+epicsShareFunc LOGDATA* epicsShareAPI caPutLogDataCalloc(void);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/caPutLogApp/caPutLogTask.c b/caPutLogApp/caPutLogTask.c
index b8ca4af..2d1d2aa 100644
--- a/caPutLogApp/caPutLogTask.c
+++ b/caPutLogApp/caPutLogTask.c
@@ -36,6 +36,7 @@
  *				or for puts changing value.
  *	12/12/02	kor	Added RngLogTaskVersio request
  *	
+ *	03/24/14	jp	filled in val_dump()
  */
 
 #include <stdlib.h>
@@ -544,18 +545,26 @@ static int val_to_string(char *pbuf, size_t buflen, const VALUE *pval, short typ
 
 static void val_dump(LOGDATA *pdata)
 {
+  char oldbuf[512], newbuf[512], timebuf[64];
+
     printf("pdata = %p\n", pdata);
     if (!pdata) {
         printf("pdata = NULL\n");
     }
     else {
+        strcpy(oldbuf,"(conv fail)");
+        strcpy(newbuf,"(conv fail)");
+        strcpy(timebuf,"(strftime fail)");
+        val_to_string(oldbuf,sizeof(oldbuf),&pdata->old_value,pdata->type);
+        val_to_string(newbuf,sizeof(newbuf),&pdata->new_value.value,pdata->type);
+        epicsTimeToStrftime(timebuf,sizeof(timebuf),"%Y-%m-%dT%H:%M:%S",&pdata->new_value.time);
         printf("userid = %s\n", pdata->userid);
         printf("hostid = %s\n", pdata->hostid);
         printf("pv_name = %s\n", pdata->pv_name);
         printf("pfield = %p\n", pdata->pfield);
         printf("type = %d\n", pdata->type);
-        printf("old_value = --\n");
-        printf("new_value.time = --\n");
-        printf("new_value.value = --\n");
+        printf("old_value = %s\n", oldbuf);
+        printf("new_value.time = %s\n", timebuf);
+        printf("new_value.value = %s\n", newbuf);
     }
 }
diff --git a/caPutLogApp/caPutLogTask.h b/caPutLogApp/caPutLogTask.h
index 6f48610..097b2c6 100644
--- a/caPutLogApp/caPutLogTask.h
+++ b/caPutLogApp/caPutLogTask.h
@@ -6,7 +6,7 @@
 #include <epicsTime.h>
 
 #ifdef __cplusplus
-epicsShareFunc "C" {
+extern "C" {
 #endif
 
 #define MAX_USERID_SIZE 32
-- 
1.8.3.2


Replies:
Re: caPutLog support for gateway Ralph Lange
Re: caPutLog support for gateway Benjamin Franksen

Navigate by Date:
Prev: Re: Jenkins build is back to normal : epics-base-3.15-win64s #2 Andrew Johnson
Next: Re: caPutLog support for gateway Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Jenkins build is back to normal : epics-base-3.15-win64s #2 Andrew Johnson
Next: Re: caPutLog support for gateway Ralph Lange
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 May 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·