Typedefs | Functions

ansicreceiver.h File Reference

These functions expose a SCS::Receiver to be callable from an ANSI C application. More...

#include "dllexport.h"
Include dependency graph for ansicreceiver.h:

Go to the source code of this file.

Typedefs

typedef void(* funcSTS )()
 handle a State Transmission Service
typedef void(* funcMCS )(unsigned short, unsigned short)
 handle a Module Control Service
typedef unsigned long(* funcMIS )()
 handle a Module Information Service
typedef int(* funcDRS )(unsigned long)
 handle a Data Request Service

Functions

DLL_PUBLIC void * createReceiver (unsigned short required_revision)
 Open the network interfaces and announce yourself to other participants on the bus.
DLL_PUBLIC void * createReceiverWithFunctionOverride (unsigned short required_revision, funcSTS sts, funcMCS mcs, funcMIS mis, funcDRS drs)
 Open the network interfaces and announce yourself to other participants on the bus.
DLL_PUBLIC void * createReceiverForGroup (unsigned short required_revision, unsigned int node_id, const char *host_addr)
 Open the network interfaces and announce yourself to other participants on a specified multicast group.
DLL_PUBLIC void * createReceiverForGroupWithFunctionOverride (unsigned short required_revision, unsigned int node_id, const char *host_addr, funcSTS sts, funcMCS mcs, funcMIS mis, funcDRS drs)
 Open the network interfaces and announce yourself to other participants on a specified multicast group.
DLL_PUBLIC void requestDataI (void *recv, unsigned long id, int id29, int *i)
DLL_PUBLIC void requestDataF (void *recv, unsigned long id, int id29, float *f)
DLL_PUBLIC void requestDataD (void *recv, unsigned long id, int id29, double *d)
DLL_PUBLIC void requestDataB (void *recv, unsigned long id, int id29, int *i)
DLL_PUBLIC void requestDataS (void *recv, unsigned long id, int id29, char *c, unsigned long maxlength)
DLL_PUBLIC void requestDataVF (void *recv, unsigned long id, int id29, float *f, unsigned long maxlength)
DLL_PUBLIC void requestModule (void *recv, unsigned int node_id, unsigned int module, unsigned int mode)
DLL_PUBLIC void sendDataI (void *recv, unsigned long id, int id29, int i)
DLL_PUBLIC void sendDataF (void *recv, unsigned long id, int id29, float f)
DLL_PUBLIC void sendDataD (void *recv, unsigned long id, int id29, double d)
DLL_PUBLIC void sendDataB (void *recv, unsigned long id, int id29, int i)
DLL_PUBLIC void sendDataS (void *recv, unsigned long id, int id29, const char *c, unsigned long maxlength)
DLL_PUBLIC void sendDataVF (void *recv, unsigned long id, int id29, float *f, unsigned long maxlength)
DLL_PUBLIC void run (void *recv)
DLL_PUBLIC void freeReceiver (void *recv)

Detailed Description

These functions expose a SCS::Receiver to be callable from an ANSI C application.

Use this to connect to SCS if you can't use the C++ interface. Exposes only the most basic functions.


Function Documentation

DLL_PUBLIC void* createReceiver ( unsigned short  required_revision)

Open the network interfaces and announce yourself to other participants on the bus.

Parameters:
required_software_revisionrevision of the CAN Aerospace distribution your application requires
Returns:
opaque pointer to Receiver
DLL_PUBLIC void* createReceiverForGroup ( unsigned short  required_revision,
unsigned int  node_id,
const char *  host_addr 
)

Open the network interfaces and announce yourself to other participants on a specified multicast group.

This function should not be needed under normal circumstances. You should use it only if you need to change the mulitcast group. Don't use it to inject other IP adresses than multicast addresses. SCS in default config will NOT work if you do this

Parameters:
required_software_revisionrevision of the CAN Aerospace distribution your application requires
own_node_idyour assigned node id or 255 for auto-configuration
host_addrmulticast group for SCS communication
Returns:
opaque pointer to Receiver
DLL_PUBLIC void* createReceiverForGroupWithFunctionOverride ( unsigned short  required_revision,
unsigned int  node_id,
const char *  host_addr,
funcSTS  sts,
funcMCS  mcs,
funcMIS  mis,
funcDRS  drs 
)

Open the network interfaces and announce yourself to other participants on a specified multicast group.

This function should not be needed under normal circumstances. You should use it only if you need to change the mulitcast group. Don't use it to inject other IP adresses than multicast addresses. SCS in default config will NOT work if you do this

Mimics overriding the Receiver class with virtual functions. Use this if you want to ovveride the default behavior

Parameters:
required_software_revisionrevision of the CAN Aerospace distribution your application requires
own_node_idyour assigned node id or 255 for auto-configuration
host_addrmulticast group for SCS communication
stsfunction to be called instead of Receiver::handleSTS
mcsfunction to be called instead of Receiver::handleMCS
misfunction to be called instead of Receiver::handleMIS
drsfunction to be called instead of Receiver::handleDRS
Returns:
opaque pointer to Receiver
DLL_PUBLIC void* createReceiverWithFunctionOverride ( unsigned short  required_revision,
funcSTS  sts,
funcMCS  mcs,
funcMIS  mis,
funcDRS  drs 
)

