modified callback fns for cython
This commit is contained in:
100254
PyCafe.cpp
100254
PyCafe.cpp
File diff suppressed because it is too large
Load Diff
33
PyCafe.h
33
PyCafe.h
@@ -1,4 +1,4 @@
|
||||
/* Generated by Cython 0.23.4 */
|
||||
/* Generated by Cython 0.29.2 */
|
||||
|
||||
#ifndef __PYX_HAVE__PyCafe
|
||||
#define __PYX_HAVE__PyCafe
|
||||
@@ -18,21 +18,28 @@
|
||||
#define DL_IMPORT(_T) _T
|
||||
#endif
|
||||
|
||||
__PYX_EXTERN_C DL_IMPORT(void) cy_data_event_handler_wrapper(void *, unsigned int, std::string, PVDataHolder);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) cy_ctrl_event_handler_wrapper(void *, unsigned int, std::string, PVCtrlHolder);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) cy_event_handler_wrapper(void *, unsigned int, std::string);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) cy_connect_handler_wrapper(void *, unsigned int, std::string, int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_wrapper(PVDataHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_monid_wrapper(unsigned int, unsigned long);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_get_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_put_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_open_wrapper(unsigned int, int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_connect_wrapper(unsigned int, std::string, int);
|
||||
__PYX_EXTERN_C void cy_monitor_handler_wrapper(void *);
|
||||
__PYX_EXTERN_C void cy_data_event_handler_wrapper(void *, unsigned int, std::string, PVDataHolder);
|
||||
__PYX_EXTERN_C void cy_ctrl_event_handler_wrapper(void *, unsigned int, std::string, PVCtrlHolder);
|
||||
__PYX_EXTERN_C void cy_event_handler_wrapper(void *, unsigned int, std::string);
|
||||
__PYX_EXTERN_C void cy_handle_handler_wrapper(void *, unsigned int);
|
||||
__PYX_EXTERN_C void cy_connect_handler_wrapper(void *, unsigned int, std::string, int);
|
||||
__PYX_EXTERN_C void py_cb_wrapper(PVDataHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C void py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C void py_cb_handle_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C void py_cb_handle_monid_wrapper(unsigned int, unsigned long);
|
||||
__PYX_EXTERN_C void cy_cb_handle_get_wrapper(void *, unsigned int);
|
||||
__PYX_EXTERN_C void py_cb_handle_get_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C void cy_cb_handle_put_wrapper(void *, unsigned int);
|
||||
__PYX_EXTERN_C void py_cb_handle_put_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C void py_cb_handle_open_wrapper(unsigned int, int);
|
||||
__PYX_EXTERN_C void py_cb_handle_connect_wrapper(unsigned int, std::string, int);
|
||||
|
||||
#endif /* !__PYX_HAVE_API__PyCafe */
|
||||
|
||||
/* WARNING: the interface of the module init function changed in CPython 3.5. */
|
||||
/* It now returns a PyModuleDef instance instead of a PyModule instance. */
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyMODINIT_FUNC initPyCafe(void);
|
||||
#else
|
||||
|
||||
49170
PyCafe.html
49170
PyCafe.html
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
PyCafe_sls.pxd
|
||||
PyCafe_sf.pxd
|
||||
7371
PyCafe.pyx
7371
PyCafe.pyx
File diff suppressed because it is too large
Load Diff
1
PyCafe.pyx
Symbolic link
1
PyCafe.pyx
Symbolic link
@@ -0,0 +1 @@
|
||||
PyCafe_sf.pyx
|
||||
5496
PyCafeDefs.html
5496
PyCafeDefs.html
File diff suppressed because it is too large
Load Diff
1734
PyCafeDefs_pub.html
1734
PyCafeDefs_pub.html
File diff suppressed because it is too large
Load Diff
@@ -7,22 +7,53 @@ cdef object cbobjt = None
|
||||
# ***********public or api***************
|
||||
# For when with pvdata
|
||||
|
||||
|
||||
cdef public void cy_monitor_handler_wrapper(void * callback) with gil:
|
||||
cbobjt=<object> (<void *> callback)
|
||||
cbobjt()
|
||||
with nogil:
|
||||
return
|
||||
|
||||
|
||||
cdef public void cy_data_event_handler_wrapper(void * callback,
|
||||
unsigned int handle,
|
||||
string pvname,
|
||||
PVDataHolder pvd) with gil:
|
||||
|
||||
global py_cb
|
||||
|
||||
|
||||
#print(" cy_data_event_handler_wrapper=====+++++++++++++++PVDATA++++++(1)= Handle/PVNAME :", handle, pvname)
|
||||
|
||||
#print(" cy_data_event_handler_wrapper=====+++++++++++++++PVDATA++++++(1)= Handle/PVNAME :", handle, pvname)
|
||||
cdef pvdata data = PVDataHolderToStruct(pvd)
|
||||
#data.show()
|
||||
|
||||
py_cb = <object>(<void *> callback)
|
||||
#print(" cy_data_event_handler_wrapper=====+++++++++++++++PVDATA++++++(2)= Handle/PVNAME :", handle, pvname)
|
||||
#print( <object>py_cb)
|
||||
cdef HandleHelper hh
|
||||
mpid = hh.getUsrArgsAsUInt(handle)
|
||||
#print("monitorId", mpid)
|
||||
#monDictGlobal[mpid](handle, pvname, data)
|
||||
<object>py_cb(handle, pvname, data)
|
||||
|
||||
if monDictGlobal[mpid] != <object>py_cb:
|
||||
print( monDictGlobal[mpid])
|
||||
print( <object>py_cb)
|
||||
'''
|
||||
if pvname == b"SARCL01-MQUA100:I-READ":
|
||||
data.show()
|
||||
print(pvname, handle)
|
||||
|
||||
if hmd is not None:
|
||||
for cbobjt, v in hmd.items():
|
||||
|
||||
if v == handle:
|
||||
#print("fire")
|
||||
if pvname == b"SARCL01-MQUA100:I-READ":
|
||||
print("handle", v, "cbobjt", cbobjt)
|
||||
#####cbobjt(handle, pvname, data)
|
||||
monDictGlobal[mpid](handle,pvname,data)
|
||||
|
||||
#print("fired")
|
||||
'''
|
||||
'''
|
||||
global handleMonDictGlobal
|
||||
if handleMonDictGlobal is not None:
|
||||
@@ -31,15 +62,16 @@ cdef public void cy_data_event_handler_wrapper(void * callback,
|
||||
if v == handle:
|
||||
cbobjt(handle, pvname, data)
|
||||
'''
|
||||
'''
|
||||
if callback:
|
||||
cbobjt=<object> (<void *> callback)
|
||||
#print(" cy_data_event_handler_wrapper=====+++++++++++++++PVDATA++++++(3)= Handle/PVNAME :", handle, pvname)
|
||||
print(" cy_data_event_handler_wrapper=====+++++++++++++++PVDATA++++++(3)= Handle/PVNAME :", handle, pvname)
|
||||
cbobjt(handle, pvname, data)
|
||||
#print(" cy_data_event_handler_wrapper=====+++++++++++++++PVDATA++++++(4)= Handle/PVNAME :", handle, pvname)
|
||||
|
||||
print(" cy_data_event_handler_wrapper=====+++++++++++++++PVDATA++++++(4)= Handle/PVNAME :", handle, pvname)
|
||||
'''
|
||||
|
||||
#with nogil:
|
||||
#return
|
||||
with nogil:
|
||||
return
|
||||
|
||||
|
||||
cdef public void cy_ctrl_event_handler_wrapper(void * callback,
|
||||
@@ -54,13 +86,26 @@ cdef public void cy_ctrl_event_handler_wrapper(void * callback,
|
||||
with nogil:
|
||||
return
|
||||
|
||||
cdef public void cy_event_handler_wrapper(void * callback,
|
||||
#cdef public void cy_event_handler_wrapper(void *callback, int *args, string pvname) with gil:
|
||||
cdef public void cy_event_handler_wrapper(void * callback,
|
||||
unsigned int handle,
|
||||
string pvname) with gil:
|
||||
#print(" cy_event_handler_wrapper=====+++++++++++++++HANDLEPV++++++= Handle/PVNAME :", handle, pvname)
|
||||
#(<object>args[0])(<int>args[1], <string>args[2])
|
||||
cbobjt=<object> callback
|
||||
#cbobjt=<object>args[0]
|
||||
cbobjt(handle, pvname)
|
||||
#cbobjt=<object>(<int>args[0], pvname)
|
||||
|
||||
with nogil:
|
||||
return
|
||||
|
||||
cdef public void cy_handle_handler_wrapper(void * callback,
|
||||
unsigned int handle) with gil:
|
||||
#print(" cy_handle_handler_wrapper=====+++++++++++++++HANDLEPV++++++= Handle:", handle)
|
||||
|
||||
cbobjt=<object> callback
|
||||
cbobjt(handle, pvname)
|
||||
cbobjt(handle)
|
||||
with nogil:
|
||||
return
|
||||
|
||||
@@ -85,8 +130,10 @@ cdef public void cy_connect_handler_wrapper(void * callback,
|
||||
with nogil:
|
||||
return
|
||||
|
||||
|
||||
|
||||
cdef public void py_cb_wrapper(PVDataHolder pvd, unsigned int handle, string pvname) with gil:
|
||||
print(" py_cb_wrapper ====================================================+++++++++++++++PVDATA++++++= Handle/PVNAME :", handle, pvname)
|
||||
#print(" py_cb_wrapper ====================================================+++++++++++++++PVDATA++++++= Handle/PVNAME :", handle, pvname)
|
||||
cdef pvdata pv1 = PVDataHolderToStruct(pvd)
|
||||
|
||||
|
||||
@@ -160,8 +207,16 @@ cdef public void py_cb_handle_monid_wrapper(unsigned int handle, unsigned long m
|
||||
return
|
||||
|
||||
|
||||
cdef public void cy_cb_handle_get_wrapper(void * callback, unsigned int handle) with gil:
|
||||
print(" py_cb_handle_get_wrapper ====================================================+++++++++++++GET++++++++++= Handle:", handle)
|
||||
cbobjt=<object> (<void *> callback)
|
||||
cbobjt(handle)
|
||||
with nogil:
|
||||
return
|
||||
|
||||
|
||||
cdef public void py_cb_handle_get_wrapper(unsigned int handle) with gil:
|
||||
#print(" py_cb_handle_get_wrapper ====================================================+++++++++++++GET++++++++++= Handle:", handle)
|
||||
print(" py_cb_handle_get_wrapper ====================================================+++++++++++++GET++++++++++= Handle:", handle)
|
||||
# py_cb_handle_get(handle)
|
||||
global getDictGlobal
|
||||
if handle in getDictGlobal.keys():
|
||||
@@ -173,6 +228,17 @@ cdef public void py_cb_handle_get_wrapper(unsigned int handle) with gil:
|
||||
with nogil:
|
||||
return
|
||||
|
||||
|
||||
cdef public void cy_cb_handle_put_wrapper(void * callback, unsigned int handle) with gil:
|
||||
print(" py_cb_handle_put_wrapper ====================================================+++++++++++++PUT++++++++++= Handle:", handle)
|
||||
|
||||
cbobjt=<object> (<void *> callback)
|
||||
|
||||
cbobjt(handle)
|
||||
with nogil:
|
||||
return
|
||||
|
||||
|
||||
cdef public void py_cb_handle_put_wrapper(unsigned int handle) with gil:
|
||||
#print(" py_cb_handle_put_wrapper ====================================================+++++++++++++PUT++++++++++= Handle:", handle)
|
||||
# py_cb_handle_put(handle)
|
||||
|
||||
14028
PyCafeDefs_sf.html
14028
PyCafeDefs_sf.html
File diff suppressed because it is too large
Load Diff
166071
PyCafe_sf.cpp
166071
PyCafe_sf.cpp
File diff suppressed because it is too large
Load Diff
42
PyCafe_sf.h
42
PyCafe_sf.h
@@ -1,42 +0,0 @@
|
||||
/* Generated by Cython 0.23.4 */
|
||||
|
||||
#ifndef __PYX_HAVE__PyCafe_sf
|
||||
#define __PYX_HAVE__PyCafe_sf
|
||||
|
||||
|
||||
#ifndef __PYX_HAVE_API__PyCafe_sf
|
||||
|
||||
#ifndef __PYX_EXTERN_C
|
||||
#ifdef __cplusplus
|
||||
#define __PYX_EXTERN_C extern "C"
|
||||
#else
|
||||
#define __PYX_EXTERN_C extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DL_IMPORT
|
||||
#define DL_IMPORT(_T) _T
|
||||
#endif
|
||||
|
||||
__PYX_EXTERN_C DL_IMPORT(void) cy_data_event_handler_wrapper(void *, unsigned int, std::string, PVDataHolder);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) cy_ctrl_event_handler_wrapper(void *, unsigned int, std::string, PVCtrlHolder);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) cy_event_handler_wrapper(void *, unsigned int, std::string);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) cy_connect_handler_wrapper(void *, unsigned int, std::string, int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_wrapper(PVDataHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_monid_wrapper(unsigned int, unsigned long);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_get_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_put_wrapper(unsigned int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_open_wrapper(unsigned int, int);
|
||||
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_connect_wrapper(unsigned int, std::string, int);
|
||||
|
||||
#endif /* !__PYX_HAVE_API__PyCafe_sf */
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
PyMODINIT_FUNC initPyCafe_sf(void);
|
||||
#else
|
||||
PyMODINIT_FUNC PyInit_PyCafe_sf(void);
|
||||
#endif
|
||||
|
||||
#endif /* !__PYX_HAVE__PyCafe_sf */
|
||||
54836
PyCafe_sf.html
54836
PyCafe_sf.html
File diff suppressed because it is too large
Load Diff
@@ -600,6 +600,8 @@ cdef extern from "handleHelper.h":
|
||||
|
||||
unsigned int getNmonitor(unsigned int)
|
||||
vector[unsigned int] getMonitorIDs(unsigned int)
|
||||
vector[unsigned int] getMonitorIDsInWaiting(unsigned int)
|
||||
int updateMonitorPolicyDeltaMS(unsigned int, unsigned int, unsigned short)
|
||||
|
||||
int getDataTypeNative (unsigned int, long &)
|
||||
int getDataTypeRequest(unsigned int, long &)
|
||||
@@ -634,11 +636,13 @@ cdef extern from "policies.h":
|
||||
void setHandler(pCallback)
|
||||
void setDefaultHandler()
|
||||
void setNotifyDeltaMilliSeconds(unsigned short)
|
||||
void setNoCyCallbackParameters(unsigned short)
|
||||
void setCyCallback(void *)
|
||||
void setPyHandler()
|
||||
void setPyHandlerData()
|
||||
void setPyCyHandler(void *)
|
||||
void setPyCyHandlerData(void *)
|
||||
void setPyCyHandlerHandle(void *)
|
||||
void setUserArgs(void *)
|
||||
unsigned int getMask()
|
||||
unsigned int getNelem()
|
||||
@@ -679,8 +683,8 @@ cdef extern from "policies.h":
|
||||
pCallback getHandler()
|
||||
int getCallbackStatus()
|
||||
void setHandler(pCallback h)
|
||||
void setPyHandlerGet()
|
||||
void setPyHandlerPut()
|
||||
void setPyHandlerGet(void *)
|
||||
void setPyHandlerPut(void *)
|
||||
void setMethodKind(ChannelRequestPolicyKind)
|
||||
void setWhenToFlushSendBuffer(ChannelWhenToFlushSendBufferPolicyKind)
|
||||
void setWaitKind(ChannelWaitForResponsePolicyKind)
|
||||
|
||||
123
PyCafe_sf.pyx
123
PyCafe_sf.pyx
@@ -512,12 +512,12 @@ cdef class CyCafe:
|
||||
#print("OPEN WITH NO GIL==>", pvStr)
|
||||
with nogil:
|
||||
self._c_cafe.open(pvStr, handle)
|
||||
#print("OPEN WITH NO GIL//==>", pvStr)
|
||||
#print("OPEN WITH NO GIL//==>", pvStr, handle)
|
||||
ELSE:
|
||||
#Gil acquired and released within conduit.h
|
||||
#with nogil:
|
||||
self._c_cafe.open(pvStr, handle)
|
||||
except RuntimeError as e:
|
||||
except RuntimeError as e:
|
||||
# Reset
|
||||
if cb is not None:
|
||||
self._c_cafe.channelCreatePolicy.setPyCallbackFlag(False)
|
||||
@@ -532,7 +532,7 @@ cdef class CyCafe:
|
||||
_error_text=errors[4], _error_info=errors[5])
|
||||
raise _cafeException
|
||||
|
||||
raise Exception("{} {} \n{}".format(self._exception_text, _METHOD, e))
|
||||
raise Exception("{} {} \n{}".format(self._exception_text, _METHOD, e))
|
||||
|
||||
# Reset
|
||||
if cb is not None:
|
||||
@@ -834,7 +834,7 @@ cdef class CyCafe:
|
||||
crp.setMethodKind(method)
|
||||
if cb is not None:
|
||||
getDictGlobal[handle] = cb
|
||||
crp.setPyHandlerGet() # forces when=WITH_CALLBACK_USER_SUPPLIED
|
||||
crp.setPyHandlerGet(<void *> cb) # forces when=WITH_CALLBACK_USER_SUPPLIED
|
||||
|
||||
self.ph.setChannelRequestPolicyGet(handlePV, crp)
|
||||
return
|
||||
@@ -895,7 +895,7 @@ cdef class CyCafe:
|
||||
global getDictGlobal
|
||||
if cb is not None:
|
||||
getDictGlobal[handle] = cb
|
||||
crp.setPyHandlerGet() # forces when=WITH_CALLBACK_USER_SUPPLIED
|
||||
crp.setPyHandlerGet(<void *>cb) # forces when=WITH_CALLBACK_USER_SUPPLIED
|
||||
else:
|
||||
crp.setMethodKind(WITH_CALLBACK_DEFAULT)
|
||||
|
||||
@@ -924,7 +924,7 @@ cdef class CyCafe:
|
||||
global putDictGlobal
|
||||
if cb is not None:
|
||||
putDictGlobal[handle] = cb
|
||||
crp.setPyHandlerPut() # forces when=WITH_CALLBACK_USER_SUPPLIED
|
||||
crp.setPyHandlerPut(<void *>cb) # forces when=WITH_CALLBACK_USER_SUPPLIED
|
||||
else:
|
||||
crp.setMethodKind(WITH_CALLBACK_DEFAULT)
|
||||
|
||||
@@ -1438,7 +1438,7 @@ cdef class CyCafe:
|
||||
############################################################################
|
||||
@verify_handlepv
|
||||
def supplementHandle(self, handlePV):
|
||||
#decorator casts to handlePV to int
|
||||
#decorator casts handlePV to int
|
||||
cdef unsigned int handle = handlePV
|
||||
with nogil:
|
||||
self._c_cafe.supplementHandle(handle)
|
||||
@@ -6013,37 +6013,36 @@ No of group members doe not match the length of callback object list")
|
||||
def isCollection(self, const char * cName):
|
||||
return self._c_cafe.isCollection(cName)
|
||||
|
||||
def getNoMonitors(self, handlePV):
|
||||
cdef str _METHOD = "getNoMonitors(handlePV)"
|
||||
|
||||
cdef unsigned int handle = 0
|
||||
if isinstance(handlePV, (int, long)):
|
||||
handle = handlePV
|
||||
elif isinstance(handlePV, (str)):
|
||||
handle = self.checkForHandle(handlePV)
|
||||
else:
|
||||
_cafeException = CafeException(_type='CafeError', _source=_METHOD,
|
||||
_error_info="First input argument, should be of type <class 'int'> if handle, else <class 'str'> if PV")
|
||||
raise _cafeException
|
||||
##################################################################################
|
||||
@verify_handlepv
|
||||
def getNoMonitors(self, handlePV):
|
||||
cdef unsigned int handle = handlePV
|
||||
return self.hh.getNmonitor(handle)
|
||||
##################################################################################
|
||||
|
||||
##################################################################################
|
||||
def getMonitorIDs(self, handlePV):
|
||||
cdef str _METHOD = "getMonitorIDs(handlePV)"
|
||||
cdef unsigned int handle = 0
|
||||
if isinstance(handlePV, (int, long)):
|
||||
handle = handlePV
|
||||
elif isinstance(handlePV, (str)):
|
||||
handle = self.checkForHandle(handlePV)
|
||||
else:
|
||||
_cafeException = CafeException(_type='CafeError', _source=_METHOD,
|
||||
_error_info="First input argument, should be of type <class 'int'> if handle, else <class 'str'> if PV")
|
||||
raise _cafeException
|
||||
|
||||
##################################################################################
|
||||
@verify_handlepv
|
||||
def getMonitorIDsInWaiting(self, handlePV):
|
||||
cdef unsigned int handle = handlePV
|
||||
return self.hh.getMonitorIDsInWaiting(handle)
|
||||
############################################################################
|
||||
|
||||
|
||||
##################################################################################
|
||||
@verify_handlepv
|
||||
def getMonitorIDs(self, handlePV):
|
||||
cdef unsigned int handle = handlePV
|
||||
return self.hh.getMonitorIDs(handle)
|
||||
############################################################################
|
||||
|
||||
@verify_handlepv
|
||||
def updateMonitorPolicyDeltaMS(
|
||||
self, handlePV, unsigned int monid=0, unsigned int deltaMS=0):
|
||||
cdef unsigned int handle = handlePV
|
||||
self.hh.updateMonitorPolicyDeltaMS(handle, monid, deltaMS)
|
||||
|
||||
|
||||
############################################################################
|
||||
def monitor(
|
||||
self, handlePV, object cb=None, DBR_TYPE dbr=DBR_TIME,
|
||||
@@ -6127,9 +6126,10 @@ No of group members doe not match the length of callback object list")
|
||||
if cb is not None:
|
||||
#Cement to a global dictionary
|
||||
hmd[cb] = handle ##otherwise cb gets ovewritten when casting to an object
|
||||
monDictGlobal[mpid] = cb
|
||||
#print(hmd)
|
||||
sig = inspect.signature(cb)
|
||||
'''
|
||||
'''
|
||||
print('SIGNATURE//3//:')
|
||||
print(str(sig))
|
||||
for param in sig.parameters.values():
|
||||
@@ -6138,33 +6138,35 @@ No of group members doe not match the length of callback object list")
|
||||
print('len2', len(sig.parameters))
|
||||
|
||||
print('monitorid', mpid)
|
||||
'''
|
||||
'''
|
||||
|
||||
# The corresponding setPyHandler has to be set!!
|
||||
|
||||
mp.setUserArgs(< void * > mpid)
|
||||
mp.setNoCyCallbackParameters(len(sig.parameters))
|
||||
mp.setPyCyHandler(<void *> cb)
|
||||
|
||||
|
||||
'''
|
||||
if len(sig.parameters) == 1:
|
||||
###monDictGlobal[mpid] = cb
|
||||
|
||||
mp.setPyHandler()
|
||||
#monDictGlobal[mpid] = cb
|
||||
mp.setPyCyHandlerHandle(<void *> cb) #handle
|
||||
##mp.setPyHandler()
|
||||
# print (<long>mp.getUserArgs())
|
||||
|
||||
elif len(sig.parameters) == 2:
|
||||
mp.setPyCyHandler(<void *> cb)
|
||||
mp.setPyCyHandler(<void *> cb) #handle, pvname, pvdata
|
||||
#mp.setPyHandler()
|
||||
#mp.setCyCallback(<void *> cb)
|
||||
|
||||
|
||||
elif len(sig.parameters) == 3:
|
||||
#py_cb=cb
|
||||
#self.hh.addWidget(handle, <void *> cb)
|
||||
|
||||
mp.setPyCyHandlerData(<void *> ( py_cb))
|
||||
#handleMonDictGlobal[cb] = handle
|
||||
|
||||
##print(py_cb)
|
||||
mp.setPyCyHandlerData(<void *> ( py_cb)) #handle, pvname, pvdata
|
||||
#handleMonDictGlobal[cb] = handle
|
||||
#mp.setPyHandlerData()
|
||||
#mp.setCyCallback(<void *> cb)
|
||||
|
||||
else:
|
||||
_cafeException = CafeException(
|
||||
_type='CafeError', _source=_METHOD,
|
||||
@@ -6172,7 +6174,7 @@ No of group members doe not match the length of callback object list")
|
||||
given by the user is not supported. Valid fns are: \
|
||||
1) callback(handle) or 2) callback(pvdata, handle, pv_name) ")
|
||||
raise _cafeException
|
||||
|
||||
'''
|
||||
with nogil:
|
||||
status = self._c_cafe.monitorStart(handle, mp)
|
||||
|
||||
@@ -6220,19 +6222,22 @@ No of group members doe not match the length of callback object list")
|
||||
if mpid:
|
||||
if isinstance(mpid, (int, long)):
|
||||
mpidUI = mpid
|
||||
|
||||
with nogil:
|
||||
status = self._c_cafe.monitorStopWithID(handle, mpidUI)
|
||||
time.sleep(0.01)
|
||||
time.sleep(0.02)
|
||||
|
||||
|
||||
if (status == ICAFE_NORMAL):
|
||||
#if (status == ICAFE_NORMAL):
|
||||
#pass
|
||||
#print (monDictGlobal)
|
||||
# DELETE ENTRY ONLY IF IT EXISTS!
|
||||
# if monDictGlobal.has_key(mpidUI):
|
||||
# Sep 2020 - try without del for testing!
|
||||
if mpidUI in monDictGlobal.keys():
|
||||
del monDictGlobal[mpidUI]
|
||||
|
||||
##if mpidUI in monDictGlobal.keys():
|
||||
##print("deleted monID/1/ ", mpidUI, monDictGlobal[mpidUI])
|
||||
##del monDictGlobal[mpidUI]
|
||||
|
||||
else:
|
||||
raise Exception("EXCEPTION RAISED IN PyCafe def monitorStop. \n \
|
||||
monitorPolicy ID (mpid) should be of type <class 'int'>")
|
||||
@@ -6249,9 +6254,16 @@ No of group members doe not match the length of callback object list")
|
||||
for i in range (0, _ncount):
|
||||
try:
|
||||
l = list(hmd.keys())[list(hmd.values()).index(handle)]
|
||||
#print (l)
|
||||
|
||||
|
||||
if l is not None:
|
||||
del hmd[l]
|
||||
if mpid in monDictGlobal.keys():
|
||||
###print("deleted monID/1/ ", mpid, monDictGlobal[mpid])
|
||||
#######JCdel monDictGlobal[mpid]
|
||||
if l == monDictGlobal[mpid]:
|
||||
|
||||
del hmd[l]
|
||||
del monDictGlobal[mpid]
|
||||
except ValueError:
|
||||
print("List does not contain handle {0}".format(handle))
|
||||
#{k:v for k,v in hmd.items() if v != handle}
|
||||
@@ -6264,14 +6276,15 @@ No of group members doe not match the length of callback object list")
|
||||
|
||||
# print "size", self.hh.getNmonitor(handle)
|
||||
mpidUIV = self.hh.getMonitorIDs(handle)
|
||||
# print "size", mpidUIV.size()
|
||||
|
||||
|
||||
'''
|
||||
for i in range(0, mpidUIV.size()):
|
||||
|
||||
print("Deleting here too i from monid/4/", i, mpidUIV[i])
|
||||
# if monDictGlobal.has_key(mpidUIV[i]):
|
||||
if mpidUIV[i] in monDictGlobal.keys():
|
||||
del monDictGlobal[mpidUIV[i]]
|
||||
|
||||
print("Deleting here too/5/", mpidUIV[i])
|
||||
'''
|
||||
if status != ICAFE_NORMAL:
|
||||
if PYCAFE_PRINT_LEVEL >= PYCAFE_PRINT_LOW:
|
||||
if handle == 0:
|
||||
|
||||
@@ -600,6 +600,8 @@ cdef extern from "handleHelper.h":
|
||||
|
||||
unsigned int getNmonitor(unsigned int)
|
||||
vector[unsigned int] getMonitorIDs(unsigned int)
|
||||
vector[unsigned int] getMonitorIDsInWaiting(unsigned int)
|
||||
int updateMonitorPolicyDeltaMS(unsigned int, unsigned int, unsigned short)
|
||||
|
||||
int getDataTypeNative (unsigned int, long &)
|
||||
int getDataTypeRequest(unsigned int, long &)
|
||||
|
||||
7372
PyCafe_sls.pyx
Normal file
7372
PyCafe_sls.pyx
Normal file
File diff suppressed because it is too large
Load Diff
9
build_py37_sf_local.sh
Normal file
9
build_py37_sf_local.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
module unload gcc
|
||||
module load gcc/7.3.0
|
||||
rm -f PyCafe_sf.cpp
|
||||
rm -f PyCafe_sf.h
|
||||
rm -f PyCafe.pxd
|
||||
ln -s PyCafe_sf.pxd PyCafe.pxd
|
||||
source /opt/gfa/python 3.7
|
||||
python setup_py37_sf_local.py build_ext -b ./python3.7-sf/lib/${EPICS_HOST_ARCH}
|
||||
cp examples.py ./python3.7-sf/lib/${EPICS_HOST_ARCH}
|
||||
@@ -8,7 +8,7 @@ from Cython.Build import cythonize
|
||||
from numpy import get_include
|
||||
|
||||
setup(
|
||||
ext_modules = cythonize([Extension('PyCafe',['PyCafe_sf.pyx'],
|
||||
ext_modules = cythonize([Extension('PyCafe',['PyCafe.pyx'],
|
||||
language="c++",
|
||||
include_dirs=[ '/opt/gfa/python-3.5/latest/include/python3.5m',
|
||||
os.environ['EPICS'] + '/base/include',
|
||||
|
||||
@@ -8,7 +8,7 @@ from Cython.Build import cythonize
|
||||
from numpy import get_include
|
||||
|
||||
setup(
|
||||
ext_modules = cythonize([Extension('PyCafe',['PyCafe_sf.pyx'],
|
||||
ext_modules = cythonize([Extension('PyCafe',['PyCafe.pyx'],
|
||||
language="c++",
|
||||
include_dirs=[ '/opt/gfa/python-3.7/latest/include/python3.7m',
|
||||
os.environ['EPICS'] + '/base/include',
|
||||
|
||||
51
setup_py37_sf_local.py
Normal file
51
setup_py37_sf_local.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import os
|
||||
import sys
|
||||
from distutils.core import setup
|
||||
from distutils.extension import Extension
|
||||
from Cython.Compiler.Main import default_options
|
||||
default_options['emit_linenums'] = True
|
||||
from Cython.Build import cythonize
|
||||
from numpy import get_include
|
||||
|
||||
setup(
|
||||
ext_modules = cythonize([Extension('PyCafe',['PyCafe.pyx'],
|
||||
language="c++",
|
||||
include_dirs=[ '/opt/gfa/python-3.7/latest/include/python3.7m',
|
||||
os.environ['EPICS'] + '/base/include',
|
||||
os.environ['EPICS'] + '/base/include/os/Linux',
|
||||
'/opt/gfa/cafe/boost/boost_1_61_0/include',
|
||||
'/opt/gfa/cafe/boost/boost_1_61_0/include/boost',
|
||||
'/opt/gfa/cafe/cpp/cafe-1.14.0-sf-py37-gcc-7.3.0/include',
|
||||
'/opt/gfa/zmq/zeromq-4.2.3-gcc-6.3.0/include',
|
||||
'/opt/gfa/zmq/curl-7.54.1/include',
|
||||
'/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/include',
|
||||
'.', get_include()],
|
||||
library_dirs=[ os.environ['EPICS'] + '/base/lib/' + os.environ['EPICS_HOST_ARCH'],
|
||||
'/opt/gfa/cafe/cpp/cafe-1.14.0-sf-py37-gcc-7.3.0/lib/' + os.environ['EPICS_HOST_ARCH'],
|
||||
'/opt/gfa/zmq/zeromq-4.2.3-gcc-6.3.0/lib',
|
||||
'/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-6.3.0',
|
||||
'/opt/gfa/zmq/curl-7.54.1/lib',
|
||||
'/opt/gfa/python-3.7/latest/lib',
|
||||
os.environ['PSI_PREFIX'] + '/Programming/gcc/7.3.0/lib64',
|
||||
os.environ['PSI_PREFIX'] + '/Programming/gcc/7.3.0/lib'
|
||||
],
|
||||
runtime_library_dirs=[
|
||||
os.environ['EPICS'] + '/base/lib/' + os.environ['EPICS_HOST_ARCH'],
|
||||
'/opt/gfa/cafe/cpp/cafe-1.14.0-sf-py37-gcc-7.3.0/lib/' + os.environ['EPICS_HOST_ARCH'],
|
||||
'/opt/gfa/zmq/zeromq-4.2.3-gcc-6.3.0/lib',
|
||||
'/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-6.3.0',
|
||||
'/opt/gfa/zmq/curl-7.54.1/lib',
|
||||
'/opt/gfa/python-3.7/latest/lib',
|
||||
os.environ['PSI_PREFIX'] + '/Programming/gcc/7.3.0/lib64',
|
||||
os.environ['PSI_PREFIX'] + '/Programming/gcc/7.3.0/lib'
|
||||
],
|
||||
libraries=['ca','Com','dl','cafe'])
|
||||
], annotate=True,
|
||||
compiler_directives={'embedsignature': False, 'language_level': 3,
|
||||
'c_string_type': 'str', 'c_string_encoding' : 'ascii',
|
||||
'py2_import': False, 'warn.unreachable': False,
|
||||
'remove_unreachable': False},
|
||||
compile_time_env={'PY_VERSION_HEX':sys.hexversion,
|
||||
'PY_EXT_C': True, 'BS_CAFE': True }
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user