Compare commits
4 Commits
992e83d8ea
...
351e462167
| Author | SHA1 | Date |
|---|---|---|
|
|
351e462167 | |
|
|
24d2f84dbb | |
|
|
68fe63c566 | |
|
|
bfd9802860 |
|
|
@ -15,3 +15,4 @@ third-party/concurrentqueue/tests
|
|||
examples/csharp/bin
|
||||
examples/csharp/obj
|
||||
test/system
|
||||
.venv
|
||||
|
|
@ -584,12 +584,13 @@ if(LIBICSNEO_BUILD_SYSTEM_TESTS)
|
|||
FetchContent_Declare(
|
||||
SystemTests
|
||||
GIT_REPOSITORY $ENV{LIBICSNEO_SYSTEM_TESTS}
|
||||
GIT_TAG main
|
||||
GIT_TAG icsneo_api
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test/system
|
||||
)
|
||||
FetchContent_MakeAvailable(SystemTests)
|
||||
else()
|
||||
message("System test repo not defined!")
|
||||
message(WARNING "LIBICSNEO_SYSTEM_TESTS env variable not defined, attempting to use ${CMAKE_CURRENT_SOURCE_DIR}/test/system anyways...")
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/system)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import subprocess
|
|||
|
||||
subprocess.call('cd ..; doxygen docs/icsneocpp/Doxyfile', shell=True)
|
||||
subprocess.call('cd ..; doxygen docs/icsneoc/Doxyfile', shell=True)
|
||||
subprocess.call('cd ..; doxygen docs/icsneo/Doxyfile', shell=True)
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||
|
|
@ -26,6 +27,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|||
breathe_projects = {
|
||||
'icsneocpp': 'icsneocpp/doxygen/xml',
|
||||
'icsneoc': 'icsneoc/doxygen/xml',
|
||||
'icsneo': 'icsneoc/doxygen/xml',
|
||||
}
|
||||
|
||||
breathe_default_project = 'icsneocpp'
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,8 @@
|
|||
=====
|
||||
C API
|
||||
=====
|
||||
|
||||
.. doxygenfile:: icsneo.h
|
||||
:project: icsneo
|
||||
.. doxygenfile:: icsneotypes.h
|
||||
:project: icsneo
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
==========
|
||||
C Examples
|
||||
==========
|
||||
|
||||
A variety of examples can be found within ``examples/c``, see below for an
|
||||
example that uses the polling API to receive CAN frames.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
size_t deviceCount = 10; // Pre-set to the size of your buffer before the icsneo_findAllDevices() call
|
||||
neodevice_t devices[10];
|
||||
icsneo_findAllDevices(devices, &deviceCount);
|
||||
printf("We found %ull devices\n", deviceCount);
|
||||
for(size_t i = 0; i < deviceCount; i++) {
|
||||
neodevice_t* myDevice = &devices[i];
|
||||
char desc[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
|
||||
size_t sz = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
|
||||
icsneo_describeDevice(myDevice, desc, &sz);
|
||||
printf("Found %s\n", desc); // "Found neoVI FIRE 2 CY2345"
|
||||
}
|
||||
neodevice_t* myDevice = &devices[0];
|
||||
if(!icsneo_openDevice(myDevice)) {
|
||||
neoevent_t error;
|
||||
if(icsneo_getLastError(&error))
|
||||
printf("Error! %s\n", error.description);
|
||||
}
|
||||
icsneo_goOnline(myDevice); // Start receiving messages
|
||||
icsneo_enableMessagePolling(myDevice); // Allow the use of icsneo_getMessages() later
|
||||
sleep(5);
|
||||
neomessage_t messages[50];
|
||||
size_t messageCount = 50;
|
||||
icsneo_getMessages(myDevice, messages, &messageCount, 0 /* non-blocking */);
|
||||
printf("We got %ull messages!\n", messageCount);
|
||||
for(size_t i = 0; i < messageCount; i++) {
|
||||
if(messages[i].type == ICSNEO_NETWORK_TYPE_CAN) {
|
||||
// A message of type CAN should be interperated a neomessage_can_t, so we can cast safely
|
||||
neomessage_can_t* canmsg = (neomessage_can_t*)&messages[i];
|
||||
// canmsg->arbid is valid here
|
||||
// canmsg->data is an uint8_t*, you can check canmsg->length for the length of the payload
|
||||
// canmsg->timestamp is the time recorded by the hardware in nanoseconds since (1/1/2007 12:00:00 GMT)
|
||||
}
|
||||
}
|
||||
icsneo_closeDevice(myDevice);
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
icsneo
|
||||
=======
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
installation
|
||||
examples
|
||||
api
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
============
|
||||
Installation
|
||||
============
|
||||
|
||||
The installation steps for the C API are the same as the C++ API as the C API is
|
||||
a wrapper for the C++ library. The ``LIBICSNEO_BUILD_ICSNEO`` CMake option is
|
||||
default ``ON`` but note that the C API depends on this flag to build.
|
||||
|
|
@ -13,3 +13,4 @@ communication library. The source code for libicsneo can be found on GitHub:
|
|||
icsneocpp/index
|
||||
icsneopy/index
|
||||
icsneoc/index
|
||||
icsneo/index
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ int process_messages(icsneo_device_t* device, icsneo_message_t** messages, uint3
|
|||
printf("\t%d) Message type: %u bus type: %s (%u)\n", i, msg_type, bus_name, bus_type);
|
||||
if (bus_type == icsneo_msg_bus_type_can) {
|
||||
uint32_t arbid = 0;
|
||||
uint32_t dlc = 0;
|
||||
int32_t dlc = 0;
|
||||
icsneo_netid_t netid = 0;
|
||||
bool is_remote = false;
|
||||
bool is_canfd = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue