Crate libicsneo_sys

source ·
Expand description

Rust sys level crate providing a cbindgen API for libicsneo (https://github.com/intrepidcs/libicsneo) If unsure, don’t use this crate and use libicsneo-rs instead.

Re-exports

Structs

Enums

Functions

  • \brief Adds an event callback to be called when a new event is added. \param[in] callback A function pointer with void return type and a single neoevent_t parameter. \param[in] filter Unused for now. Exists as a placeholder here for future backwards-compatibility. \returns The id of the callback added. Does not error.
  • \brief Adds a message callback to the specified device to be called when a new message is received. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] callback A function pointer with void return type and a single neomessage_t parameter. \param[in] filter Unused for now. Exists as a placeholder here for future backwards-compatibility. \returns The id of the callback added, or -1 if the operation failed.
  • \brief Check whether software switchable termination can currently be enabled for a given network. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] netid The network ID to check \returns True if software switchable termination can currently be enabled
  • \brief Close an open connection to the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to close. \returns True if the connection could be closed.
  • \brief Get the friendly description for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[out] str A pointer to a buffer where the string will be written. NULL can be passed, which will write a character count to maxLength. \param[inout] maxLength A pointer to a size_t which, prior to the call, holds the maximum number of characters to be written (so str must be of size maxLength + 1 to account for the NULL terminator), and after the call holds the number of characters written. \returns True if str was written to
  • \brief Disable buffering of messages for the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if polling could be disabled.
  • \brief Discard all events which have occurred in API operation. Does NOT discard any errors.
  • \brief Discard all events which have occurred in API operation. \param[in] device A pointer to the neodevice_t structure specifying the device to discard events for. NULL can be passed, which indicates that ONLY events not associated with a device are desired (API events). Does NOT discard any errors (device or otherwise).
  • \brief Enable buffering of messages for the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if polling could be enabled.
  • \brief Find Intrepid hardware connected via USB and Ethernet. \param[out] devices Pointer to memory where devices should be written. If NULL, the current number of detected devices is written to count. \param[inout] count Pointer to a size_t, which should initially contain the number of devices the buffer can hold, and will afterwards contain the number of devices found.
  • \brief Invalidate neodevice_t objects which have not been opened.
  • \brief Get the network baudrate for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] netid The network for which the baudrate should be retrieved. \returns The value in baud with no multipliers. (i.e. 500k becomes 500000) A negative value is returned if an error occurs.
  • \brief Read out events which have occurred in API operation for a specific device \param[in] device A pointer to the neodevice_t structure specifying the device to read out events for. NULL can be passed, which indicates that ONLY events not associated with a device are desired (API events). \param[out] events A pointer to a buffer which neoevent_t structures will be written to. NULL can be passed, which will write the current event count to size. \param[inout] size A pointer to a size_t which, prior to the call, holds the maximum number of events to be written, and after the call holds the number of events written. \returns True if the events were read out successfully (even if there were no events to report).
  • \brief Return the device status structures for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] status A pointer to a device status structure for the current device. \param[in] size The size of the current device status structure in bytes. \returns True if the device status was successfully read.
  • \brief Get the value of a digital IO for the given device \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] type The IO type \param[in] number The index within the IO type, starting from 1 \param[out] value A pointer to the uint8_t which will store the value of the IO port, if successful \returns True if the value is read successfully
  • \brief Get the number of events which can be held in the API managed buffer \returns The current limit.
  • \brief Read out events which have occurred in API operation \param[out] events A pointer to a buffer which neoevent_t structures will be written to. NULL can be passed, which will write the current event count to size. \param[inout] size A pointer to a size_t which, prior to the call, holds the maximum number of events to be written, and after the call holds the number of events written. \returns True if the events were read out successfully (even if there were no events to report).
  • \brief Get the CAN FD baudrate for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] netid The network for which the baudrate should be retrieved. \returns The value in baud with no multipliers. (i.e. 500k becomes 500000) A negative value is returned if an error occurs.
  • \brief Read out the last error which occurred in API operation on this thread. \param[out] error A pointer to a buffer which a neoevent_t structure will be written to. \returns True if an error was read out.
  • \brief Read out messages which have been recieved \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[out] messages A pointer to a buffer which neomessage_t structures will be written to. NULL can be passed, which will write the current message count to size. \param[inout] items A pointer to a size_t which, prior to the call, holds the maximum number of messages to be written, and after the call holds the number of messages written. \param[in] timeout The number of milliseconds to wait for a message to arrive. A value of 0 indicates a non-blocking call. Querying for the current message count is always asynchronous and ignores this value. \returns True if the messages were read out successfully (even if there were no messages to read) or if the count was read successfully.
  • \brief Get the network ID for the nth network of a specified type on this device \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] type An ICSNEO_NETWORK_TYPE_* constant denoting the network type \param[in] number The number of this network starting from 1 \returns The netid if the call succeeds, ICSNEO_NETID_INVALID otherwise
  • \brief Get the maximum number of messages which will be held in the API managed buffer for the specified hardware. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns Number of messages, or -1 if device is invalid.
  • \brief Get the friendly product name for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[out] str A pointer to a buffer where the string will be written. NULL can be passed, which will write a character count to maxLength. \param[inout] maxLength A pointer to a size_t which, prior to the call, holds the maximum number of characters to be written (so str must be of size maxLength + 1 to account for the NULL terminator), and after the call holds the number of characters written. \returns True if str was written to
  • \brief Get the friendly product name for a specified devicetype. \param[in] type A neodevice_t structure specifying the device to operate on. \param[out] str A pointer to a buffer where the string will be written. NULL can be passed, which will write a character count to maxLength. \param[inout] maxLength A pointer to a size_t which, prior to the call, holds the maximum number of characters to be written (so str must be of size maxLength + 1 to account for the NULL terminator), and after the call holds the number of characters written. \returns True if str was written to
  • \brief Get the real-time clock for the given device. \param[out] device A pointer to the neodevice_t structure specifying the device to read the RTC from. \param[out] output A pointer to a uint64_t where the RTC will be stored. This value is in seconds.
  • \brief Get the devices supported by the current version of the API \param[out] devices A pointer to a buffer of devicetype_t structures which will be written to. NULL can be passed, which will write the current supported device count to count. \param[inout] count A pointer to a size_t which, prior to the call, holds the maximum number of devicetype_t structures to be written, and after the call holds the number of devicetype_t structures written. \returns True if devices was written to
  • \brief Get the timestamp resolution for the given device \param[out] device A pointer to the neodevice_t structure specifying the device to read out the timestamp for. \param[out] resolution A pointer to a uint16_t where the resolution will be stored. This value is in nanoseconds.
  • \brief Get the version of libicsneo in use. \returns A neoversion_t structure containing the version.
  • \brief Disable network communication for the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if communication could be disabled.
  • \brief Enable network communication for the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if communication could be enabled.
  • \brief Verify message polling status for the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if polling is enabled.
  • \brief Verify network communication for the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if communication is enabled.
  • \brief Verify network connection for the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if the device is connected.
  • \brief Check whether software switchable termination is currently enabled for a given network in the currently active device settings. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] netid The network ID to check \returns True if software switchable termination is currently enabled
  • \brief Check whether software switchable termination is supported for a given network on this device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] netid The network ID to check \returns True if software switchable termination is supported
  • \brief Verify that a neodevice_t is valid. \param[in] device A pointer to the neodevice_t structure to operate on. \returns True if the neodevice_t is valid.
  • \brief Connect to the specified hardware \param[in] device A pointer to the neodevice_t structure specifying the device to open. \returns True if the connection could be opened.
  • \brief Removes an event callback. \param[in] id The id of the callback to remove. \returns True if the callback was successfully removed.
  • \brief Removes a message callback from the specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] id The id of the callback to remove. \returns True if the callback was successfully removed.
  • \brief Convert a serial number in numerical format to its string representation. \param[in] num A numerical serial number. \param[out] str A pointer to a buffer where the string representation will be written. NULL can be passed, which will write a character count to count. \param[inout] count A pointer to a size_t which, prior to the call, holds the maximum number of characters to be written (so str must be of size count + 1 to account for the NULL terminator), and after the call holds the number of characters written. \returns True if str contains the string representation of the given serial number.
  • \brief Convert a serial number in string format to its numerical representation. \param[in] str A NULL terminated string containing the string representation of an Intrepid serial number. \returns The numerical representation of the serial number, or 0 if the conversion was unsuccessful.
  • \brief Set the network baudrate for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] netid The network to which the new baudrate should apply. \param[in] newBaudrate The requested baudrate, with no multipliers. (i.e. 500K CAN should be represented as 500000) \returns True if the baudrate could be set.
  • \brief Get the value of a digital IO for the given device \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] type The IO type \param[in] number The index within the IO type, starting from 1 \param[in] value The value which will be written to the IO \returns True if the parameters and connection state are correct to submit the request to the device
  • \brief Set the number of events which will be held in the API managed buffer before icsneo::APIEvent::TooManyEvents \param[in] newLimit The new limit. Must be >10. 1 event slot is always reserved for a potential icsneo::APIEvent::TooManyEvents, so (newLimit - 1) other events can be stored.
  • \brief Set the CAN FD baudrate for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] netid The network to which the new baudrate should apply. \param[in] newBaudrate The requested baudrate, with no multipliers. (i.e. 2Mbaud CAN FD should be represented as 2000000) \returns True if the baudrate could be set.
  • \brief Set the maximum number of messages which will be held in the API managed buffer for the specified hardware. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] newLimit The new limit to be enforced. \returns True if the limit was set successfully.
  • \brief Set the real-time clock for the given device. \param[out] device A pointer to the neodevice_t structure specifying the device to write the RTC to. \param[in] input A uint64_t object holding the RTC value. This value is in seconds.
  • \brief Enable or disable software switchable termination for a given network. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] netid The network ID to affect \param[in] enabled Whether to enable or disable switchable termination \returns True if if the call was successful, otherwise an error will have been reported in icsneo_getLastError().
  • \brief Set the behavior of whether writing is a blocking action or not. \param[in] device A pointer to the neodevice_t structure specifying the device to transmit on. \param[in] blocks Whether or not writing is a blocking action.
  • \brief Commit the settings structure for a specified device to non-volatile storage. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if the settings were applied.
  • \brief Apply the default settings structure for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if the default settings were applied.
  • \brief Apply the default settings structure for a specified device temporarily. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if the default settings were applied.
  • \brief Apply a provided settings structure for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] structure A pointer to a device settings structure for the current device. \param[in] structureSize The size of the current device settings structure in bytes. \returns True if the settings were applied.
  • \brief Apply a provided settings structure for a specified device without saving to non-volatile EEPROM. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[in] structure A pointer to a device settings structure for the current device. \param[in] structureSize The size of the current device settings structure in bytes. \returns True if the settings were applied.
  • \brief Apply the settings structure for a specified device temporarily. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if the settings were applied.
  • \brief Apply the default settings structure for a specified device temporarily. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \param[out] structure A pointer to a device settings structure for the current device. \param[in] structureSize The size of the current device settings structure in bytes. \returns Number of bytes written to structure, or -1 if the operation failed.
  • \brief Trigger a refresh of the settings structure for a specified device. \param[in] device A pointer to the neodevice_t structure specifying the device to operate on. \returns True if the refresh succeeded.
  • \brief Transmit a single message. \param[in] device A pointer to the neodevice_t structure specifying the device to transmit on. \param[in] message A pointer to the neomessage_t structure defining the message. \returns True if the message was verified transmittable and enqueued for transmit.
  • \brief Transmit a multiple messages. \param[in] device A pointer to the neodevice_t structure specifying the device to transmit on. \param[in] messages A pointer to the neomessage_t structures defining the messages. \param[in] count The number of messages to transmit. \returns True if the messages were verified transmittable and enqueued for transmit.

Type Definitions

Unions