Compare commits

...

4 Commits

Author SHA1 Message Date
David Rebbe 351e462167 added Doxygen config for icsneo
Signed-off-by: David Rebbe <drebbe@intrepidcs.com>
2024-12-11 14:26:01 -05:00
David Rebbe 24d2f84dbb temporary change for system tests 2024-12-11 10:53:36 -05:00
David Rebbe 68fe63c566 add support to use system tests outside fetchcontent 2024-12-11 09:49:21 -05:00
David Rebbe bfd9802860 fixed type mismatch 2024-12-11 09:48:44 -05:00
10 changed files with 2937 additions and 3 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ third-party/concurrentqueue/tests
examples/csharp/bin
examples/csharp/obj
test/system
.venv

View File

@ -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()

2
docs/conf.py 100644 → 100755
View File

@ -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'

2862
docs/icsneo/Doxyfile 100644

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
=====
C API
=====
.. doxygenfile:: icsneo.h
:project: icsneo
.. doxygenfile:: icsneotypes.h
:project: icsneo

View File

@ -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);

View File

@ -0,0 +1,9 @@
icsneo
=======
.. toctree::
:maxdepth: 2
installation
examples
api

View File

@ -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.

View File

@ -13,3 +13,4 @@ communication library. The source code for libicsneo can be found on GitHub:
icsneocpp/index
icsneopy/index
icsneoc/index
icsneo/index

View File

@ -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;