Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
13c3fc2
Merge pull request #1 from atolab/master
FirasSahliADLinktech Aug 4, 2020
a894163
Update .travis.yml
FirasSahliADLinktech Aug 7, 2020
ba9c169
Implement basic functionalities for the class Entity
FirasSahliADLinktech May 7, 2020
b01d0bf
Implement basic functionalities for the class Domain participant
FirasSahliADLinktech May 7, 2020
17a218d
Write a basic test for the module
FirasSahliADLinktech May 7, 2020
7237730
Implemet basic functionalities for the subscriber entity
FirasSahliADLinktech May 8, 2020
ac41bc6
Implemet basic functionalities for the publisher entity
FirasSahliADLinktech May 8, 2020
e9a40b0
move flexy_topic to a separate file
FirasSahliADLinktech May 8, 2020
0c278ed
create basic functionalities for Topic Entity
FirasSahliADLinktech May 8, 2020
21362c7
Add new libraries to cdds module
FirasSahliADLinktech May 8, 2020
b6a1c3f
Add new libraries to cdds module
FirasSahliADLinktech May 8, 2020
483c430
separate flexy_reader and flexy_writer in a module
FirasSahliADLinktech May 11, 2020
55371d8
Implement basic functionalities for reader entity
FirasSahliADLinktech May 11, 2020
4a2d92c
Implement basic functionalities for writer entity
FirasSahliADLinktech May 11, 2020
6fe6984
separate flexy_reader and flexy_writer in a module
FirasSahliADLinktech May 11, 2020
b871458
Add required c function to runtime module
FirasSahliADLinktech May 11, 2020
61e78fd
Add utility library to parse IDL files and generate Python classes pa…
FirasSahliADLinktech May 11, 2020
3c08fbf
Install idl_parser while running setup of the package
FirasSahliADLinktech May 11, 2020
53a9c49
test write and read operations of sequence types with flexy_writer an…
FirasSahliADLinktech May 11, 2020
ce4915b
Add helloWorld library generated from IDL file, this library is neede…
FirasSahliADLinktech May 11, 2020
0ee1303
Test Entity class functionalities
FirasSahliADLinktech May 11, 2020
7f72929
Add link to helloWorld library in runtime module
FirasSahliADLinktech May 11, 2020
6595fe8
Test Domain Participant Entity functionalities
FirasSahliADLinktech May 11, 2020
926595e
Test Topic Entity functionalities
FirasSahliADLinktech May 11, 2020
b925d89
Test Publisher entity functionalities
FirasSahliADLinktech May 11, 2020
309524b
Test Subscriber entity functionalities
FirasSahliADLinktech May 11, 2020
bd1c78d
Test Writer entity basic functionalities
FirasSahliADLinktech May 11, 2020
64e83ae
Add idl files required for the tests
FirasSahliADLinktech May 11, 2020
4d1391c
Add helloWorld example on FlexyReader and flexyWriter modules
FirasSahliADLinktech May 11, 2020
4d55cf9
Implement lookup instance on the writer
FirasSahliADLinktech May 12, 2020
129c5f6
Implement dispose and write_dispose
FirasSahliADLinktech May 12, 2020
e299621
Implement read operation
FirasSahliADLinktech May 12, 2020
09c7c51
Implement read_n operation
FirasSahliADLinktech May 12, 2020
6e44d88
Implement read with loan operation
FirasSahliADLinktech May 12, 2020
393e03d
Implement lookup instance on reader entity
FirasSahliADLinktech May 12, 2020
fb63505
Implement read_instance operation
FirasSahliADLinktech May 12, 2020
6e43dab
Implement take operation
FirasSahliADLinktech May 12, 2020
5e20be4
Implement take with mask operation
FirasSahliADLinktech May 12, 2020
babd7ea
Implement take next operation
FirasSahliADLinktech May 12, 2020
537386b
Implement read next operation
FirasSahliADLinktech May 12, 2020
7c3d8e5
Implement take_n operation
FirasSahliADLinktech May 12, 2020
504b355
Update reader entity constructor
FirasSahliADLinktech May 12, 2020
b027761
Write unit tests for writer functionalities
FirasSahliADLinktech May 12, 2020
97c0b81
Write unit tests for reader functionalities
FirasSahliADLinktech May 12, 2020
8cff746
Add read condition entity to the cdds module and to runtime library
FirasSahliADLinktech May 13, 2020
645c00c
Create read condition Entity Class with basic functionalities
FirasSahliADLinktech May 13, 2020
c99c4f4
Write tests for the functionalities of the Read Condition entity
FirasSahliADLinktech May 13, 2020
9d54937
Add Query Condition class to the cdds module and add required functio…
FirasSahliADLinktech May 13, 2020
e067d05
Implement functions for Query Conditions
FirasSahliADLinktech May 13, 2020
e475569
Write tests for the functionalities of the Query Condition entity
FirasSahliADLinktech May 13, 2020
80ed2cb
Add Gaurd condition to CDDS module and runtime library
FirasSahliADLinktech May 13, 2020
9478baa
Implement functionalities of Gaurd Condition entity
FirasSahliADLinktech May 13, 2020
d6a14f0
Write tests for functionalities of Gaurd Condition class
FirasSahliADLinktech May 13, 2020
ecc17f4
Add waitset to cdds module
FirasSahliADLinktech May 15, 2020
2675ddd
Implement waitset functionalities
FirasSahliADLinktech May 15, 2020
9d3c576
Test waitset functionalities
FirasSahliADLinktech May 15, 2020
36114a3
Add travis CI
FirasSahliADLinktech Aug 4, 2020
96e777c
Update the source code to make tox tests on travis succeed
FirasSahliADLinktech Aug 14, 2020
94b7f77
oCorrect travisCI error
FirasSahliADLinktech Aug 18, 2020
f337c72
Add gitignore
FirasSahliADLinktech Aug 20, 2020
282493a
Correct import form for platform library
FirasSahliADLinktech Aug 20, 2020
320e698
fix import
gabrik Aug 24, 2020
649a336
fix import
gabrik Aug 24, 2020
832fbd3
fix import
gabrik Aug 24, 2020
0fdf3cf
fix import
gabrik Aug 24, 2020
4c5f653
fix import
gabrik Aug 24, 2020
4eb5cf8
Update cmake script
FirasSahliADLinktech Aug 26, 2020
4125826
change lib to correct build on travis
FirasSahliADLinktech Sep 1, 2020
e2f91ef
Extend wait time during travis debug
FirasSahliADLinktech Sep 1, 2020
3d10196
added set -e to configure
gabrik Sep 3, 2020
2e79798
moved configure to install phase
gabrik Sep 3, 2020
7666689
added -v in configure
gabrik Sep 3, 2020
c6a1fa5
using just uname -s in configure
gabrik Sep 3, 2020
a0a880c
Removing second pushd
gabrik Sep 3, 2020
20bca4a
Added silly ls to check
gabrik Sep 3, 2020
33e3317
removed 'set -ev' from configure file and the ls
gabrik Sep 3, 2020
0b1490f
copying all libraries in configure
gabrik Sep 3, 2020
a56da40
removing developer paths...
gabrik Sep 3, 2020
3d8e7c6
Removed useless travis stages
gabrik Sep 3, 2020
7024cf6
using a idl in tmp folder
gabrik Sep 3, 2020
ace6a04
Merge pull request #3 from gabrik/create_waitset
FirasSahliADLinktech Sep 4, 2020
d9f4868
correct function name to solve errors
FirasSahliADLinktech Sep 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,9 @@ ENV/

