* Adding templates * Update includes * Minor changes Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/serial/serial_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/udp/udp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/serial/serial_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/tcp/tcp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/udp/udp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/udp/udp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/serial/serial_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/serial/serial_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/serial/serial_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/tcp/tcp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/tcp/tcp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/tcp/tcp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/tcp/tcp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/udp/udp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Update src/c/profile/transport/ip/tcp/tcp_transport_external.c.template Co-Authored-By: Julián Bermúdez Ortega <julianbermudez@eprosima.com> Co-authored-by: Julián Bermúdez Ortega <julianbermudez@eprosima.com>
This commit is contained in:
parent
94261f14e4
commit
410eda9302
|
@ -9,3 +9,11 @@ tags
|
|||
# eclipse
|
||||
.cproject
|
||||
.project
|
||||
|
||||
src/c/profile/transport/ip/tcp/tcp_transport_external.c
|
||||
src/c/profile/transport/ip/udp/udp_transport_external.c
|
||||
src/c/profile/transport/serial/serial_transport_external.c
|
||||
|
||||
include/uxr/client/profile/transport/ip/tcp/tcp_transport_external.h
|
||||
include/uxr/client/profile/transport/ip/udp/udp_transport_external.h
|
||||
include/uxr/client/profile/transport/serial/serial_transport_external.h
|
|
@ -126,15 +126,9 @@ if(UCLIENT_PLATFORM_LINUX OR UCLIENT_PLATFORM_NUTTX)
|
|||
endif()
|
||||
|
||||
# Check external transport.
|
||||
set(EXTERNAL_TRANSPORT_HEADER "" CACHE PATH "External transports header file")
|
||||
set(EXTERNAL_TRANSPORT_SRC "" CACHE PATH "External transports code file")
|
||||
|
||||
if(EXTERNAL_TRANSPORT_SRC AND EXTERNAL_TRANSPORT_HEADER)
|
||||
set(_external_transport ON)
|
||||
get_filename_component(EXTERNAL_TRANSPORT_HEADER_FILENAME ${EXTERNAL_TRANSPORT_HEADER} NAME)
|
||||
get_filename_component(EXTERNAL_TRANSPORT_FILENAME ${EXTERNAL_TRANSPORT_SRC} NAME)
|
||||
get_filename_component(EXTERNAL_TRANSPORT_HEADER_DIRECTORY ${EXTERNAL_TRANSPORT_HEADER} DIRECTORY)
|
||||
endif()
|
||||
option(UCLIENT_EXTERNAL_TCP "Enable external serial transport." OFF)
|
||||
option(UCLIENT_EXTERNAL_UDP "Enable external serial transport." OFF)
|
||||
option(UCLIENT_EXTERNAL_SERIAL "Enable external serial transport." OFF)
|
||||
|
||||
# Other sources
|
||||
set(SRCS
|
||||
|
@ -173,7 +167,9 @@ set(SRCS
|
|||
$<$<AND:$<BOOL:${PROFILE_SERIAL_TRANSPORT}>,$<OR:$<PLATFORM_ID:Linux>,$<PLATFORM_ID:Generic>>>:src/c/profile/transport/serial/serial_transport.c>
|
||||
$<$<AND:$<BOOL:${PROFILE_SERIAL_TRANSPORT}>,$<OR:$<PLATFORM_ID:Linux>,$<PLATFORM_ID:Generic>>>:src/c/profile/transport/serial/serial_protocol.c>
|
||||
$<$<AND:$<BOOL:${PROFILE_SERIAL_TRANSPORT}>,$<BOOL:${UCLIENT_PLATFORM_POSIX}>>:src/c/profile/transport/serial/serial_transport_posix.c>
|
||||
$<$<AND:$<BOOL:${PROFILE_SERIAL_TRANSPORT}>,$<PLATFORM_ID:Generic>,$<BOOL:${_external_transport}>>:${EXTERNAL_TRANSPORT_SRC}>
|
||||
$<$<BOOL:${UCLIENT_EXTERNAL_TCP}>:src/c/profile/transport/ip/tcp/tcp_transport_external.c>
|
||||
$<$<BOOL:${UCLIENT_EXTERNAL_UDP}>:src/c/profile/transport/ip/udp/udp_transport_external.c>
|
||||
$<$<BOOL:${UCLIENT_EXTERNAL_SERIAL}>:src/c/profile/transport/serial/serial_transport_external.c>
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
|
@ -249,7 +245,6 @@ target_include_directories(${PROJECT_NAME}
|
|||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
|
||||
$<$<AND:$<BOOL:${INSTALL_INTERFACE}>,$<BOOL:${_external_transport}>>:${EXTERNAL_TRANSPORT_HEADER_DIRECTORY}>
|
||||
PRIVATE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/c>
|
||||
)
|
||||
|
@ -347,16 +342,6 @@ install(
|
|||
PATTERN "*.h"
|
||||
)
|
||||
|
||||
# Install external transport header
|
||||
if(_external_transport)
|
||||
install(
|
||||
FILES
|
||||
${EXTERNAL_TRANSPORT_HEADER}
|
||||
DESTINATION
|
||||
${INCLUDE_INSTALL_DIR}/uxr/client/profile/transport/serial
|
||||
)
|
||||
endif()
|
||||
|
||||
# Generate config.h
|
||||
configure_file(${PROJECT_SOURCE_DIR}/include/uxr/client/config.h.in
|
||||
${PROJECT_BINARY_DIR}/include/uxr/client/config.h
|
||||
|
|
|
@ -30,14 +30,15 @@
|
|||
#cmakedefine UCLIENT_PLATFORM_WINDOWS
|
||||
#cmakedefine UCLIENT_PLATFORM_NUTTX
|
||||
#cmakedefine UCLIENT_PLATFORM_POSIX_NOPOLL
|
||||
#cmakedefine _external_transport
|
||||
|
||||
#cmakedefine UCLIENT_EXTERNAL_TCP
|
||||
#cmakedefine UCLIENT_EXTERNAL_UDP
|
||||
#cmakedefine UCLIENT_EXTERNAL_SERIAL
|
||||
|
||||
#if defined(UCLIENT_PLATFORM_LINUX) || defined(UCLIENT_PLATFORM_NUTTX)
|
||||
#define UCLIENT_PLATFORM_POSIX
|
||||
#endif
|
||||
|
||||
#cmakedefine EXTERNAL_TRANSPORT_HEADER_FILENAME <uxr/client/profile/transport/serial/@EXTERNAL_TRANSPORT_HEADER_FILENAME@>
|
||||
|
||||
#define UXR_CONFIG_MAX_OUTPUT_BEST_EFFORT_STREAMS @CONFIG_MAX_OUTPUT_BEST_EFFORT_STREAMS@
|
||||
#define UXR_CONFIG_MAX_OUTPUT_RELIABLE_STREAMS @CONFIG_MAX_OUTPUT_RELIABLE_STREAMS@
|
||||
#define UXR_CONFIG_MAX_INPUT_BEST_EFFORT_STREAMS @CONFIG_MAX_INPUT_BEST_EFFORT_STREAMS@
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef UXR_CLIENT_PROFILE_TRANSPORT_IP_TCP_EXTERNAL_H_
|
||||
#define UXR_CLIENT_PROFILE_TRANSPORT_IP_TCP_EXTERNAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// Place here your includes
|
||||
|
||||
typedef struct uxrTCPPlatform
|
||||
{
|
||||
// Place here your platform data
|
||||
} uxrTCPPlatform;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // UXR_CLIENT_PROFILE_TRANSPORT_IP_TCP_EXTERNAL_H_
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef UXR_CLIENT_PROFILE_TRANSPORT_IP_UDP_EXTERNAL_H_
|
||||
#define UXR_CLIENT_PROFILE_TRANSPORT_IP_UDP_EXTERNAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// Place here your includes
|
||||
|
||||
typedef struct uxrUDPPlatform
|
||||
{
|
||||
// Place here your platform data
|
||||
} uxrUDPPlatform;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // UXR_CLIENT_PROFILE_TRANSPORT_IP_UDP_EXTERNAL_H_
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef UXR_CLIENT_PROFILE_TRANSPORT_SERIAL_EXTERNAL_H_
|
||||
#define UXR_CLIENT_PROFILE_TRANSPORT_SERIAL_EXTERNAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// Place here your includes
|
||||
|
||||
typedef struct uxrSerialPlatform
|
||||
{
|
||||
// Place here your platform data
|
||||
} uxrSerialPlatform;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // UXR_CLIENT_PROFILE_TRANSPORT_SERIAL_EXTERNAL_H_
|
|
@ -19,7 +19,9 @@
|
|||
|
||||
#ifdef PROFILE_UDP_TRANSPORT
|
||||
#include <uxr/client/profile/transport/ip/udp/udp_transport.h>
|
||||
#if defined(UCLIENT_PLATFORM_POSIX)
|
||||
#if defined(UCLIENT_EXTERNAL_UDP)
|
||||
#include <uxr/client/profile/transport/ip/udp/udp_transport_external.h>
|
||||
#elif defined(UCLIENT_PLATFORM_POSIX)
|
||||
#include <uxr/client/profile/transport/ip/udp/udp_transport_posix.h>
|
||||
#elif defined(UCLIENT_PLATFORM_WINDOWS)
|
||||
#include <uxr/client/profile/transport/ip/udp/udp_transport_windows.h>
|
||||
|
@ -28,7 +30,9 @@
|
|||
|
||||
#ifdef PROFILE_TCP_TRANSPORT
|
||||
#include <uxr/client/profile/transport/ip/tcp/tcp_transport.h>
|
||||
#if defined(UCLIENT_PLATFORM_POSIX)
|
||||
#if defined(UCLIENT_EXTERNAL_TCP)
|
||||
#include <uxr/client/profile/transport/ip/tcp/tcp_transport_external.h>
|
||||
#elif defined(UCLIENT_PLATFORM_POSIX)
|
||||
#include <uxr/client/profile/transport/ip/tcp/tcp_transport_posix.h>
|
||||
#elif defined(UCLIENT_PLATFORM_POSIX_NOPOLL)
|
||||
#include <uxr/client/profile/transport/ip/udp/udp_transport_posix_nopoll.h>
|
||||
|
@ -39,11 +43,11 @@
|
|||
|
||||
#ifdef PROFILE_SERIAL_TRANSPORT
|
||||
#include <uxr/client/profile/transport/serial/serial_transport.h>
|
||||
#if defined(UCLIENT_PLATFORM_POSIX)
|
||||
#if defined(UCLIENT_EXTERNAL_SERIAL)
|
||||
#include <uxr/client/profile/transport/serial/serial_transport_external.h>
|
||||
#elif defined(UCLIENT_PLATFORM_POSIX)
|
||||
#include <uxr/client/profile/transport/serial/serial_transport_posix.h>
|
||||
#elif defined(UCLIENT_PLATFORM_WINDOWS)
|
||||
#elif defined(_external_transport)
|
||||
#include EXTERNAL_TRANSPORT_HEADER_FILENAME
|
||||
#endif
|
||||
#endif //PROFILE_SERIAL_TRANSPORT
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
#include <uxr/client/profile/transport/ip/tcp/tcp_transport_external.h>
|
||||
#include "tcp_transport_internal.h"
|
||||
|
||||
// Place here your includes
|
||||
|
||||
bool uxr_init_tcp_platform(
|
||||
struct uxrTCPPlatform* platform,
|
||||
uxrIpProtocol ip_protocol,
|
||||
const char* ip,
|
||||
const char* port)
|
||||
{
|
||||
// Place here your initialization platform code
|
||||
// Return true if success
|
||||
}
|
||||
|
||||
bool uxr_close_tcp_platform(
|
||||
struct uxrTCPPlatform* platform)
|
||||
{
|
||||
// Place here your closing platform code
|
||||
// Return true if success
|
||||
}
|
||||
|
||||
size_t uxr_write_tcp_data_platform(
|
||||
struct uxrTCPPlatform* platform,
|
||||
const uint8_t* buf,
|
||||
size_t len,
|
||||
uint8_t* errcode)
|
||||
{
|
||||
// Place here your writing bytes platform code
|
||||
// Return number of bytes written
|
||||
}
|
||||
|
||||
size_t uxr_read_tcp_data_platform(
|
||||
struct uxrTCPPlatform* platform,
|
||||
uint8_t* buf,
|
||||
size_t len,
|
||||
int timeout,
|
||||
uint8_t* errcode)
|
||||
{
|
||||
// Place here your reading bytes platform code
|
||||
// Return number of bytes read (max bytes: len)
|
||||
}
|
||||
|
||||
void uxr_disconnect_tcp_platform(
|
||||
struct uxrTCPPlatform* platform)
|
||||
{
|
||||
// Place here your disconnection platform code
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#include <uxr/client/profile/transport/ip/udp/udp_transport_external.h>
|
||||
#include "udp_transport_internal.h"
|
||||
|
||||
// Place here your includes
|
||||
|
||||
bool uxr_init_udp_platform(
|
||||
uxrUDPPlatform* platform,
|
||||
uxrIpProtocol ip_protocol,
|
||||
const char* ip,
|
||||
const char* port)
|
||||
{
|
||||
// Place here your initialization platform code
|
||||
// Return true if success
|
||||
}
|
||||
|
||||
bool uxr_close_udp_platform(
|
||||
uxrUDPPlatform* platform)
|
||||
{
|
||||
// Place here your closing platform code
|
||||
// Return true if success
|
||||
}
|
||||
|
||||
size_t uxr_write_udp_data_platform(
|
||||
uxrUDPPlatform* platform,
|
||||
const uint8_t* buf,
|
||||
size_t len,
|
||||
uint8_t* errcode)
|
||||
{
|
||||
// Place here your writing bytes platform code
|
||||
// Return number of bytes written
|
||||
}
|
||||
|
||||
size_t uxr_read_udp_data_platform(
|
||||
uxrUDPPlatform* platform,
|
||||
uint8_t* buf,
|
||||
size_t len,
|
||||
int timeout,
|
||||
uint8_t* errcode)
|
||||
{
|
||||
// Place here your reading bytes platform code
|
||||
// Return number of bytes read (max bytes: len)
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
#include <uxr/client/profile/transport/serial/serial_transport_external.h>
|
||||
#include <uxr/client/profile/transport/serial/serial_transport_platform.h>
|
||||
|
||||
// Place here your includes
|
||||
|
||||
bool uxr_init_serial_platform(struct uxrSerialPlatform* platform, int fd, uint8_t remote_addr, uint8_t local_addr)
|
||||
{
|
||||
// Place here your initialization platform code
|
||||
// Return true if success
|
||||
}
|
||||
|
||||
bool uxr_close_serial_platform(struct uxrSerialPlatform* platform)
|
||||
{
|
||||
// Place here your closing platform code
|
||||
// Return true if success
|
||||
}
|
||||
|
||||
size_t uxr_write_serial_data_platform(uxrSerialPlatform* platform, uint8_t* buf, size_t len, uint8_t* errcode)
|
||||
{
|
||||
// Place here your writing bytes platform code
|
||||
// Return number of bytes written
|
||||
}
|
||||
|
||||
size_t uxr_read_serial_data_platform(uxrSerialPlatform* platform, uint8_t* buf, size_t len, int timeout, uint8_t* errcode)
|
||||
{
|
||||
// Place here your reading bytes platform code
|
||||
// Return number of bytes read (max bytes: len)
|
||||
}
|
Loading…
Reference in New Issue