![]() |
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.
|
This file contain functions and MACROS that should be used directly Native Channel Providers. More...
Go to the source code of this file.
Functions | |
void | aidaThrow (JNIEnv *env, vmsstat_t status, char *exception, const char *message) |
To log any exceptions and throw back to java. More... | |
void | aidaThrowNonOsException (JNIEnv *env, char *exception, const char *message) |
To log any non-OS exceptions and throw back to java. More... | |
void * | allocateMemory (JNIEnv *env, void *source, size_t size, bool nullTerminate, char *message) |
Allocate memory and copy the source to it if specified. More... | |
int | endsWith (const char *str, char *suffix) |
Check if a string str , ends with another string suffix . More... | |
Argument | getArgument (Arguments arguments, char *name) |
Get a named argument. More... | |
json_value * | getJsonRoot (json_value *jsonValue) |
json_value * | getJsonValue (Value *value, char *passedInPath) |
Get the json value from the given value identified by the path. More... | |
Value | getNamedArrayValue (JNIEnv *env, Arguments arguments, char *name) |
Get value from a named argument in the provided arguments structure. More... | |
Value | getNamedValue (JNIEnv *env, Arguments arguments, char *name) |
Get value from a named argument in the provided arguments structure. More... | |
int | groupNameFromUri (char groupName[], const char *uri) |
Get the Display group name from a URI. More... | |
vmsstat_t | init (const char *processName, bool initMessageServices) |
Call standalone_init() More... | |
int | pmuFromDeviceName (JNIEnv *env, char *device, char *primary, char *micro, int4u *unit) |
Get primary, micro and unit from a device name. More... | |
void | pmuStringFromUri (char *pmuString, const char *uri) |
Get the pmu part of a URI. More... | |
void | secnFromUri (const char *uri, int4u *secn) |
Get secondary from pseudo secondary (containing a colon) number from URI e.g. More... | |
const char * | secondaryFromUri (const char *uri) |
Get secondary from URI. More... | |
unsigned long int | STANDALONE_INIT (const struct dsc$descriptor_s *name, const long int *dbinit, const struct msginit *msginit, const long int *query, const long int *set) |
standalone init is used to initialise standalone processes More... | |
int | startsWith (const char *str, char *prefix) |
Check if a string starts with another string. More... | |
void | uriLegacyName (char legacyName[MAX_URI_LEN], const char *uri) |
Convert the given URI to the legacy AIDA name for low level functions that still require it that way. More... | |
void | uriToSlcName (char slcName[MAX_URI_LEN], const char *uri) |
Convert all URIs to slac names before making queries. More... | |
This file contain functions and MACROS that should be used directly Native Channel Providers.
These functions provide all of the features that allow the Channel Provider to implement its service.
MEMBER=SLCLIBS:AIDA_PVALIB ATTRIBUTES=JNI
Definition in file aida_pva_server_helper.c.
void aidaThrow | ( | JNIEnv * | env, |
vmsstat_t | status, | ||
char * | exception, | ||
const char * | message | ||
) |
To log any exceptions and throw back to java.
Exception Handling.
The #exception is formatted in a standard way using the VMS status code and its associated message and the optionally supplied #message. The #exception is always assumed to be from the edu.stanford.slac.except package
env | the JNI environment. Used in all functions involving JNI |
status | the VMS status code to luck up and display text for. |
exception | the string representation of the exception class to throw. |
message | the optional message to attach to the exception. If NULL it is ignored. |
Definition at line 92 of file aida_pva_server_helper.c.
Referenced by aidaRequestBoolean(), aidaRequestBooleanArray(), aidaRequestByte(), aidaRequestByteArray(), aidaRequestDouble(), aidaRequestDoubleArray(), aidaRequestFloat(), aidaRequestFloatArray(), aidaRequestInteger(), aidaRequestIntegerArray(), aidaRequestLong(), aidaRequestLongArray(), aidaRequestShort(), aidaRequestShortArray(), aidaRequestString(), aidaRequestTable(), aidaServiceInit(), aidaSetValue(), aidaSetValueWithResponse(), and aidaThrowNonOsException().
void aidaThrowNonOsException | ( | JNIEnv * | env, |
char * | exception, | ||
const char * | message | ||
) |
To log any non-OS exceptions and throw back to java.
The #exception is formatted in a standard way with the optionally supplied #message. The #exception is always assumed to be from the edu.stanford.slac.except package
env | the JNI environment. Used in all functions involving JNI |
exception | the string representation of the exception class to throw. |
message | the optional message to attach to the exception. If NULL it is ignored. |
Definition at line 75 of file aida_pva_server_helper.c.
References aidaThrow().
Referenced by aidaRequestBoolean(), aidaRequestBooleanArray(), aidaRequestByte(), aidaRequestByteArray(), aidaRequestDouble(), aidaRequestDoubleArray(), aidaRequestFloat(), aidaRequestFloatArray(), aidaRequestInteger(), aidaRequestIntegerArray(), aidaRequestLong(), aidaRequestLongArray(), aidaRequestShort(), aidaRequestShortArray(), aidaRequestString(), aidaRequestStringArray(), aidaRequestTable(), aidaSetValue(), aidaSetValueWithResponse(), allocateMemory(), getClassAndValueOfMethod(), newObject(), newObjectFromClass(), pmuFromDeviceName(), tableAddColumn(), tableAddField(), tableAddLabel(), tableCreate(), toBoolean(), toBooleanArray(), toByte(), toByteArray(), toDouble(), toDoubleArray(), toFloat(), toFloatArray(), toInteger(), toIntegerArray(), toLong(), toLongArray(), toShort(), toShortArray(), toStringArray(), and toTable().
void * allocateMemory | ( | JNIEnv * | env, |
void * | source, | ||
size_t | size, | ||
bool | nullTerminate, | ||
char * | message | ||
) |
Allocate memory and copy the source to it if specified.
Memory Handling.
If the null terminate flag is set null terminate the allocate space, at the last position
env | to be used to throw exceptions using aidaThrow() and aidaThrowNonOsException() |
source | source of data to copy to newly allocated space, NULL to not copy |
size | the amount of space to allocate |
nullTerminate | true to null terminate |
message | the message to display if anything goes wrong |
Definition at line 629 of file aida_pva_server_helper.c.
References AIDA_INTERNAL_EXCEPTION, and aidaThrowNonOsException().
int endsWith | ( | const char * | str, |
char * | suffix | ||
) |
Check if a string str
, ends with another string suffix
.
String Handling.
str | the string to check. |
suffix | the suffix to look for at the end of str |
true
if str
ends with suffix
. false
Definition at line 148 of file aida_pva_server_helper.c.
Referenced by aidaRequestBoolean(), aidaRequestBooleanArray(), aidaRequestByte(), aidaRequestByteArray(), aidaRequestDouble(), aidaRequestDoubleArray(), aidaRequestFloat(), aidaRequestFloatArray(), aidaRequestInteger(), aidaRequestIntegerArray(), aidaRequestLong(), aidaRequestLongArray(), aidaRequestShort(), aidaRequestShortArray(), aidaRequestString(), aidaRequestStringArray(), aidaRequestTable(), and aidaSetValueWithResponse().
Get a named argument.
arguments | arguments |
name | name |
Definition at line 184 of file aida_pva_server_helper.c.
References Arguments::argumentCount, Arguments::arguments, Argument::name, and Argument::value.
json_value * getJsonRoot | ( | json_value * | jsonValue | ) |
Skip root element if it is _array otherwise return unchanged This is because our json parser can't process arrays at the top level and so we insert an object at the top level with an "_array" element if we find an array at the top level
jsonValue | the json value traverse |
Definition at line 404 of file aida_pva_server_helper.c.
Referenced by getJsonValue().
json_value * getJsonValue | ( | Value * | value, |
char * | passedInPath | ||
) |
Get the json value from the given value identified by the path.
value | the given value |
passedInPath | is an absolute reference to the element within the json of the given value. e.g. root.collection.[0].name |
Definition at line 347 of file aida_pva_server_helper.c.
References AIDA_JSON_TYPE, getJsonRoot(), ValueContents::jsonValue, Value::type, and Value::value.
Get value from a named argument in the provided arguments structure.
Get array value from a named argument in the provided arguments structure.
env | the JNI environment. Used in all functions involving JNI |
arguments | provided arguments structure |
name | provided name |
Definition at line 335 of file aida_pva_server_helper.c.
Referenced by getArrayValue().
Get value from a named argument in the provided arguments structure.
env | the JNI environment. Used in all functions involving JNI |
arguments | provided arguments structure |
name | provided name |
Definition at line 322 of file aida_pva_server_helper.c.
Referenced by getValue().
int groupNameFromUri | ( | char | groupName[], |
const char * | uri | ||
) |
Get the Display group name from a URI.
URI Handling for group, secn, pmu and slacName.
groupName | pre-allocated space to store the group name |
uri | the new format AIDA PV name |
Definition at line 472 of file aida_pva_server_helper.c.
vmsstat_t init | ( | const char * | processName, |
bool | initMessageServices | ||
) |
Call standalone_init()
Initialisation.
processName | the name of the process being initialised |
initMessageServices | boolean to determine if the message service needs to be initialised |
Definition at line 50 of file aida_pva_server_helper.c.
References STANDALONE_INIT().
Referenced by aidaServiceInit().
int pmuFromDeviceName | ( | JNIEnv * | env, |
char * | device, | ||
char * | primary, | ||
char * | micro, | ||
int4u * | unit | ||
) |
Get primary, micro and unit from a device name.
env | the JNI environment. Used in all functions involving JNI |
device | pre-allocated space to store the device |
primary | pre-allocated space to store the primary |
micro | pre-allocated space to store the micro |
unit | pre-allocated space to store the unit |
Definition at line 542 of file aida_pva_server_helper.c.
References aidaThrowNonOsException(), MICRO_LEN, PRIM_LEN, and UNABLE_TO_GET_DATA_EXCEPTION.
Referenced by aidaRequestTable().
void pmuStringFromUri | ( | char * | pmuString, |
const char * | uri | ||
) |
Get the pmu part of a URI.
pmuString | the pre-allocated space to store the pmu string |
uri | the new format AIDA PV name |
Definition at line 523 of file aida_pva_server_helper.c.
References MAX_URI_LEN.
void secnFromUri | ( | const char * | uri, |
int4u * | secn | ||
) |
Get secondary from pseudo secondary (containing a colon) number from URI e.g.
Get secondary from pseudo secondary (containing a colon) number from URI.
BD01:BEND:BDES
=> BEND
as int4u
uri | the new format AIDA PV name |
secn | pointer to an int to store the secondary as a number |
Definition at line 489 of file aida_pva_server_helper.c.
const char * secondaryFromUri | ( | const char * | uri | ) |
Get secondary from URI.
Just points into the URI so don't go messing with it
uri | the new format AIDA PV name |
Definition at line 507 of file aida_pva_server_helper.c.
Referenced by aidaRequestStringArray().
unsigned long int STANDALONE_INIT | ( | const struct dsc$descriptor_s * | name, |
const long int * | dbinit, | ||
const struct msginit * | msginit, | ||
const long int * | query, | ||
const long int * | set | ||
) |
standalone init is used to initialise standalone processes
name | process name |
dbinit | dbinit |
msginit | msginit |
query | query |
set | set |
Referenced by init().
int startsWith | ( | const char * | str, |
char * | prefix | ||
) |
Check if a string starts with another string.
str | |
prefix |
Definition at line 166 of file aida_pva_server_helper.c.
Referenced by aidaRequestLong(), aidaRequestShort(), aidaRequestString(), aidaRequestStringArray(), and aidaSetValue().
void uriLegacyName | ( | char | legacyName[MAX_URI_LEN], |
const char * | uri | ||
) |
Convert the given URI to the legacy AIDA name for low level functions that still require it that way.
legacyName | pointer to space to store the legacy AIDA name |
uri | the new format AIDA PV name |
Definition at line 599 of file aida_pva_server_helper.c.
void uriToSlcName | ( | char | slcName[MAX_URI_LEN], |
const char * | uri | ||
) |
Convert all URIs to slac names before making queries.
slcName | pointer to space to store the SLC name |
uri | the new format AIDA PV name |
Definition at line 583 of file aida_pva_server_helper.c.