# mypy
.mypy_cache/
/.project
/.pydevproject
/bit/bit.c
/bit/bit.h
/bit/helloworld.c
/bit/helloworld.h
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
before_install:
- sudo apt install -y python3-pip build-essential cmake
- sudo apt install -y python3-pip build-essential cmake default-jdk maven
- git clone https://github.com/eclipse-cyclonedds/cyclonedds /tmp/cyclonedds
- cd /tmp/cyclonedds && mkdir build && cd cmake --build . --target install
- cd /tmp/cyclonedds && mkdir build && cd build && cmake .. && make && sudo make install && cd $TRAVIS_BUILD_DIR
addons:
apt:
update: true

language: python3
language: python
python:
- "3.5"
- "3.6"
Expand All @@ -16,10 +16,13 @@ python:
install:
- travis_retry pip3 install tox
- pip install codecov jsonpickle idl_parser
- ./configure
- cp tests/example.idl /tmp/example.idl
- cp tests/helloworld.idl /tmp/helloworld.idl
script:
- tox
cache:
directories:
- $HOME/.cache/pip
after_success:
- codecov
- codecov
43 changes: 40 additions & 3 deletions bit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
cmake_minimum_required(VERSION 3.7)
project(dds-python)

find_package(CycloneDDS)

idlc_generate(ddsbit bit.idl)
add_library(ddstubs SHARED dds_stubs.c)
target_link_libraries(ddstubs ddsbit CycloneDDS::ddsc)
#idlc_generate(ddsbit bit.idl)
SET(outsources)

SET(outsources bit)

list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
message(" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}")
include(idlc_generate_macro)

# find_program(idcl_generate dds_idlc /home/firas/cyclone/cyclonedds/bld/src/idlc)
#
# if(NOT idcl_generate)
# message(FATAL_ERROR "Failed to find idlc code generator ")
# else()
# message("Find idlc code generator")
# endif()