Open the network interfaces and announce yourself to other participants on the bus.

Mimics overriding the Receiver class with virtual functions. Use this if you want to ovveride the default behavior

Parameters:
required_software_revisionrevision of the CAN Aerospace distribution your application requires
stsfunction to be called instead of Receiver::handleSTS
mcsfunction to be called instead of Receiver::handleMCS
misfunction to be called instead of Receiver::handleMIS
drsfunction to be called instead of Receiver::handleDRS
Returns:
opaque pointer to Receiver
DLL_PUBLIC void freeReceiver ( void *  recv)

Close all connections and free memory allocated by Receiver

Parameters:
recvopaque pointer to Receiver
DLL_PUBLIC void requestDataB ( void *  recv,
unsigned long  id,
int  id29,
int *  i 
)

Request to receive updates on the given CAN Id from the bus. The identifier distribution defines which data format is used. If the identifier distribution uses bools, this function converts it to ints

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
iPointer to variable to be updated when value changes on the bus
DLL_PUBLIC void requestDataD ( void *  recv,
unsigned long  id,
int  id29,
double *  d 
)

Request to receive updates on the given CAN Id from the bus. The identifier distribution defines which data format is used.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
dPointer to variable to be updated when value changes on the bus
DLL_PUBLIC void requestDataF ( void *  recv,
unsigned long  id,
int  id29,
float *  f 
)

Request to receive updates on the given CAN Id from the bus. The identifier distribution defines which data format is used.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
fPointer to variable to be updated when value changes on the bus
DLL_PUBLIC void requestDataI ( void *  recv,
unsigned long  id,
int  id29,
int *  i 
)

Request to receive updates on the given CAN Id from the bus. The identifier distribution defines which data format is used.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
iPointer to variable to be updated when value changes on the bus
DLL_PUBLIC void requestDataS ( void *  recv,
unsigned long  id,
int  id29,
char *  c,
unsigned long  maxlength 
)

Request to receive updates on the given CAN Id from the bus. The identifier distribution defines which data format is used.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
cPointer to char array to be updated when value changes on the bus
maxlengthmaximum number of characters to be written to the memory specified by c
DLL_PUBLIC void requestDataVF ( void *  recv,
unsigned long  id,
int  id29,
float *  f,
unsigned long  maxlength 
)

Request to receive updates on the given CAN Id from the bus. The identifier distribution defines which data format is used.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
fPointer to float array to be updated when value changes on the bus
maxlengthmaximum number of floats to be written to the memory specified by f
DLL_PUBLIC void requestModule ( void *  recv,
unsigned int  node_id,
unsigned int  module,
unsigned int  mode 
)

Request another bus participant to en- or disable one of its modules.

Causes the node to be asked via MIS aboutits capabilities and enables the requested capability via MCS.

Parameters:
recvopaque pointer to Receiver
node_idnode which owns the requested module
modulenumber of the module to be enabled
modethe mode command to set
DLL_PUBLIC void run ( void *  recv)

Call this repeatedly, either from the application's main loop or a separate application thread.

Will update pointers and invoke callbacks with new data. Big black magic box that makes all work as you expect, ensuring the protocol is handled following the CAN Aerospace and SCS specifications.

Parameters:
recvopaque pointer to Receiver
DLL_PUBLIC void sendDataB ( void *  recv,
unsigned long  id,
int  id29,
int  i 
)

Send value of given CAN id to the bus, so other participants are informed and can synchronize themselves to the new value.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
ivalue to be send
DLL_PUBLIC void sendDataD ( void *  recv,
unsigned long  id,
int  id29,
double  d 
)

Send value of given CAN id to the bus, so other participants are informed and can synchronize themselves to the new value.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
ivalue to be send
DLL_PUBLIC void sendDataF ( void *  recv,
unsigned long  id,
int  id29,
float  f 
)

Send value of given CAN id to the bus, so other participants are informed and can synchronize themselves to the new value.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
ivalue to be send
DLL_PUBLIC void sendDataI ( void *  recv,
unsigned long  id,
int  id29,
int  i 
)

Send value of given CAN id to the bus, so other participants are informed and can synchronize themselves to the new value.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
ivalue to be send
DLL_PUBLIC void sendDataS ( void *  recv,
unsigned long  id,
int  id29,
const char *  c,
unsigned long  maxlength 
)

Send value of given CAN id to the bus, so other participants are informed and can synchronize themselves to the new value.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
ivalue to be send
DLL_PUBLIC void sendDataVF ( void *  recv,
unsigned long  id,
int  id29,
float *  f,
unsigned long  maxlength 
)

Send value of given CAN id to the bus, so other participants are informed and can synchronize themselves to the new value.

Parameters:
recvopaque pointer to Receiver
idCAN id of simulation data, specified in identifier distribution
id29id width of the CAN id, 1 for 29bit, 0 for 11bit
ivalue to be send