Accelerator Independent Data Access / PVAccess 2.0
AIDA-PVA is the latest version of the AIDA framework. Built on top of EPICS 7 it enables client applications to programmatically access and manage any device or database on the SLAC Network using simple channel names.
Loading...
Searching...
No Matches
aida_pva_api.h
Go to the documentation of this file.
1/** @file
2 * @brief The Header File for the Channel Provider API endpoints and endpoint-stubs MACROS.
3 * **CMS**=C_INC
4 */
5#ifndef aida_pva_api_h
6#define aida_pva_api_h
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#include <jni.h>
12#include <descrip.h> /* for definition of $DESCRIPTOR */
13#include <stdbool.h>
14#include <stsdef.h> /* Macros for handling VMS status */
15
16#include "slc_macros.h"
17#include "msg_proto.h" /* for standalone_init */
18#include "errtranslate.h"
19#include "aida_pva_json.h"
20#include "ref.h" /* passing by reference macros */
21#include "process_parm.h"
22
23#include "aida_pva.h"
24
25/**
26 * Initialise the aida service. Called once by the framework when starting up.
27 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
28 */
29void aidaServiceInit(JNIEnv* env);
30
31/**
32 * Function provided by all providers to give the version string.
33 * @return the version string
34 */
35char * getVersion();
36
37/**
38 * Use this macro to define the version of the provider
39 */
40#define VERSION(_version) char *getVersion() { \
41 return _version ; \
42}
43
44/**
45 * Get a table of data.
46 *
47 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
48 * @param uri the uri
49 * @param arguments the arguments
50 * @return the table
51 */
52Table aidaRequestTable(JNIEnv* env, const char* uri, Arguments arguments);
53
54/**
55 * Get a boolean.
56 *
57 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
58 * @param uri the uri
59 * @param arguments the arguments
60 * @return the boolean
61 */
62int aidaRequestBoolean(JNIEnv* env, const char* uri, Arguments arguments);
63
64/**
65 * Get a byte.
66 *
67 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
68 * @param uri the uri
69 * @param arguments the arguments
70 * @return the byte
71 */
72char aidaRequestByte(JNIEnv* env, const char* uri, Arguments arguments);
73
74/**
75 * Get a short
76 *
77 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
78 * @param uri the uri
79 * @param arguments the arguments
80 * @return the short
81 */
82short aidaRequestShort(JNIEnv* env, const char* uri, Arguments arguments);
83
84/**
85 * Get a integer
86 *
87 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
88 * @param uri the uri
89 * @param arguments the arguments
90 * @return the integer
91 */
92int aidaRequestInteger(JNIEnv* env, const char* uri, Arguments arguments);
93
94/**
95 * Get a long
96 *
97 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
98 * @param uri the uri
99 * @param arguments the arguments
100 * @return the long
101 */
102long aidaRequestLong(JNIEnv* env, const char* uri, Arguments arguments);
103
104/**
105 * Get a float
106 *
107 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
108 * @param uri the uri
109 * @param arguments the arguments
110 * @return the float
111 */
112float aidaRequestFloat(JNIEnv* env, const char* uri, Arguments arguments);
113
114/**
115 * Get a double
116 *
117 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
118 * @param uri the uri
119 * @param arguments the arguments
120 * @return the double
121 */
122double aidaRequestDouble(JNIEnv* env, const char* uri, Arguments arguments);
123
124/**
125 * Get a string
126 *
127 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
128 * @param uri the uri
129 * @param arguments the arguments
130 * @return the string
131 */
132char* aidaRequestString(JNIEnv* env, const char* uri, Arguments arguments);
133
134/**
135 * Get a boolean array
136 *
137 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
138 * @param uri the uri
139 * @param arguments the arguments
140 * @return the boolean array
141 */
142Array aidaRequestBooleanArray(JNIEnv* env, const char* uri, Arguments arguments);
143
144/**
145 * Get a byte array
146 *
147 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
148 * @param uri the uri
149 * @param arguments the arguments
150 * @return the byte array
151 */
152Array aidaRequestByteArray(JNIEnv* env, const char* uri, Arguments arguments);
153
154/**
155 * Get a short array
156 *
157 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
158 * @param uri the uri
159 * @param arguments the arguments
160 * @return the short array
161 */
162Array aidaRequestShortArray(JNIEnv* env, const char* uri, Arguments arguments);
163
164/**
165 * Get a integer array
166 *
167 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
168 * @param uri the uri
169 * @param arguments the arguments
170 * @return the integer array
171 */
172Array aidaRequestIntegerArray(JNIEnv* env, const char* uri, Arguments arguments);
173
174/**
175 * Get a long array
176 *
177 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
178 * @param uri the uri
179 * @param arguments the arguments
180 * @return the long array
181 */
182Array aidaRequestLongArray(JNIEnv* env, const char* uri, Arguments arguments);
183
184/**
185 * Get a float array
186 *
187 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
188 * @param uri the uri
189 * @param arguments the arguments
190 * @return the float array
191 */
192Array aidaRequestFloatArray(JNIEnv* env, const char* uri, Arguments arguments);
193
194/**
195 * Get a double array
196 *
197 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
198 * @param uri the uri
199 * @param arguments the arguments
200 * @return the double array
201 */
202Array aidaRequestDoubleArray(JNIEnv* env, const char* uri, Arguments arguments);
203
204/**
205 * Get a string array
206 *
207 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
208 * @param uri the uri
209 * @param arguments the arguments
210 * @return the string array
211 */
212StringArray aidaRequestStringArray(JNIEnv* env, const char* uri, Arguments arguments);
213
214/**
215 * Set a value
216 *
217 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
218 * @param uri the uri
219 * @param arguments the arguments
220 * @param value to set
221 */
222void aidaSetValue(JNIEnv* env, const char* uri, Arguments arguments, Value value);
223
224/**
225 * Set a value and return a table as a response
226 *
227 * @param env to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException()
228 * @param uri the uri
229 * @param arguments the arguments
230 * @param value to set
231 * @return a table
232 */
233Table aidaSetValueWithResponse(JNIEnv* env, const char* uri, Arguments arguments, Value value);
234
235/**
236 * API stub for AIDA-PVA scalar requests
237 *
238 * @param _api the name of the API to define
239 * @param _rtype the type that this API will return
240 * @param _r the specified return value
241 * @return This MACRO will create a function stub that will return the specified return value
242 */
243#define REQUEST_STUB_SCALAR(_api, _rtype, _r) \
244_rtype _api(JNIEnv* env, const char* uri, Arguments arguments) \
245{ \
246 aidaThrowNonOsException(env, UNSUPPORTED_CHANNEL_EXCEPTION, uri); \
247 return (_r); \
248}
249
250/**
251 * aidaRequestBoolean API Stub
252 */
253#define REQUEST_STUB_BOOLEAN REQUEST_STUB_SCALAR(aidaRequestBoolean, int, 0)
254
255
256/**
257 * aidaRequestByte API Stub
258 */
259#define REQUEST_STUB_BYTE REQUEST_STUB_SCALAR(aidaRequestByte, char, 0x0)
260
261/**
262 * aidaRequestShort API Stub
263 */
264#define REQUEST_STUB_SHORT REQUEST_STUB_SCALAR(aidaRequestShort, short, 0)
265
266/**
267 * aidaRequestInteger API Stub
268 */
269#define REQUEST_STUB_INTEGER REQUEST_STUB_SCALAR(aidaRequestInteger, int, 0)
270
271/**
272 * aidaRequestLong API Stub
273 */
274#define REQUEST_STUB_LONG REQUEST_STUB_SCALAR(aidaRequestLong, long, 0)
275
276/**
277 * aidaRequestFloat API Stub
278 */
279#define REQUEST_STUB_FLOAT REQUEST_STUB_SCALAR(aidaRequestFloat, float, 0.0f)
280
281/**
282 * aidaRequestDouble API Stub
283 */
284#define REQUEST_STUB_DOUBLE REQUEST_STUB_SCALAR(aidaRequestDouble, double, 0.0)
285
286/**
287 * aidaRequestString API Stub
288 */
289#define REQUEST_STUB_STRING REQUEST_STUB_SCALAR(aidaRequestString, char*, NULL)
290
291/**
292 * API stub for AIDA-PVA array requests
293 *
294 * @param _api the name of the API to define
295 * @return This MACRO will create a function stub that will return Array
296 */
297#define REQUEST_STUB_ARRAY(_api) \
298Array _api(JNIEnv* env, const char* uri, Arguments arguments) \
299{ \
300 UNSUPPORTED_ARRAY_REQUEST \
301}
302
303/**
304 * aidaRequestBooleanArray API Stub
305 */
306#define REQUEST_STUB_BOOLEAN_ARRAY REQUEST_STUB_ARRAY(aidaRequestBooleanArray)
307
308/**
309 * aidaRequestByteArray API Stub
310 */
311#define REQUEST_STUB_BYTE_ARRAY REQUEST_STUB_ARRAY(aidaRequestByteArray)
312
313/**
314 * aidaRequestShortArray API Stub
315 */
316#define REQUEST_STUB_SHORT_ARRAY REQUEST_STUB_ARRAY(aidaRequestShortArray)
317
318/**
319 * aidaRequestIntegerArray API Stub
320 */
321#define REQUEST_STUB_INTEGER_ARRAY REQUEST_STUB_ARRAY(aidaRequestIntegerArray)
322
323/**
324 * aidaRequestLongArray API Stub
325 */
326#define REQUEST_STUB_LONG_ARRAY REQUEST_STUB_ARRAY(aidaRequestLongArray)
327
328/**
329 * aidaRequestFloatArray API Stub
330 */
331#define REQUEST_STUB_FLOAT_ARRAY REQUEST_STUB_ARRAY(aidaRequestFloatArray)
332
333/**
334 * aidaRequestDoubleArray API Stub
335 */
336#define REQUEST_STUB_DOUBLE_ARRAY REQUEST_STUB_ARRAY(aidaRequestDoubleArray)
337
338
339/**
340 * aidaRequestStringArray API stub
341 */
342#define REQUEST_STUB_STRING_ARRAY \
343StringArray aidaRequestStringArray(JNIEnv* env, const char* uri, Arguments arguments) \
344{ \
345 UNSUPPORTED_STRING_ARRAY_REQUEST \
346}
347
348/**
349 * aidaRequestTable API stub
350 *
351 */
352#define REQUEST_STUB_TABLE \
353Table aidaRequestTable(JNIEnv* env, const char* uri, Arguments arguments) \
354{ \
355 UNSUPPORTED_TABLE_REQUEST \
356}
357
358/**
359 * aidaSetValue API stub
360 */
361#define SET_STUB_VOID \
362void aidaSetValue(JNIEnv* env, const char* uri, Arguments arguments, Value value) \
363{ \
364 aidaThrowNonOsException(env, UNSUPPORTED_CHANNEL_EXCEPTION, uri); \
365}
366
367/**
368 * aidaSetValueWithResponse API stub
369 */
370#define SET_STUB_TABLE \
371Table aidaSetValueWithResponse(JNIEnv* env, const char* uri, Arguments arguments, Value value) \
372{ \
373 UNSUPPORTED_TABLE_REQUEST \
374}
375
376/**
377 * Return an empty table response. Use this if you're implementing an api that returns
378 * a Table and you've encountered an error, just after you've raised an exception.
379 */
380#define RETURN_NULL_TABLE \
381 Table nullTable; \
382 nullTable.columnCount = 0; \
383 return nullTable;
384
385#ifdef __cplusplus
386}
387#endif
388#endif
389
The Header File for the AIDA-PVA Module functions.
Array aidaRequestIntegerArray(JNIEnv *env, const char *uri, Arguments arguments)
Get a integer array.
Table aidaSetValueWithResponse(JNIEnv *env, const char *uri, Arguments arguments, Value value)
Set a value and return a table as a response.
void aidaSetValue(JNIEnv *env, const char *uri, Arguments arguments, Value value)
Set a value.
char * aidaRequestString(JNIEnv *env, const char *uri, Arguments arguments)
Get a string.
float aidaRequestFloat(JNIEnv *env, const char *uri, Arguments arguments)
Get a float.
Table aidaRequestTable(JNIEnv *env, const char *uri, Arguments arguments)
Get a table of data.
char * getVersion()
Function provided by all providers to give the version string.
Array aidaRequestLongArray(JNIEnv *env, const char *uri, Arguments arguments)
Get a long array.
Array aidaRequestDoubleArray(JNIEnv *env, const char *uri, Arguments arguments)
Get a double array.
StringArray aidaRequestStringArray(JNIEnv *env, const char *uri, Arguments arguments)
Get a string array.
int aidaRequestInteger(JNIEnv *env, const char *uri, Arguments arguments)
Get a integer.
Array aidaRequestShortArray(JNIEnv *env, const char *uri, Arguments arguments)
Get a short array.
Array aidaRequestBooleanArray(JNIEnv *env, const char *uri, Arguments arguments)
Get a boolean array.
Array aidaRequestFloatArray(JNIEnv *env, const char *uri, Arguments arguments)
Get a float array.
double aidaRequestDouble(JNIEnv *env, const char *uri, Arguments arguments)
Get a double.
void aidaServiceInit(JNIEnv *env)
Initialise the aida service.
Array aidaRequestByteArray(JNIEnv *env, const char *uri, Arguments arguments)
Get a byte array.
short aidaRequestShort(JNIEnv *env, const char *uri, Arguments arguments)
Get a short.
char aidaRequestByte(JNIEnv *env, const char *uri, Arguments arguments)
Get a byte.
int aidaRequestBoolean(JNIEnv *env, const char *uri, Arguments arguments)
Get a boolean.
long aidaRequestLong(JNIEnv *env, const char *uri, Arguments arguments)
Get a long.
An Arguments structure stores all of the arguments passed from the request to the Native Channel Prov...
An array of data.
An array of string data.
Table structure.
This special type represents a Value.