# message (${idcl_generate})
message (" outsources = ${outsources}")

message ("${idcl_generate} -d ${CMAKE_CURRENT_SOURCE_DIR}/ ${CMAKE_CURRENT_SOURCE_DIR}/${outsources}.idl")


# ADD_CUSTOM_COMMAND (
# OUTPUT ${outsource}.c ${outsources}.h
# COMMAND ${idcl_generate} ARGS -d ${CMAKE_CURRENT_SOURCE_DIR} -verbose ${CMAKE_CURRENT_BINARY_DIR}/bit.idl
# COMMENT "Generating files in ${CMAKE_CURRENT_SOURCE_DIR} "
# )
idlc_generate_func(${CMAKE_CURRENT_SOURCE_DIR}/bit.idl)
idlc_generate_func(${CMAKE_CURRENT_SOURCE_DIR}/../tests/helloworld.idl)

add_library(ddstubs SHARED ${CMAKE_CURRENT_SOURCE_DIR}/dds_stubs.c)
add_library(ddsbit SHARED ${CMAKE_CURRENT_SOURCE_DIR}/bit.c ${CMAKE_CURRENT_SOURCE_DIR}/bit.h )
add_library(ddshelloworld SHARED ${CMAKE_CURRENT_SOURCE_DIR}/helloworld.c ${CMAKE_CURRENT_SOURCE_DIR}/helloworld.h )

message("CMAKE_CURRENT_BINARY_DIR ==== ${CMAKE_CURRENT_BINARY_DIR} ")
message("CMAKE_CURRENT_SOURCE_DIR ==== ${CMAKE_CURRENT_SOURCE_DIR} ")

target_link_libraries(ddstubs ddsbit ddshelloworld CycloneDDS::ddsc)
81 changes: 81 additions & 0 deletions bit/cmake/idlc_generate_macro.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
# v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#



#set(IDLC_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE STRING "")
#set(IDLC "dds_idlc${EXTENSION}" CACHE STRING "")
#mark_as_advanced(IDLC_DIR IDLC)

#set(IDLC_SCRIPT_IN "${CMAKE_CURRENT_LIST_DIR}/dds_idlc${EXTENSION}.in")

#configure_file(
# "${IDLC_SCRIPT_IN}" "${IDLC}"
# @ONLY
# NEWLINE_STYLE ${LINE_ENDINGS})
#
#if(NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows"))
# execute_process(COMMAND chmod +x "${IDLC_DIR}/${IDLC}")
#endif()

#add_custom_target(idlc ALL DEPENDS "${IDLC_JAR}")

MACRO (idlc_generate_func idl_file)
message("idl_file: ${idl_file} ")

if(idl_file STREQUAL "")
message(FATAL_ERROR "idlc_generate called without any idl files")
endif()

if (NOT IDLC_ARGS)
set(IDLC_ARGS)
endif()

set(_dir "${CMAKE_CURRENT_BINARY_DIR}")
set(_sources)
set(_headers)

find_program(idcl_generate_full_path
dds_idlc
PATHS /tmp/cyclonedds/build/src/idlc)

if( idcl_generate_full_path STREQUAL "")
message(FATAL_ERROR "Failed to find idlc code generator ")
else()
message("${idcl_generate_full_path}: Found idlc code generator")
endif()

foreach(FIL ${idl_file})
message("file to parse ${FIL} ")
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)

set(_source "${CMAKE_CURRENT_SOURCE_DIR}/${FIL_WE}.c")
set(_header "${CMAKE_CURRENT_SOURCE_DIR}/${FIL_WE}.h")

list(APPEND _sources "${_source}")
list(APPEND _headers "${_header}")

add_custom_command(
OUTPUT "${_source}" "${_header}"
COMMAND "${idcl_generate_full_path}"
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL}
COMMENT "Running idlc on ${FIL}"
VERBATIM)
endforeach()

message("sources ${_sources}" )
message("headers ${_headers}" )

set_source_files_properties(${_sources} ${_headers} PROPERTIES GENERATED TRUE)

endmacro()
10 changes: 9 additions & 1 deletion cdds/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
__author__ = 'Angelo Corsaro'

from .runtime import Runtime
from .policy import *
from .entity import *
from .waitset import *
from .participant import *
from .topic import *
from .flexy_topic import *
from .sub import *
from .pub import *
from .reader import *
from .flexy_reader import *
from .writer import *
from .policy import *
from .readcondition import *
from .querycondition import *
from .gaurdcondition import *
from .flexy_writer import *
76 changes: 60 additions & 16 deletions cdds/dds_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
from ctypes import *


def get_lib_ext():
system = platform.system()
if system == 'Linux':
Expand All @@ -12,7 +11,30 @@ def get_lib_ext():
else:
return '.dll'


