|
Lucon SDK 1.0.7
|
Functions | |
| LuconHandle | LUCON_NewDevice (LuconHandle conn) |
| creates a LuconHandle referring to a Lucon device | |
| LuconResult | LUCON_DeviceConnect (LuconHandle device) |
| Start communicating with the device. | |
| LuconResult | LUCON_DeviceDisconnect (LuconHandle device) |
| Stops communication and closes the connection to the device. | |
| LuconResult | LUCON_DeviceIsConnected (LuconHandle device, int32_t forceCheck, int32_t *const isConnected) |
| Check connectivity of the device with the help of a handshake. | |
| LuconResult | LUCON_DeviceSetConnectedChangedCallback (LuconHandle device, LuconVoidCallback callback) |
Set a callback function to be called when the connection status of the device changes. | |
| LuconResult | LUCON_DeviceSetRestartedCallback (LuconHandle device, LuconVoidCallback callback) |
| Set a callback function to be called when the host receives a restart hint from the device. | |
| LuconResult | LUCON_DeviceRestart (LuconHandle device, int32_t restartChannels) |
| Triggers a restart of the Lucon. Either only the communication module can be restarted or all modules. | |
| LuconResult | LUCON_DeviceSavePermanently (LuconHandle device, int32_t restart) |
| Persistently save the current parameters of the communication module in its EEPROM. | |
| LuconResult | LUCON_DeviceGetSerialNumber (LuconHandle device, char *const strbuf, const size_t buf_len) |
| Read the serial number from the communication module as a string. | |
| LuconResult | LUCON_DeviceGetMacAddress (LuconHandle device, char *const strbuf, const size_t buf_len) |
| Read the MAC address from the communication module as a string. | |
| LuconResult | LUCON_DeviceGetIpAddress (LuconHandle device, char *const strbuf, const size_t buf_len) |
| Read the IP address setting from the communication module as a string. | |
| LuconResult | LUCON_DeviceSetIpAddress (LuconHandle device, const char *const address) |
| Set the IPv4 address of the Lucon. | |
| LuconResult | LUCON_DeviceGetSubnetMask (LuconHandle device, char *const strbuf, const size_t buf_len) |
| Read the IPv4 subnet mask from the device. | |
| LuconResult | LUCON_DeviceSetSubnetMask (LuconHandle device, const char *const subnet) |
| Set the subnet mask of the device. | |
| LuconResult | LUCON_DeviceGetFirmwareVersion (LuconHandle device, char *const strbuf, const size_t buf_len) |
| Read the current firmware version from the device. | |
| LuconResult | LUCON_DeviceGetChannelNumbers (LuconHandle device, uint8_t *const nbrs, const size_t buf_len, size_t *numChannels) |
| Read the channel numbers of the available ("online") channels from the device. | |
| LuconResult | LUCON_DeviceGetChannel (LuconHandle device, const uint32_t channelNumber, LuconHandle *ptrChannelHandle) |
Create a handle to access the channel with the given channelNumber. | |
| LuconResult | LUCON_DeviceSetChannelsToContinuousMode (LuconHandle device, const uint8_t channelNumbers[], const struct LuconContinuousModeParameters params[], size_t numChannels) |
| Set the desired continuous output currents of multiple channels in one command. | |
| LuconResult | LUCON_DeviceGetInfo (LuconHandle device, char *const result, const size_t buf_len) |
| Compose a descriptive string by reading key parameters from the device. | |
|
extern |
Start communicating with the device.
If not yet done, the related connection will be opened. The connectivity to the device is checked with a handshake. Only if the expected answer is received, the call succeeds. Otherwise and error is returned. In this case the connection is closed again, if and only if it was opened during the call.
| device | A handle to the device device to be connected. |
|
extern |
Stops communication and closes the connection to the device.
| device | A handle to the device to be connected |
|
extern |
Create a handle to access the channel with the given channelNumber.
The user owns the handle which is returned on success. It must bee freed after use to avoid memory leaks! The operation will fail, if the channel with the given number is not available.
| device | A handle to the device |
| channelNumber | Channel number of the desired channel |
| ptrChannelHandle | Result buffer recieving the new Functions related to a Lucon Channel (Lucon power module). handle |
|
extern |
Read the channel numbers of the available ("online") channels from the device.
The output buffer should have a capacity of at least 16 entries.
| device | A handle to the device |
| nbrs | The output buffer receiving the channel numbers |
| buf_len | The capcacity (maximum number of entries) of the nbrs output buffer |
| numChannels | A result buffer recieving the number of available channels. The first numChannels entries of nbrs are filled with valid data. |
|
extern |
Read the current firmware version from the device.
Output example: "1.0.1". The output buffer should have at least 10 bytes capacity.
| device | A handle to the device |
| strbuf | The output buffer receiving the firmware version as a zero-terminated ASCII string |
| buf_len | The capacity of strbuf |
|
extern |
Compose a descriptive string by reading key parameters from the device.
The result string is composed dynamically: The function attempts to read parameters from the device. An output buffer size of 1kB should be fully sufficient. If LUCON_ERR_BUFFER_TOO_SMALL is returned, we suggest to retry with twice the buffer size (multiple times if necessary).
| device | A handle to the device |
| result | A string buffer receiving the description |
| buf_len | The capcacity of the result buffer |
|
extern |
Read the IP address setting from the communication module as a string.
Output example: "10.0.30.2". The output buffer should have at least 16 bytes capacity. The returned IP address is the current transient setting. It may differ from the IP in use, if the setting was not saved yet or if the device was not yet restarted after a modification.
| device | A handle to the device |
| strbuf | The output buffer receiving the IP address as a zero-terminated ASCII string |
| buf_len | The capacity of strbuf |
|
extern |
Read the MAC address from the communication module as a string.
Output example: "68:27:19:95:1F:F5". At least 18 bytes of output buffer should be provided.
| device | A handle to the device |
| strbuf | The output buffer receiving the MAC address as a zero-terminated ASCII string |
| buf_len | The capacity of strbuf |
|
extern |
Read the serial number from the communication module as a string.
Output example: "220000024". At least 16 bytes of output buffer should be provided.
| device | A handle to the device |
| strbuf | The output buffer receiving the serial number as a zero-terminated ASCII string. |
| buf_len | The capacity of strbuf |
|
extern |
Read the IPv4 subnet mask from the device.
Output example: "255.255.255.0". The output buffer should have at least 16 bytes capacity.
| device | A handle to the device |
| strbuf | The output buffer receiving the subnet mask as a zero-terminated ASCII string |
| buf_len | The capacity of strbuf |
|
extern |
Check connectivity of the device with the help of a handshake.
| device | A handle to the device. |
| forceCheck | if set to false==0, the function just returns the internal state. Otherwise, a request is sent to the device and responsiveness is checked. |
| isConnected | buffer retrieving the boolean result of the connectivity check: 0==false. |
|
extern |
Triggers a restart of the Lucon. Either only the communication module can be restarted or all modules.
During a restart modules will reload their persisted settings. Transient changes will be lost! After the the function returns successfully, the connection will be lost! Only if the devices connection settings are unmodified, the devices connection settings are unmodified. Otherwise users must create a new connection.
| device | A handle to the device |
| restartChannels | If false (==0), only the communication module is restarted, otherwise additionally all channels are restarted. |
|
extern |
Persistently save the current parameters of the communication module in its EEPROM.
Saves only(!) the communiction modules parameters. Note that some parameters (e.g. IP address) will only take effect after a restart of the module. During a device restart, the connection will be lost. The connection will be recovered after some time (typically < 5s) only if the devices connection settings are unomidifed. Otherwise users must create a new connection.
| device | A handle to the device |
| restart | Iff !=0, the communication module will be restarted after saving. |
|
extern |
Set the desired continuous output currents of multiple channels in one command.
The continous mode parameters given by params are applied one-by-one in the given order to the channels with the given channelIds.
| device | A handle to the device |
| channelNumbers | an array with the numChannels numbers of channels to set |
| params | an array with numChannels continuous mode parameters to be set |
| numChannels | the lenght of the input parameter arrays |
|
extern |
Set a callback function to be called when the connection status of the device changes.
The device connection status indicates, whether the device is responsive. In the absence of other communication, the SDK sends beacon messages in regular intervals. Interruptions of the connection will be reported with some delay. The callback is invoked asynchronously after a status change. Users need to query the current connection status with LUCON_DeviceIsConnected
| device | A handle to the device |
| callback | A pointer to the callback function. Pass NULL to reset a previously set callback. |
|
extern |
Set the IPv4 address of the Lucon.
The ip setting will take effect only after saving and restarting the device.
| device | A handle to the device |
| address | A IPv4 address encoded as a ASCII string. Example: 10.30.0.2 |
|
extern |
Set a callback function to be called when the host receives a restart hint from the device.
The callback function is invoked asynchronously whenever the host receives a message from the device which indicates a restart. This may happen e.g. after a supply-power interruption of the Lucon device or if a restart command was sent to the device. The device might already handle and answer commands before the event is raised! The does only incicate the restart of the communication module. A restart of individual channels can not be detected! It is not guaranteed, that all channels are available after a device restart.
| device | A handle to the device |
| callback | A pointer to the callback function. Pass NULL to reset a previously set callback. |
|
extern |
Set the subnet mask of the device.
| device | A handle to the device |
| subnet | The subnet mask to set as a zero-terminated ASCII string. Example: 255.255.255.0 |
|
extern |
creates a LuconHandle referring to a Lucon device
The user must provide a valid LuconHandle to a connection. The connection handle remains under ownership of the user. The user owns the returned device handle and must call LUCON_FreeHandle to release memory and resources related to the handle.
| conn | A LuconHandle to a connection |