init
function is called during the module initialization to specify the pointers to the functions which will have to be called at the start and end of a Service invocation.__declspec(dllexport) void init(void (*startInvoke)(long), void (*endInvoke));
void (*startInvoke)(long)
pointer points to the Java function which must be called at the start of a Service invocationvoid (*endInvoke)()
pointer points to the Java function which must be called at the end of a Service invocation// the __declspec(dllexport) allows to export the signature of the init function __declspec(dllexport) void init(void (*startInvoke)(long), void (*endInvoke)); // the two startInvokeInst and endInvokeInst declarations are the pointers to the two functions used when invoking a Service from the C code static void (*startInvokeInst)(long); static void (*endInvokeInst)();For the C source:
void init(void (*startInvoke)(long), void (*endInvoke)()) { startInvokeInst = startInvoke; endInvokeInst = endInvoke; }
setXXXInvoker
functions are called during the module initialization to specify the pointers to Data sets, depending on the Data type.// for int datas __declspec(dllexport) void setIntInvoker(void (*intInvokerInst)(char*, int)); // for boolean datas __declspec(dllexport) void setBooleanInvoker(void (*booleanInvokerInst)(char*, int)); // for char datas __declspec(dllexport) void setCharInvoker(void (*charInvokerInst)(char*, char)); // for byte datas __declspec(dllexport) void setByteInvoker(void (*byteInvokerInst)(char*, byte)); // for short datas __declspec(dllexport) void setShortInvoker(void (*shortInvokerInst)(char*, short)); // for long datas __declspec(dllexport) void setLongInvoker(void (*longInvokerInst)(char*, long)); // for float datas __declspec(dllexport) void setFloatInvoker(void (*floatInvokerInst)(char*, float)); // for double datas __declspec(dllexport) void setDoubleInvoker(void (*doubleInvokerInst)(char*, double)); // for String datas __declspec(dllexport) void setStringInvoker(void (*stringInvokerInst)(char*, char*));
// the __declspec(dllexport) allows to export the signature of the function __declspec(dllexport) void setIntInvoker(void (*intInvokerInst)(char*, int)); // the two intInvokerInst declaration is the pointer to the function used when setting the value of an int Data from the C code static void (*intInvokerInst)(char*, int);For the C source:
void setIntInvoker(void (*intInvoker)(char*, int)) { intInvokerInst = intInvoker; }
start()
// the __declspec(dllexport) allows to export the signature of the function __declspec(dllexport) void start();For the C source:
void start()() { // do something when the module starts }
end()
// the __declspec(dllexport) allows to export the signature of the function __declspec(dllexport) void end();For the C source:
void end()() { // do something when the framework shutdown }
startNotify
function will be called at the beginning of a Service invocationreceiveXXX
functions will be called for each data of the invoked ServiceendNotify
function will be called at the end of a Service invocationstartNotify
must have the following signature:__declspec(dllexport) void startNotify(long service);The
endNotify
must have the following signature:__declspec(dllexport) void endNotify(long service);The
receiveXXX
must have the following signatures, depending on the Data type:__declspec(dllexport) void receiveInt(char* data, int value); __declspec(dllexport) void receiveChar(char* data, char value); __declspec(dllexport) void receiveShort(char* data, short value); __declspec(dllexport) void receiveByte(char* data, byte value); __declspec(dllexport) void receiveLong(char* data, long value); __declspec(dllexport) void receiveBoolean(char* data, int value); __declspec(dllexport) void receiveFloat(char* data, float value); __declspec(dllexport) void receiveDouble(char* data, double value); __declspec(dllexport) void receiveString(char* data, char* value);
__declspec(dllexport) void receiveBoolean(char* data, int value); static int step = 1;For the C source:
void receiveBoolean(char* data, int value) { if (value) { step = -1; } else { step = 1; } }
*startInvoke
function pointer with the Service ID as argument*xxxInvokerInst
associated function pointer for each Service data you want to set the value*endInvoke
function pointer// the __declspec(dllexport) allows to export the signature of the init function __declspec(dllexport) void init(void (*startInvoke)(long), void (*endInvoke)); // the __declspec(dllexport) allows to export the signature of the function __declspec(dllexport) void setIntInvoker(void (*intInvokerInst)(char*, int)); static void (*startInvokeInst)(long); static void (*endInvokeInst)(); static void (*intInvokerInst)(char*, int);For the C source:
void init(void (*startInvoke)(long), void (*endInvoke)()) { startInvokeInst = startInvoke; endInvokeInst = endInvoke; } void publish(long service) { // invoke the Service with ID 2 startInvokeInst(2); // sets the value 10 for the "myData" Data intInvokerInst("myData", 10); // effectively invoke the Service endInvokeInst(); }
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence