This group of API calls addresses the management of the dS485-Stack, connection to the ds485d daemon and the callback infrastructure.
More...
Data Structures |
struct | DsmApiCallback_t |
| Data structure for dSM-API callback registration. More...
|
Typedefs |
typedef void(* | BusChange_callback_t )(void *arg, dsid_t *id, int flag) |
| Callback function signature for the BusChange callback.
|
typedef void(* | BusState_callback_t )(void *arg, bus_state_t state) |
| Callback function signature for the BusState callback.
|
typedef void * | DsmApiHandle_t |
| Type of the library handle.
|
Functions |
int | DsmApiCleanup (DsmApiHandle_t handle) |
| Free instance memory.
|
int | DsmApiClose (DsmApiHandle_t handle) |
| Close the connection to the dS485 bus.
|
int | DsmApiGetBusMembers (DsmApiHandle_t handle, dsid_t *device_list, int device_list_size) |
| Request a list of the current bus members.
|
int | DsmApiGetBusState (DsmApiHandle_t handle, bus_state_t *state) |
| Get the current state of the dS485 bus.
|
int | DsmApiGetOwnDSID (DsmApiHandle_t handle, dsid_t *dsid) |
| Get the dSID of the daeomon/socket interface.
|
DsmApiHandle_t | DsmApiInitialize (void) |
| Initialize the internal memory structures of the library.
|
int | DsmApiLibraryVersion (void) |
| Get the API version of the library.
|
int | DsmApiOpen (DsmApiHandle_t handle, const char *connection, int flags) |
| Open a new connection to the dS485 bus.
|
int | DsmApiSetBusChangeCallback (DsmApiHandle_t handle, DsmApiCallback_t *callback_struct) |
| Register a callback function for BusChange events.
|
int | DsmApiSetBusStateCallback (DsmApiHandle_t handle, DsmApiCallback_t *callback_struct) |
| Register a callback function for BusState events.
|
int | DsmApiSetCallback (DsmApiHandle_t handle, container_type_t MessageType, uint8_t MessageId, uint8_t ModifierId, DsmApiCallback_t *callback_struct) |
| Register callback functions for dsm-api asynchronous responses, requests and events.
|
Detailed Description
This group of API calls addresses the management of the dS485-Stack, connection to the ds485d daemon and the callback infrastructure.
Typedef Documentation
Callback function signature for the BusChange callback.
Callback function signature for the BusState callback.
Type of the library handle.
Function Documentation
Free instance memory.
- Parameters:
-
[in] | handle | Handle to the library instance |
- Returns:
- 0 on success; negative on failure
Close the connection to the dS485 bus.
- Parameters:
-
[in] | handle | Handle to the library instance |
- Returns:
- 0 on success; negative on failure
Request a list of the current bus members.
- Parameters:
-
[in] | handle | Handle to the library instance |
[out] | device_list | List of devices. Preallocate a buffer of size device_list_size * sizeof(dsid_t) |
[in] | device_list_size | device_list has space for this many devices. |
- Returns:
- the number of devices in device_list; negative if an error occured
Get the current state of the dS485 bus.
- Parameters:
-
[in] | handle | Handle to the library instance |
[out] | state | returns the bus state |
- Returns:
- 0 on success; negative on failure
Get the dSID of the daeomon/socket interface.
- Parameters:
-
[in] | handle | Handle to the library instance |
[out] | dsid | own dSID |
- Returns:
- 0 on success; negative on failure
Initialize the internal memory structures of the library.
- Returns:
- a handle to the library instance
Get the API version of the library.
This function returns the API version as two bytes. The first byte is the MAJOR version, the second byte is the MINOR version. This version corresponds to the ApiVersion parameter read from the dSM with dSMInfo call. Differing MAJOR versions are binary incompatible. Higher MINOR versions contain additional functionality not previously available.
- Returns:
- API version
Open a new connection to the dS485 bus.
- Parameters:
-
[in] | handle | Handle to the library instance |
[in] | connection | string containing the connection method:
- serial:///dev/ttyUSB0 (only when linked to the GPL version of the ds485-client library)
- tcp://localhost:8442
|
[in] | flags | |
- Returns:
- zero on success, negative on failure
Register a callback function for BusChange events.
Register NULL to delete the callback.
- Parameters:
-
[in] | handle | Handle to the library instance |
[in] | callback_struct | a struct containing a callback_function and a user defined argument pointer. Contains the previously registered callback upon return |
- Returns:
- ERROR_OK when ok
Register a callback function for BusState events.
Register NULL to delete the callback.
- Parameters:
-
[in] | handle | Handle to the library instance |
[in] | callback_struct | a struct containing a callback_function and a user defined argument pointer. Contains the previously registered callback upon return |
- Returns:
- ERROR_OK when ok
Register callback functions for dsm-api asynchronous responses, requests and events.
Register NULL to delete a callback.
- Parameters:
-
[in] | handle | Handle to the library instance |
[in] | MessageType | Register callback function for this MessageType |
[in] | MessageId | Register callback function for this MessageId |
[in] | ModifierId | Register the callback function for this ModifierId |
[in] | callback_struct | a struct containing a callback_function and a user defined argument pointer. Contains the previously registered callback upon return |
- Returns:
- ERROR_OK when ok