-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmpvaSetMonitor.m
More file actions
53 lines (47 loc) · 2.13 KB
/
mpvaSetMonitor.m
File metadata and controls
53 lines (47 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function ret = mpvaSetMonitor(pvname)
%
% mpvaSetMonitor subscribes to the given EPICS PV using Python class and stores values in the cache when it is updated.
% The module includes a method to check if the PV is updated since it has
% been subscribed.
%
% PV = mpvaSetMonitor(pvname) # Instantiate a ValueCache classs in mpvaSetMonitor Python module to monitor a pvname
%
% mpvaNewMonitorValue(PV) # Return false if the pvname is not updated. Return true if it is updated.
%
% -----------------------------------------------------------------------------
% Title : mpvaSetMonitor
% -----------------------------------------------------------------------------
% File : mpvaSetMonitor.m
% Author : Kuktae Kim, ktkim@slac.stanford.edu
% Created : 2023-11-02
% Last update: 2023-11-02
% -----------------------------------------------------------------------------
% Description:
% Subscribe to the given EPICS PV using Python class and stores values in
% the cache when it is updated.
% The module includes a method to check if the PV is updated since it has
% been subscribed.
% -----------------------------------------------------------------------------
% This file is part of matpva. It is subject to the license terms in the
% LICENSE.txt file found in the top-level directory of this distribution
% and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
% No part of matpva, including this file, may be copied, modified,
% propagated, or distributed except according to the terms contained in
% the LICENSE.txt file.
% -----------------------------------------------------------------------------
% Check if the pvname is valid
try
mpvaGet(pvname);
catch
msg = 'Please check if pvname is valid or the PV is alive';
error(msg)
end
% Add matpva module directory to Python search path
path = [getenv('EPICS_EXTENSIONS') '/../matpva/current'];
if count(py.sys.path,path) == 0
insert(py.sys.path,int32(0),path);
end
MatP4P = py.p4p.client.thread.Context('pva', pyargs('nt', false));
% Return ValueCache class in mpvaSetMonitor Python module
ret = py.mpvaSetMonitor.ValueCache(MatP4P, pvname);
end