# def get_user_lib_path():
# system = platform.system()
# if system == 'Linux':
# return '/usr/local/lib'
# elif system == 'Darwin':
# return '/usr/local/lib'
# elif system in ['windows', 'Windows', 'win32']:
# return os.environ['CDDS_HOME']
# else:
# return '/usr/local/lib'

def get_user_lib_path():
system = platform.system()
if system == 'Linux':
return '/usr/local/lib'
elif system == 'Darwin':
return '/usr/local/lib'
elif system in ['windows', 'Windows', 'win32']:
return os.environ['CDDS_HOME']
else:
return '/usr/local/lib'

def get_user_bit_lib_path():
system = platform.system()
if system == 'Linux':
return '/usr/local/lib'
Expand All @@ -23,21 +45,35 @@ def get_user_lib_path():
else:
return '/usr/local/lib'

# system = platform.system()
# if system in ['windows', 'Windows', 'win32']:
# cham_lib = 'ddsc' + get_lib_ext()
# bit_lib = 'ddstubs' + get_lib_ext()
# cham_lib_path = get_user_bit_lib_path() + os.sep + cham_lib
# bit_lib_path = get_user_bit_lib_path() + os.sep + bit_lib
# else:
# cham_lib = 'libddsbit' + get_lib_ext()
# bit_lib = 'libddstubs' + get_lib_ext()
# cham_lib_path = get_user_bit_lib_path() + os.sep + cham_lib
# bit_lib_path = get_user_bit_lib_path() + os.sep + bit_lib


system = platform.system()
if system in ['windows', 'Windows', 'win32']:
cham_lib = 'ddsc' + get_lib_ext()
bit_lib = 'ddstubs' + get_lib_ext()
cham_lib_path = get_user_lib_path() + os.sep + cham_lib
bit_lib_path = get_user_lib_path() + os.sep + bit_lib
cham_lib = 'ddsc' + get_lib_ext()
bit_lib = 'ddstubs' + get_lib_ext()
cham_lib_path = get_user_lib_path() + os.sep + cham_lib
bit_lib_path = get_user_bit_lib_path() + os.sep + bit_lib
else:
cham_lib = 'libddsc' + get_lib_ext()
bit_lib = 'libddstubs' + get_lib_ext()
helloworld_lib = 'libddshelloworld' + get_lib_ext()
cham_lib_path = get_user_lib_path() + os.sep + cham_lib
bit_lib_path = get_user_lib_path() + os.sep + bit_lib
bit_lib_path = get_user_bit_lib_path() + os.sep + bit_lib
helloworld_lib_path = get_user_bit_lib_path() + os.sep + helloworld_lib

# Limits and Constants
MAX_SAMPLES = 256
MAX_SAMPLES = 100


#
Expand All @@ -53,6 +89,7 @@ def get_user_lib_path():
DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE = 32
DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE = 64
DDS_ANY_INSTANCE_STATE = DDS_ALIVE_INSTANCE_STATE | DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE | DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE
DDS_ANY_INSTANCE_STATE = DDS_ALIVE_INSTANCE_STATE | DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE | DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE

DDS_ANY_STATE = DDS_ANY_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE

Expand Down Expand Up @@ -119,19 +156,28 @@ def get_user_lib_path():
DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP = 0
DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP = 1

LENGTH_UNLIMITED = -1


def dds_infinity():
return 1e20


def dds_secs(n):
return n*1000000000
return n * 1000000000


def dds_millis(n):
return n*1000000
return n * 1000000


def dds_micros(n):
return n*1000
return n * 1000


def dds_nanos(n):
return n


#
# DDS Sample Info
#
Expand Down Expand Up @@ -171,7 +217,7 @@ def is_not_alive_instance(self):
dds_entity_t = c_int32
dds_time_t = c_int64
dds_duration_t = c_int64
dds_instance_handle_t = c_int64
dds_instance_handle_t = c_uint64
dds_domainid_t = c_uint32
dds_sample_state_t = c_int
dds_view_state_t = c_int
Expand All @@ -191,8 +237,6 @@ def is_not_alive_instance(self):
SAMPLE_LOST_PROTO = CFUNCTYPE(None, c_void_p, c_void_p, c_void_p)




# There are actually used to check the the listener are actually working...

def trivial_on_requested_deadline_missed(r, s):
Expand All @@ -210,8 +254,6 @@ def trivial_on_sample_rejected(r, s):
logger.debug('DefaultListener', '>> Sample Rejected')




class DDSValue(Structure):
_fields_ = [('value', c_char_p)]

Expand All @@ -233,6 +275,8 @@ class DDSSequence(Structure):
#
# Built-in key-value type
#


class DDSKeyBValue(Structure):
_fields_ = [('key', c_char_p),
('value', DDSSequence)]
Expand Down
Loading