Browse Source

change src1/common/modulecomm, delete not use program.

yuchuli 3 years ago
parent
commit
f9bcbeb262
45 changed files with 0 additions and 5271 deletions
  1. 0 323
      src1/common/modulecomm_fastrtps/Topics.cxx
  2. 0 253
      src1/common/modulecomm_fastrtps/Topics.h
  3. 0 13
      src1/common/modulecomm_fastrtps/Topics.idl
  4. 0 138
      src1/common/modulecomm_fastrtps/TopicsPubSubTypes.cxx
  5. 0 61
      src1/common/modulecomm_fastrtps/TopicsPubSubTypes.h
  6. 0 198
      src1/common/modulecomm_fastrtps/TopicsPublisher.cxx
  7. 0 56
      src1/common/modulecomm_fastrtps/TopicsPublisher.h
  8. 0 206
      src1/common/modulecomm_fastrtps/TopicsSubscriber.cxx
  9. 0 72
      src1/common/modulecomm_fastrtps/TopicsSubscriber.h
  10. 0 13
      src1/common/modulecomm_fastrtps/ivmodulemsg_type.h
  11. 0 63
      src1/common/modulecomm_fastrtps/modulecomm_fastrtps.cpp
  12. 0 40
      src1/common/modulecomm_fastrtps/modulecomm_fastrtps.h
  13. 0 45
      src1/common/modulecomm_fastrtps/modulecomm_fastrtps.pro
  14. 0 140
      src1/common/modulecomm_fastrtps/modulecomm_impl.cpp
  15. 0 41
      src1/common/modulecomm_fastrtps/modulecomm_impl.h
  16. 0 323
      src1/common/modulecomm_fastrtps_tcp/Topics.cxx
  17. 0 253
      src1/common/modulecomm_fastrtps_tcp/Topics.h
  18. 0 13
      src1/common/modulecomm_fastrtps_tcp/Topics.idl
  19. 0 138
      src1/common/modulecomm_fastrtps_tcp/TopicsPubSubTypes.cxx
  20. 0 61
      src1/common/modulecomm_fastrtps_tcp/TopicsPubSubTypes.h
  21. 0 202
      src1/common/modulecomm_fastrtps_tcp/TopicsPublisher.cxx
  22. 0 57
      src1/common/modulecomm_fastrtps_tcp/TopicsPublisher.h
  23. 0 216
      src1/common/modulecomm_fastrtps_tcp/TopicsSubscriber.cxx
  24. 0 73
      src1/common/modulecomm_fastrtps_tcp/TopicsSubscriber.h
  25. 0 13
      src1/common/modulecomm_fastrtps_tcp/ivmodulemsg_type.h
  26. 0 63
      src1/common/modulecomm_fastrtps_tcp/modulecomm_fastrtps_tcp.cpp
  27. 0 44
      src1/common/modulecomm_fastrtps_tcp/modulecomm_fastrtps_tcp.h
  28. 0 45
      src1/common/modulecomm_fastrtps_tcp/modulecomm_fastrtps_tcp.pro
  29. 0 140
      src1/common/modulecomm_fastrtps_tcp/modulecomm_impl.cpp
  30. 0 41
      src1/common/modulecomm_fastrtps_tcp/modulecomm_impl.h
  31. 0 73
      src1/common/modulecomm_inter/.gitignore
  32. 0 480
      src1/common/modulecomm_inter/intercomm.cpp
  33. 0 109
      src1/common/modulecomm_inter/intercomm.h
  34. 0 56
      src1/common/modulecomm_inter/modulecomm_inter.cpp
  35. 0 37
      src1/common/modulecomm_inter/modulecomm_inter.h
  36. 0 33
      src1/common/modulecomm_inter/modulecomm_inter.pro
  37. 0 90
      src1/common/modulecomm_shm/ReadMe.md
  38. 0 13
      src1/common/modulecomm_shm/ivmodulemsg_type.h
  39. 0 54
      src1/common/modulecomm_shm/modulecomm_shm.cpp
  40. 0 42
      src1/common/modulecomm_shm/modulecomm_shm.h
  41. 0 41
      src1/common/modulecomm_shm/modulecomm_shm.pro
  42. 0 378
      src1/common/modulecomm_shm/procsm.cpp
  43. 0 112
      src1/common/modulecomm_shm/procsm.h
  44. 0 310
      src1/common/modulecomm_shm/procsm_if.cpp
  45. 0 99
      src1/common/modulecomm_shm/procsm_if.h

+ 0 - 323
src1/common/modulecomm_fastrtps/Topics.cxx

@@ -1,323 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file Topics.cpp
- * This source file contains the definition of the described types in the IDL file.
- *
- * This file was generated by the tool gen.
- */
-
-#ifdef _WIN32
-// Remove linker warning LNK4221 on Visual Studio
-namespace { char dummy; }
-#endif
-
-#include "Topics.h"
-#include <fastcdr/Cdr.h>
-
-#include <fastcdr/exceptions/BadParamException.h>
-using namespace eprosima::fastcdr::exception;
-
-#include <utility>
-
-
-TopicSample::Message::Message()
-{
-    // m_msgname com.eprosima.idl.parser.typecode.StringTypeCode@76329302
-    m_msgname ="";
-    // m_counter com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5e25a92e
-    m_counter = 0;
-    // m_sendtime com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4df828d7
-    m_sendtime = 0;
-    // m_xdata com.eprosima.idl.parser.typecode.AliasTypeCode@b59d31
-
-    m_xdata.push_back(1);
-    m_xdata.push_back(2);
-
-
-}
-
-TopicSample::Message::~Message()
-{
-
-
-
-
-}
-
-TopicSample::Message::Message(const Message &x)
-{
-    m_msgname = x.m_msgname;
-    m_counter = x.m_counter;
-    m_sendtime = x.m_sendtime;
-    m_xdata = x.m_xdata;
-}
-
-TopicSample::Message::Message(Message &&x)
-{
-    m_msgname = std::move(x.m_msgname);
-    m_counter = x.m_counter;
-    m_sendtime = x.m_sendtime;
-    m_xdata = std::move(x.m_xdata);
-}
-
-TopicSample::Message& TopicSample::Message::operator=(const Message &x)
-{
-
-    m_msgname = x.m_msgname;
-    m_counter = x.m_counter;
-    m_sendtime = x.m_sendtime;
-    m_xdata = x.m_xdata;
-
-    return *this;
-}
-
-TopicSample::Message& TopicSample::Message::operator=(Message &&x)
-{
-
-    m_msgname = std::move(x.m_msgname);
-    m_counter = x.m_counter;
-    m_sendtime = x.m_sendtime;
-    m_xdata = std::move(x.m_xdata);
-
-    return *this;
-}
-
-size_t TopicSample::Message::getMaxCdrSerializedSize(size_t current_alignment)
-{
-    size_t initial_alignment = current_alignment;
-
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1;
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
-
-
-    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
-
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
-
-    current_alignment += (100 * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
-
-
-
-    return 10000000;
-//    return current_alignment - initial_alignment;
-}
-
-size_t TopicSample::Message::getCdrSerializedSize(const TopicSample::Message& data, size_t current_alignment)
-{
-    (void)data;
-    size_t initial_alignment = current_alignment;
-
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.msgname().size() + 1;
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
-
-
-    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
-
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
-
-    if (data.xdata().size() > 0)
-    {
-        current_alignment += (data.xdata().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
-    }
-
-
-
-
-    return current_alignment - initial_alignment;
-}
-
-void TopicSample::Message::serialize(eprosima::fastcdr::Cdr &scdr) const
-{
-
-    scdr << m_msgname;
-    scdr << m_counter;
-    scdr << m_sendtime;
-    scdr << m_xdata;
-
-//    std::cout<<"serialize."<<std::endl;
-}
-
-void TopicSample::Message::deserialize(eprosima::fastcdr::Cdr &dcdr)
-{
-
-    dcdr >> m_msgname;
-    dcdr >> m_counter;
-    dcdr >> m_sendtime;
-    dcdr >> m_xdata;
-}
-
-/*!
- * @brief This function copies the value in member msgname
- * @param _msgname New value to be copied in member msgname
- */
-void TopicSample::Message::msgname(const std::string &_msgname)
-{
-m_msgname = _msgname;
-}
-
-/*!
- * @brief This function moves the value in member msgname
- * @param _msgname New value to be moved in member msgname
- */
-void TopicSample::Message::msgname(std::string &&_msgname)
-{
-m_msgname = std::move(_msgname);
-}
-
-/*!
- * @brief This function returns a constant reference to member msgname
- * @return Constant reference to member msgname
- */
-const std::string& TopicSample::Message::msgname() const
-{
-    return m_msgname;
-}
-
-/*!
- * @brief This function returns a reference to member msgname
- * @return Reference to member msgname
- */
-std::string& TopicSample::Message::msgname()
-{
-    return m_msgname;
-}
-/*!
- * @brief This function sets a value in member counter
- * @param _counter New value for member counter
- */
-void TopicSample::Message::counter(int32_t _counter)
-{
-m_counter = _counter;
-}
-
-/*!
- * @brief This function returns the value of member counter
- * @return Value of member counter
- */
-int32_t TopicSample::Message::counter() const
-{
-    return m_counter;
-}
-
-/*!
- * @brief This function returns a reference to member counter
- * @return Reference to member counter
- */
-int32_t& TopicSample::Message::counter()
-{
-    return m_counter;
-}
-
-/*!
- * @brief This function sets a value in member sendtime
- * @param _sendtime New value for member sendtime
- */
-void TopicSample::Message::sendtime(int64_t _sendtime)
-{
-m_sendtime = _sendtime;
-}
-
-/*!
- * @brief This function returns the value of member sendtime
- * @return Value of member sendtime
- */
-int64_t TopicSample::Message::sendtime() const
-{
-    return m_sendtime;
-}
-
-/*!
- * @brief This function returns a reference to member sendtime
- * @return Reference to member sendtime
- */
-int64_t& TopicSample::Message::sendtime()
-{
-    return m_sendtime;
-}
-
-/*!
- * @brief This function copies the value in member xdata
- * @param _xdata New value to be copied in member xdata
- */
-void TopicSample::Message::xdata(const TopicSample::SomeBytes &_xdata)
-{
- //   return;
-  m_xdata = _xdata;
-//int i;
-//for(i=0;i<300;i++)
-//    m_xdata.push_back(_xdata.at(i));
-}
-
-/*!
- * @brief This function moves the value in member xdata
- * @param _xdata New value to be moved in member xdata
- */
-void TopicSample::Message::xdata(TopicSample::SomeBytes &&_xdata)
-{
-m_xdata = std::move(_xdata);
-}
-
-/*!
- * @brief This function returns a constant reference to member xdata
- * @return Constant reference to member xdata
- */
-const TopicSample::SomeBytes& TopicSample::Message::xdata() const
-{
-    return m_xdata;
-}
-
-/*!
- * @brief This function returns a reference to member xdata
- * @return Reference to member xdata
- */
-TopicSample::SomeBytes& TopicSample::Message::xdata()
-{
-    return m_xdata;
-}
-
-size_t TopicSample::Message::getKeyMaxCdrSerializedSize(size_t current_alignment)
-{
-    size_t current_align = current_alignment;
-
-
-
-
-
-
-
-    return current_align;
-}
-
-bool TopicSample::Message::isKeyDefined()
-{
-   return false;
-}
-
-void TopicSample::Message::serializeKey(eprosima::fastcdr::Cdr &scdr) const
-{
-    (void) scdr;
-     
-     
-     
-     
-}
-

+ 0 - 253
src1/common/modulecomm_fastrtps/Topics.h

@@ -1,253 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file Topics.h
- * This header file contains the declaration of the described types in the IDL file.
- *
- * This file was generated by the tool gen.
- */
-
-#ifndef _TOPICSAMPLE_TOPICS_H_
-#define _TOPICSAMPLE_TOPICS_H_
-
-// TODO Poner en el contexto.
-
-#include <stdint.h>
-#include <array>
-#include <string>
-#include <vector>
-#include <map>
-#include <bitset>
-
-#if defined(_WIN32)
-#if defined(EPROSIMA_USER_DLL_EXPORT)
-#define eProsima_user_DllExport __declspec( dllexport )
-#else
-#define eProsima_user_DllExport
-#endif
-#else
-#define eProsima_user_DllExport
-#endif
-
-#if defined(_WIN32)
-#if defined(EPROSIMA_USER_DLL_EXPORT)
-#if defined(Topics_SOURCE)
-#define Topics_DllAPI __declspec( dllexport )
-#else
-#define Topics_DllAPI __declspec( dllimport )
-#endif // Topics_SOURCE
-#else
-#define Topics_DllAPI
-#endif
-#else
-#define Topics_DllAPI
-#endif // _WIN32
-
-namespace eprosima
-{
-    namespace fastcdr
-    {
-        class Cdr;
-    }
-}
-
-
-namespace TopicSample
-{
-    typedef std::vector<uint8_t> SomeBytes;
-    /*!
-     * @brief This class represents the structure Message defined by the user in the IDL file.
-     * @ingroup TOPICS
-     */
-    class Message
-    {
-    public:
-
-        /*!
-         * @brief Default constructor.
-         */
-        eProsima_user_DllExport Message();
-
-        /*!
-         * @brief Default destructor.
-         */
-        eProsima_user_DllExport ~Message();
-
-        /*!
-         * @brief Copy constructor.
-         * @param x Reference to the object TopicSample::Message that will be copied.
-         */
-        eProsima_user_DllExport Message(const Message &x);
-
-        /*!
-         * @brief Move constructor.
-         * @param x Reference to the object TopicSample::Message that will be copied.
-         */
-        eProsima_user_DllExport Message(Message &&x);
-
-        /*!
-         * @brief Copy assignment.
-         * @param x Reference to the object TopicSample::Message that will be copied.
-         */
-        eProsima_user_DllExport Message& operator=(const Message &x);
-
-        /*!
-         * @brief Move assignment.
-         * @param x Reference to the object TopicSample::Message that will be copied.
-         */
-        eProsima_user_DllExport Message& operator=(Message &&x);
-
-        /*!
-         * @brief This function copies the value in member msgname
-         * @param _msgname New value to be copied in member msgname
-         */
-        eProsima_user_DllExport void msgname(const std::string &_msgname);
-
-        /*!
-         * @brief This function moves the value in member msgname
-         * @param _msgname New value to be moved in member msgname
-         */
-        eProsima_user_DllExport void msgname(std::string &&_msgname);
-
-        /*!
-         * @brief This function returns a constant reference to member msgname
-         * @return Constant reference to member msgname
-         */
-        eProsima_user_DllExport const std::string& msgname() const;
-
-        /*!
-         * @brief This function returns a reference to member msgname
-         * @return Reference to member msgname
-         */
-        eProsima_user_DllExport std::string& msgname();
-        /*!
-         * @brief This function sets a value in member counter
-         * @param _counter New value for member counter
-         */
-        eProsima_user_DllExport void counter(int32_t _counter);
-
-        /*!
-         * @brief This function returns the value of member counter
-         * @return Value of member counter
-         */
-        eProsima_user_DllExport int32_t counter() const;
-
-        /*!
-         * @brief This function returns a reference to member counter
-         * @return Reference to member counter
-         */
-        eProsima_user_DllExport int32_t& counter();
-
-        /*!
-         * @brief This function sets a value in member sendtime
-         * @param _sendtime New value for member sendtime
-         */
-        eProsima_user_DllExport void sendtime(int64_t _sendtime);
-
-        /*!
-         * @brief This function returns the value of member sendtime
-         * @return Value of member sendtime
-         */
-        eProsima_user_DllExport int64_t sendtime() const;
-
-        /*!
-         * @brief This function returns a reference to member sendtime
-         * @return Reference to member sendtime
-         */
-        eProsima_user_DllExport int64_t& sendtime();
-
-        /*!
-         * @brief This function copies the value in member xdata
-         * @param _xdata New value to be copied in member xdata
-         */
-        eProsima_user_DllExport void xdata(const TopicSample::SomeBytes &_xdata);
-
-        /*!
-         * @brief This function moves the value in member xdata
-         * @param _xdata New value to be moved in member xdata
-         */
-        eProsima_user_DllExport void xdata(TopicSample::SomeBytes &&_xdata);
-
-        /*!
-         * @brief This function returns a constant reference to member xdata
-         * @return Constant reference to member xdata
-         */
-        eProsima_user_DllExport const TopicSample::SomeBytes& xdata() const;
-
-        /*!
-         * @brief This function returns a reference to member xdata
-         * @return Reference to member xdata
-         */
-        eProsima_user_DllExport TopicSample::SomeBytes& xdata();
-
-        /*!
-         * @brief This function returns the maximum serialized size of an object
-         * depending on the buffer alignment.
-         * @param current_alignment Buffer alignment.
-         * @return Maximum serialized size.
-         */
-        eProsima_user_DllExport static size_t getMaxCdrSerializedSize(size_t current_alignment = 0);
-
-        /*!
-         * @brief This function returns the serialized size of a data depending on the buffer alignment.
-         * @param data Data which is calculated its serialized size.
-         * @param current_alignment Buffer alignment.
-         * @return Serialized size.
-         */
-        eProsima_user_DllExport static size_t getCdrSerializedSize(const TopicSample::Message& data, size_t current_alignment = 0);
-
-
-        /*!
-         * @brief This function serializes an object using CDR serialization.
-         * @param cdr CDR serialization object.
-         */
-        eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const;
-
-        /*!
-         * @brief This function deserializes an object using CDR serialization.
-         * @param cdr CDR serialization object.
-         */
-        eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr);
-
-
-
-        /*!
-         * @brief This function returns the maximum serialized size of the Key of an object
-         * depending on the buffer alignment.
-         * @param current_alignment Buffer alignment.
-         * @return Maximum serialized size.
-         */
-        eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize(size_t current_alignment = 0);
-
-        /*!
-         * @brief This function tells you if the Key has been defined for this type
-         */
-        eProsima_user_DllExport static bool isKeyDefined();
-
-        /*!
-         * @brief This function serializes the key members of an object using CDR serialization.
-         * @param cdr CDR serialization object.
-         */
-        eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const;
-
-    private:
-        std::string m_msgname;
-        int32_t m_counter;
-        int64_t m_sendtime;
-        TopicSample::SomeBytes m_xdata;
-    };
-}
-
-#endif // _TOPICSAMPLE_TOPICS_H_

+ 0 - 13
src1/common/modulecomm_fastrtps/Topics.idl

@@ -1,13 +0,0 @@
-module TopicSample {
-
-#pragma DCPS_DATA_TYPE "TopicSample::Message"
-
-typedef sequence<octet> SomeBytes;
-struct Message {
-  string msgname;
-  long counter;
-  long long sendtime;
-  SomeBytes   xdata;
-};
-
-};

+ 0 - 138
src1/common/modulecomm_fastrtps/TopicsPubSubTypes.cxx

@@ -1,138 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsPubSubTypes.cpp
- * This header file contains the implementation of the serialization functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#include <fastcdr/FastBuffer.h>
-#include <fastcdr/Cdr.h>
-
-#include "TopicsPubSubTypes.h"
-
-using namespace eprosima::fastrtps;
-using namespace eprosima::fastrtps::rtps;
-
-namespace TopicSample
-{
-
-    MessagePubSubType::MessagePubSubType()
-    {
-        setName("TopicSample::Message");
-        m_typeSize = static_cast<uint32_t>(Message::getMaxCdrSerializedSize()) + 4 /*encapsulation*/;
-        m_isGetKeyDefined = Message::isKeyDefined();
-        size_t keyLength = Message::getKeyMaxCdrSerializedSize()>16 ? Message::getKeyMaxCdrSerializedSize() : 16;
-        m_keyBuffer = reinterpret_cast<unsigned char*>(malloc(keyLength));
-        memset(m_keyBuffer, 0, keyLength);
-    }
-
-    MessagePubSubType::~MessagePubSubType()
-    {
-        if(m_keyBuffer!=nullptr)
-            free(m_keyBuffer);
-    }
-
-    bool MessagePubSubType::serialize(void *data, SerializedPayload_t *payload)
-    {
-        Message *p_type = static_cast<Message*>(data);
-        eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size); // Object that manages the raw buffer.
-        eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
-                eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data.
-        payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
-        // Serialize encapsulation
-        ser.serialize_encapsulation();
-
-        try
-        {
-            p_type->serialize(ser); // Serialize the object:
-        }
-        catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/)
-        {
-            return false;
-        }
-
-        payload->length = static_cast<uint32_t>(ser.getSerializedDataLength()); //Get the serialized length
-        return true;
-    }
-
-    bool MessagePubSubType::deserialize(SerializedPayload_t* payload, void* data)
-    {
-        Message* p_type = static_cast<Message*>(data); //Convert DATA to pointer of your type
-        eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->length); // Object that manages the raw buffer.
-        eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
-                eprosima::fastcdr::Cdr::DDS_CDR); // Object that deserializes the data.
-        // Deserialize encapsulation.
-        deser.read_encapsulation();
-        payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
-
-        try
-        {
-            p_type->deserialize(deser); //Deserialize the object:
-        }
-        catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/)
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    std::function<uint32_t()> MessagePubSubType::getSerializedSizeProvider(void* data)
-    {
-        return [data]() -> uint32_t
-        {
-            return static_cast<uint32_t>(type::getCdrSerializedSize(*static_cast<Message*>(data))) + 4 /*encapsulation*/;
-        };
-    }
-
-    void* MessagePubSubType::createData()
-    {
-        return reinterpret_cast<void*>(new Message());
-    }
-
-    void MessagePubSubType::deleteData(void* data)
-    {
-        delete(reinterpret_cast<Message*>(data));
-    }
-
-    bool MessagePubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5)
-    {
-        if(!m_isGetKeyDefined)
-            return false;
-        Message* p_type = static_cast<Message*>(data);
-        eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),Message::getKeyMaxCdrSerializedSize());     // Object that manages the raw buffer.
-        eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS);     // Object that serializes the data.
-        p_type->serializeKey(ser);
-        if(force_md5 || Message::getKeyMaxCdrSerializedSize()>16)    {
-            m_md5.init();
-            m_md5.update(m_keyBuffer, static_cast<unsigned int>(ser.getSerializedDataLength()));
-            m_md5.finalize();
-            for(uint8_t i = 0;i<16;++i)        {
-                handle->value[i] = m_md5.digest[i];
-            }
-        }
-        else    {
-            for(uint8_t i = 0;i<16;++i)        {
-                handle->value[i] = m_keyBuffer[i];
-            }
-        }
-        return true;
-    }
-
-
-} //End of namespace TopicSample

+ 0 - 61
src1/common/modulecomm_fastrtps/TopicsPubSubTypes.h

@@ -1,61 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsPubSubTypes.h
- * This header file contains the declaration of the serialization functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#ifndef _TOPICSAMPLE_TOPICS_PUBSUBTYPES_H_
-#define _TOPICSAMPLE_TOPICS_PUBSUBTYPES_H_
-
-#include <fastrtps/config.h>
-#include <fastrtps/TopicDataType.h>
-
-#include "Topics.h"
-
-#if !defined(GEN_API_VER) || (GEN_API_VER != 1)
-#error Generated Topics is not compatible with current installed Fast-RTPS. Please, regenerate it with fastrtpsgen.
-#endif
-
-namespace TopicSample
-{
-    typedef std::vector<uint8_t> SomeBytes;
-    /*!
-     * @brief This class represents the TopicDataType of the type Message defined by the user in the IDL file.
-     * @ingroup TOPICS
-     */
-    class MessagePubSubType : public eprosima::fastrtps::TopicDataType {
-    public:
-        typedef Message type;
-
-        eProsima_user_DllExport MessagePubSubType();
-
-        eProsima_user_DllExport virtual ~MessagePubSubType();
-        eProsima_user_DllExport virtual bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload) override;
-        eProsima_user_DllExport virtual bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data) override;
-        eProsima_user_DllExport virtual std::function<uint32_t()> getSerializedSizeProvider(void* data) override;
-        eProsima_user_DllExport virtual bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle,
-            bool force_md5 = false) override;
-        eProsima_user_DllExport virtual void* createData() override;
-        eProsima_user_DllExport virtual void deleteData(void * data) override;
-        MD5 m_md5;
-        unsigned char* m_keyBuffer;
-    };
-}
-
-#endif // _TOPICSAMPLE_TOPICS_PUBSUBTYPES_H_

+ 0 - 198
src1/common/modulecomm_fastrtps/TopicsPublisher.cxx

@@ -1,198 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsPublisher.cpp
- * This file contains the implementation of the publisher functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#include <fastrtps/participant/Participant.h>
-#include <fastrtps/attributes/ParticipantAttributes.h>
-#include <fastrtps/publisher/Publisher.h>
-#include <fastrtps/attributes/PublisherAttributes.h>
-
-#include <fastrtps/Domain.h>
-
-#include <fastrtps/participant/Participant.h>
-#include <fastrtps/attributes/ParticipantAttributes.h>
-#include <fastrtps/attributes/PublisherAttributes.h>
-#include <fastrtps/publisher/Publisher.h>
-#include <fastrtps/Domain.h>
-#include <fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h>
-#include <fastdds/rtps/transport/UDPv4TransportDescriptor.h>
-
-#include <thread>
-#include <chrono>
-
-#include "TopicsPublisher.h"
-
-using namespace eprosima::fastrtps;
-using namespace eprosima::fastrtps::rtps;
-
-using namespace eprosima::fastdds::rtps;
-
-TopicsPublisher::TopicsPublisher() : mp_participant(nullptr), mp_publisher(nullptr) {}
-
-TopicsPublisher::~TopicsPublisher() {	Domain::removeParticipant(mp_participant);}
-
-bool TopicsPublisher::init(const char * strtopic)
-{
-    strncpy(mstrtopic,strtopic,255);
-    // Create RTPSParticipant
-
-    ParticipantAttributes PParam;
-    PParam.rtps.sendSocketBufferSize = 100000000;
-    PParam.rtps.setName("Participant_publisher");  //You can put here the name you want
-
-    PParam.rtps.builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::SIMPLE;
-    PParam.rtps.builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = true;
-    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true;
-    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true;
-    PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
-
-    // SharedMem transport configuration
-    PParam.rtps.useBuiltinTransports = false;
-
-    auto shm_transport = std::make_shared<SharedMemTransportDescriptor>();
-    shm_transport->segment_size(100*1024*1024);
-    PParam.rtps.userTransports.push_back(shm_transport);
-
-    // UDP
-    auto udp_transport = std::make_shared<UDPv4TransportDescriptor>();
-    //udp_transport->interfaceWhiteList.push_back("127.0.0.1");
-    PParam.rtps.userTransports.push_back(udp_transport);
-
-
-    mp_participant = Domain::createParticipant(PParam);
-    if(mp_participant == nullptr)
-    {
-        return false;
-    }
-
-    //Register the type
-
-    Domain::registerType(mp_participant, static_cast<TopicDataType*>(&myType));
-
-    // Create Publisher
-
-    PublisherAttributes Wparam;
-    Wparam.topic.topicKind = NO_KEY;
-    Wparam.topic.topicDataType = myType.getName();  //This type MUST be registered
-    Wparam.topic.topicName = strtopic;//"TopicsPubSubTopic";
-
-    Wparam.topic.historyQos.depth = 30;
-    Wparam.topic.resourceLimitsQos.max_samples = 50;
-    Wparam.topic.resourceLimitsQos.allocated_samples = 20;
-    Wparam.times.heartbeatPeriod.seconds = 2;
-    Wparam.times.heartbeatPeriod.nanosec = 200 * 1000 * 1000;
-    Wparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
-    Wparam.qos.m_publishMode.kind = ASYNCHRONOUS_PUBLISH_MODE;
-
-    mp_publisher = Domain::createPublisher(mp_participant,Wparam,static_cast<PublisherListener*>(&m_listener));
-
-    if(mp_publisher == nullptr)
-    {
-        return false;
-    }
-
-    std::cout << "Publisher created, waiting for Subscribers." << std::endl;
-    return true;
-}
-
-void TopicsPublisher::PubListener::onPublicationMatched(Publisher* pub,MatchingInfo& info)
-{
-    (void)pub;
-
-    if (info.status == MATCHED_MATCHING)
-    {
-        n_matched++;
-        std::cout << "Publisher matched" << std::endl;
-    }
-    else
-    {
-        n_matched--;
-        std::cout << "Publisher unmatched" << std::endl;
-    }
-}
-
-void TopicsPublisher::run()
-{
-    while(m_listener.n_matched == 0)
-    {
-        std::this_thread::sleep_for(std::chrono::milliseconds(250)); // Sleep 250 ms
-    }
-
-    // Publication code
-
-    TopicSample::Message st;
-
-    /* Initialize your structure here */
-
-    int msgsent = 0;
-    char ch = 'y';
-    do
-    {
-        if(ch == 'y')
-        {
-            mp_publisher->write(&st);  ++msgsent;
-            std::cout << "Sending sample, count=" << msgsent << ", send another sample?(y-yes,n-stop): ";
-        }
-        else if(ch == 'n')
-        {
-            std::cout << "Stopping execution " << std::endl;
-            break;
-        }
-        else
-        {
-            std::cout << "Command " << ch << " not recognized, please enter \"y/n\":";
-        }
-    } while(std::cin >> ch);
-}
-
-#include <QDateTime>
-
-void TopicsPublisher::senddata(const char *str, int nsize)
-{
-
-
-    static int ncount = 1;
-    std::cout<<"send data."<<std::endl;
-//    while(m_listener.n_matched == 0)
-    TopicSample::SomeBytes x;
-    x.resize(nsize);
-    memcpy(x.data(),str,nsize);
-
-    TopicSample::Message st;
-
-    st.msgname(mstrtopic);
-//    st.msgname("topictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopic");
-    st.counter(ncount);ncount++;
-    st.sendtime(QDateTime::currentMSecsSinceEpoch());
-    TopicSample::SomeBytes & px = x;
-    st.xdata(x);
-
-    int ndatasize = TopicSample::Message::getCdrSerializedSize(st);
-
-    std::cout<<"size is "<<ndatasize<<std::endl;
-
-
-    mp_publisher->write(&st);
-
-
-
-}
-

+ 0 - 56
src1/common/modulecomm_fastrtps/TopicsPublisher.h

@@ -1,56 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsPublisher.h
- * This header file contains the declaration of the publisher functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#ifndef _TOPICSAMPLE_TOPICS_PUBLISHER_H_
-#define _TOPICSAMPLE_TOPICS_PUBLISHER_H_
-
-#include <fastrtps/fastrtps_fwd.h>
-#include <fastrtps/publisher/PublisherListener.h>
-
-#include "TopicsPubSubTypes.h"
-
-class TopicsPublisher
-{
-public:
-	TopicsPublisher();
-	virtual ~TopicsPublisher();
-    bool init(const char * strtopic);
-	void run();
-    void senddata(const char *str, int nsize);
-private:
-	eprosima::fastrtps::Participant *mp_participant;
-	eprosima::fastrtps::Publisher *mp_publisher;
-
-    char mstrtopic[256];
-
-	class PubListener : public eprosima::fastrtps::PublisherListener
-	{
-	public:
-		PubListener() : n_matched(0){};
-		~PubListener(){};
-		void onPublicationMatched(eprosima::fastrtps::Publisher* pub,eprosima::fastrtps::rtps::MatchingInfo& info);
-		int n_matched;
-	} m_listener;
-	TopicSample::MessagePubSubType myType;
-};
-
-#endif // _TOPICSAMPLE_TOPICS_PUBLISHER_H_

+ 0 - 206
src1/common/modulecomm_fastrtps/TopicsSubscriber.cxx

@@ -1,206 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsSubscriber.cpp
- * This file contains the implementation of the subscriber functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-#include <fastrtps/participant/Participant.h>
-#include <fastrtps/attributes/ParticipantAttributes.h>
-#include <fastrtps/subscriber/Subscriber.h>
-#include <fastrtps/attributes/SubscriberAttributes.h>
-
-#include <fastrtps/Domain.h>
-
-#include <fastcdr/FastBuffer.h>
-#include <fastcdr/FastCdr.h>
-#include <fastcdr/Cdr.h>
-
-#include <fastrtps/participant/Participant.h>
-#include <fastrtps/attributes/ParticipantAttributes.h>
-#include <fastrtps/attributes/PublisherAttributes.h>
-#include <fastrtps/publisher/Publisher.h>
-#include <fastrtps/Domain.h>
-#include <fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h>
-#include <fastdds/rtps/transport/UDPv4TransportDescriptor.h>
-
-#include "TopicsSubscriber.h"
-
-using namespace eprosima::fastrtps;
-using namespace eprosima::fastrtps::rtps;
-
-using namespace eprosima::fastdds::rtps;
-
-
-
-
-#include <QDateTime>
-
-TopicsSubscriber::TopicsSubscriber() : mp_participant(nullptr), mp_subscriber(nullptr) {}
-
-TopicsSubscriber::~TopicsSubscriber() {	Domain::removeParticipant(mp_participant);}
-
-bool TopicsSubscriber::init(const char * strtopic)
-{
-
-    strncpy(mstrtopic,strtopic,255);
-    // Create RTPSParticipant
-
-    ParticipantAttributes PParam;
-    PParam.rtps.setName("Participant_subscriber"); //You can put the name you want
-
-    PParam.rtps.builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::SIMPLE;
-    PParam.rtps.builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = true;
-    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true;
-    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true;
-    PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
-
-    // SharedMem transport configuration
-    PParam.rtps.useBuiltinTransports = false;
-
-    auto sm_transport = std::make_shared<SharedMemTransportDescriptor>();
-    sm_transport->segment_size(100*1024*1024);
-    PParam.rtps.userTransports.push_back(sm_transport);
-
-    // UDP
-    auto udp_transport = std::make_shared<UDPv4TransportDescriptor>();
-    //udp_transport->interfaceWhiteList.push_back("127.0.0.1");
-    PParam.rtps.userTransports.push_back(udp_transport);
-
-
-
-    mp_participant = Domain::createParticipant(PParam);
-    if(mp_participant == nullptr)
-    {
-        return false;
-    }
-
-    //Register the type
-
-    Domain::registerType(mp_participant, static_cast<TopicDataType*>(&myType));
-
-    // Create Subscriber
-
-    SubscriberAttributes Rparam;
-    Rparam.topic.topicKind = NO_KEY;
-    Rparam.topic.topicDataType = myType.getName(); //Must be registered before the creation of the subscriber
-    Rparam.topic.topicName = strtopic;//"TopicsPubSubTopic";
-
-    Rparam.topic.historyQos.depth = 30;
-    Rparam.topic.resourceLimitsQos.max_samples = 50;
-    Rparam.topic.resourceLimitsQos.allocated_samples = 20;
-
-    Rparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
-
-
-    mp_subscriber = Domain::createSubscriber(mp_participant,Rparam, static_cast<SubscriberListener*>(&m_listener));
-    if(mp_subscriber == nullptr)
-    {
-        return false;
-    }
-    return true;
-}
-
-void TopicsSubscriber::SubListener::onSubscriptionMatched(Subscriber* sub,MatchingInfo& info)
-{
-    (void)sub;
-
-    if (info.status == MATCHED_MATCHING)
-    {
-        n_matched++;
-        std::cout << "Subscriber matched" << std::endl;
-    }
-    else
-    {
-        n_matched--;
-        std::cout << "Subscriber unmatched" << std::endl;
-    }
-}
-
-
-void TopicsSubscriber::SubListener::setReceivedTopicFunction(ModuleFun xFun)
-{
-    mFun = xFun;
-    mbSetFun = true;
-}
-void TopicsSubscriber::SubListener::onNewDataMessage(Subscriber* sub)
-{
-    // Take data
-    TopicSample::Message st;
-    static int ncount = 0;
-
-    static int nmaxlatancy = 0;
-
-    std::cout<<"new msg"<<std::endl;
-
-
-//    char * strbuf = new char[1000000];
-//    eprosima::fastcdr::FastBuffer pbuf(strbuf,1000000);
-//    eprosima::fastcdr::Cdr * pxcdr;//
-//    pxcdr = new eprosima::fastcdr::Cdr(pbuf);
-
-//    if(sub->takeNextData(pxcdr, &m_info))
-//    {
-//        if(m_info.sampleKind == ALIVE)
-//        {
-//            // Print your structure data here.
-//            ++n_msg;
-//            std::cout << "Sample received, count=" << n_msg<<std::endl;
-//            st.deserialize(*pxcdr);
-
-//            std::cout<<" size is "<<TopicSample::Message::getCdrSerializedSize(st)<<std::endl;
-//        }
-//    }
-
-//    return;
-
-//    sub->get_first_untaken_info(&m_info);
-    std::cout<<"count is "<<sub->getUnreadCount()<<std::endl;
-
-    if(sub->takeNextData(&st, &m_info))
-    {
-        if(m_info.sampleKind == ALIVE)
-        {
-            // Print your structure data here.
-            ++n_msg;
-            ncount++;
-            std::cout << "Sample received, count=" << st.counter() <<" total: "<<ncount<<std::endl;
-            qint64 timex = QDateTime::currentMSecsSinceEpoch();
-            int nlatancy = (timex - st.sendtime());
-            if(nlatancy>nmaxlatancy)nmaxlatancy = nlatancy;
-            std::cout<<"  latency is "<<nlatancy<<" max: "<<nmaxlatancy<<std::endl;
-            std::cout<<" size is "<<st.xdata().size()<<std::endl;
-            QDateTime dt = QDateTime::fromMSecsSinceEpoch(st.sendtime());
-            if(mbSetFun) mFun((char *)(st.xdata().data()),st.xdata().size(),st.counter(),&dt,st.msgname().data());
-
-
-        }
-    }
-}
-
-void TopicsSubscriber::setReceivedTopicFunction(ModuleFun xFun)
-{
-    m_listener.setReceivedTopicFunction(xFun);
-}
-
-void TopicsSubscriber::run()
-{
-    std::cout << "Waiting for Data, press Enter to stop the Subscriber. "<<std::endl;
-    std::cin.ignore();
-    std::cout << "Shutting down the Subscriber." << std::endl;
-}
-

+ 0 - 72
src1/common/modulecomm_fastrtps/TopicsSubscriber.h

@@ -1,72 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsSubscriber.h
- * This header file contains the declaration of the subscriber functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#ifndef _TOPICSAMPLE_TOPICS_SUBSCRIBER_H_
-#define _TOPICSAMPLE_TOPICS_SUBSCRIBER_H_
-
-#include <fastrtps/fastrtps_fwd.h>
-#include <fastrtps/subscriber/SubscriberListener.h>
-#include <fastrtps/subscriber/SampleInfo.h>
-#include "TopicsPubSubTypes.h"
-
-
-#include <QDateTime>
-
-typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
-
-class TopicsSubscriber
-{
-public:
-	TopicsSubscriber();
-	virtual ~TopicsSubscriber();
-    bool init(const char * strtopic);
-	void run();
-
-    void setReceivedTopicFunction(ModuleFun xFun);
-private:
-	eprosima::fastrtps::Participant *mp_participant;
-	eprosima::fastrtps::Subscriber *mp_subscriber;
-
-
-    char mstrtopic[256];
-
-	class SubListener : public eprosima::fastrtps::SubscriberListener
-	{
-	public:
-		SubListener() : n_matched(0),n_msg(0){};
-		~SubListener(){};
-		void onSubscriptionMatched(eprosima::fastrtps::Subscriber* sub,eprosima::fastrtps::rtps::MatchingInfo& info);
-		void onNewDataMessage(eprosima::fastrtps::Subscriber* sub);
-		eprosima::fastrtps::SampleInfo_t m_info;
-		int n_matched;
-		int n_msg;
-
-        void setReceivedTopicFunction(ModuleFun xFun);
-
-    private:
-        bool mbSetFun = false;
-        ModuleFun mFun;
-	} m_listener;
-	TopicSample::MessagePubSubType myType;
-};
-
-#endif // _TOPICSAMPLE_TOPICS_SUBSCRIBER_H_

+ 0 - 13
src1/common/modulecomm_fastrtps/ivmodulemsg_type.h

@@ -1,13 +0,0 @@
-#ifndef IVMODULEMSG_TYPE_H
-#define IVMODULEMSG_TYPE_H
-
-namespace iv {
-struct modulemsg_type
-{
-    char mstrmsgname[256];
-    int mnBufSize;
-    int mnMsgBufCount;
-};
-
-}
-#endif // IVMODULEMSG_TYPE_H

+ 0 - 63
src1/common/modulecomm_fastrtps/modulecomm_fastrtps.cpp

@@ -1,63 +0,0 @@
-#include "modulecomm_fastrtps.h".h"
-//#include "procsm_if.h"
-//#include "procsm.h"
-
-#include "modulecomm_impl.h"
-
-namespace iv {
-namespace modulecomm_fastrtps {
-
-
-void *  RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount)
-{
-
-
-    modulecomm_impl * pif = new modulecomm_impl(strcommname,modulecomm_impl::type_send);
-
-//    procsm_if * pif = new procsm_if(strcommname,nBufSize,nMsgBufCount,procsm::ModeWrite);
-    return (void *)pif;
-}
-
-void  *  RegisterRecv(const char * strcommname,SMCallBack pCall)
-{
-    modulecomm_impl * pif = new modulecomm_impl(strcommname,modulecomm_impl::type_recv);
- //   procsm_if * pif = new procsm_if(strcommname,0,0,procsm::ModeRead);
-    pif->listenmsg(pCall);
-    return (void *)pif;
-}
-
-void * MODULECOMMFASTRTPSSHARED_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun)
-{
-    modulecomm_impl * pif = new modulecomm_impl(strcommname,modulecomm_impl::type_recv);
- //   procsm_if * pif = new procsm_if(strcommname,0,0,procsm::ModeRead);
-    pif->listenmsg(xFun);
-    return (void *)pif;
-}
-void  ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen)
-{
-    modulecomm_impl * pif= (modulecomm_impl *)pHandle;
- //   procsm_if * pif = (procsm_if *)pHandle;
-    pif->writemsg(strdata,nDataLen);
-}
-
-void  Unregister(void * pHandle)
-{
-    modulecomm_impl * pif= (modulecomm_impl *)pHandle;
-//    procsm_if * pif = (procsm_if *)pHandle;
-    delete pif;
-}
-
-void PauseComm(void *pHandle)
-{
-//    procsm_if * pif = (procsm_if *)pHandle;
-//    pif->pausecomm();
-}
-
-void ContintuComm(void *pHandle)
-{
- //   procsm_if * pif = (procsm_if *)pHandle;
- //   pif->continuecomm();
-}
-
-}
-}

+ 0 - 40
src1/common/modulecomm_fastrtps/modulecomm_fastrtps.h

@@ -1,40 +0,0 @@
-#ifndef MODULECOMM_FASTRTPS_H
-#define MODULECOMM_FASTRTPS_H
-
-#include <QtCore/qglobal.h>
-#include <QDateTime>
-
-#include <functional>
-
-#if defined(MODULECOMM_FASTRTPS_LIBRARY)
-#  define MODULECOMMFASTRTPSSHARED_EXPORT Q_DECL_EXPORT
-#else
-#  define MODULECOMMFASTRTPSSHARED_EXPORT Q_DECL_IMPORT
-#endif
-
-
-
-//#include <iostream>
-//#include <thread>
-
-//using namespace std::placeholders;
-typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
-typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
-
-namespace iv {
-namespace modulecomm_fastrtps {
-void * MODULECOMMFASTRTPSSHARED_EXPORT RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount);
-void * MODULECOMMFASTRTPSSHARED_EXPORT RegisterRecv(const char * strcommname,SMCallBack pCall);
-void * MODULECOMMFASTRTPSSHARED_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun);
-void MODULECOMMFASTRTPSSHARED_EXPORT ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen);
-void MODULECOMMFASTRTPSSHARED_EXPORT Unregister(void * pHandle);
-void MODULECOMMFASTRTPSSHARED_EXPORT PauseComm(void * pHandle);
-void MODULECOMMFASTRTPSSHARED_EXPORT ContintuComm(void * pHandle);
-
-}
-
-}
-
-
-
-#endif 

+ 0 - 45
src1/common/modulecomm_fastrtps/modulecomm_fastrtps.pro

@@ -1,45 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2018-07-10T05:46:48
-#
-#-------------------------------------------------
-
-QT       -= gui
-
-
-#DEFINES += dds_use_shm
-
-TARGET = modulecomm_fastrtps
-TEMPLATE = lib
-
-DEFINES += MODULECOMM_FASTRTPS_LIBRARY
-
-VERSION = 1.0.1
-CONFIG += plugin
-
-
-SOURCES += modulecomm_fastrtps.cpp \
-    Topics.cxx \
-    TopicsPubSubTypes.cxx \
-    TopicsPublisher.cxx \
-    TopicsSubscriber.cxx \
-    modulecomm_impl.cpp
-
-HEADERS += modulecomm_fastrtps.h \
-    Topics.h \
-    TopicsPubSubTypes.h \
-    TopicsPublisher.h \
-    TopicsSubscriber.h \
-    modulecomm_impl.h \
-    ivmodulemsg_type.h
-
-unix {
-    target.path = /usr/lib
-    INSTALLS += target
-}
-
-#INCLUDEPATH += $$PWD/../../../include/
-
-
-LIBS += -L$$PWD -lfastcdr -lfastrtps
-

+ 0 - 140
src1/common/modulecomm_fastrtps/modulecomm_impl.cpp

@@ -1,140 +0,0 @@
-#include "modulecomm_impl.h"
-
-#include <thread>
-#include <iostream>
-#include <QDateTime>
-
-#include <QMutex>
-#include <QFile>
-
-namespace iv {
-namespace modulecomm {
-QMutex gmodulecomm_dds_Mutex;
-int createcount = 0;
-}
-
-}
-
-
-void modulecomm_impl::callbackTopic(const char * strdata,const unsigned int nSize,const unsigned int index, QDateTime * dt,const char * strmemname) {
-
-  if(mbFunPlus)
-  {
-      mFun(strdata,nSize,index,dt,strmemname);
-  }
-  else
-  {
-     (*mpCall)(strdata,nSize,index,dt,strmemname);
-  }
-}
-
-
-int modulecomm_impl::GetTempConfPath(char *strpath)
-{
-    char strtmppath[256];
-    QDateTime dt = QDateTime::currentDateTime();
-    snprintf(strtmppath,256,"/tmp/adc_modulecomm_conf_%04d%02d%02d%02d%02d.ini",dt.date().year(),
-             dt.date().month(),dt.date().day(),dt.time().hour(),dt.time().minute());
-    QFile xFile;
-    xFile.setFileName(strtmppath);
-    char strtem[256];
-    char strdata[10000];
-    snprintf(strdata,10000,"");
-    if(!xFile.exists())
-    {
-        if(xFile.open(QIODevice::ReadWrite))
-        {
-            snprintf(strtem,256,"[common]\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"DCPSDefaultDiscovery=TheRTPSConfig\n");strncat(strdata,strtem,10000);
-#ifdef dds_use_shm
-            snprintf(strtem,256,"DCPSGlobalTransportConfig=myconfig\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"[config/myconfig]\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"transports=share\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"[transport/share]\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"transport_type=shmem\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"pool_size=100000000\n");strncat(strdata,strtem,10000);
-#endif
-            snprintf(strtem,256,"[rtps_discovery/TheRTPSConfig]\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"ResendPeriod=5\n");strncat(strdata,strtem,10000);
-            xFile.write(strdata,strnlen(strdata,10000));
-            xFile.close();
-        }
-    }
-    strncpy(strpath,strtmppath,255);
-    return 0;
-}
-
-modulecomm_impl::modulecomm_impl(const char * strcommname,int ntype )
-{
-
-    strncpy(mstrtopic,strcommname,255);
-
-    iv::modulecomm::gmodulecomm_dds_Mutex.lock();
-    if(ntype == type_recv)
-    {
-        mpSub = new TopicsSubscriber();
-        mpSub->init(strcommname);
-//        std::this_thread::sleep_for(std::chrono::milliseconds(10));
-
-        mnType = type_recv;
-    }
-    else
-    {
-        mpPub = new TopicsPublisher();
-        mpPub->init(strcommname);
- //       std::this_thread::sleep_for(std::chrono::milliseconds(10));
-        mnType = type_send;
-    }
-    iv::modulecomm::createcount++;
-    std::cout<<"count is "<<iv::modulecomm::createcount<<std::endl;
-    iv::modulecomm::gmodulecomm_dds_Mutex.unlock();
-
-}
-
-int modulecomm_impl::listenmsg(ModuleFun xFun)
-{
-    if(mnType == type_send)
-    {
-        std::cout<<"send not listen."<<std::endl;;
-        return -1;
-    }
-    mbFunPlus = true;
-    mFun = xFun;
-    ModuleFun topicFunction = std::bind(&modulecomm_impl::callbackTopic,this,std::placeholders::_1,
-                                                                                std::placeholders::_2,
-                                                                                std::placeholders::_3,
-                                                                                std::placeholders::_4,
-                                                                                std::placeholders::_5);
-    mpSub->setReceivedTopicFunction(topicFunction);
-    return 0;
-}
-
-int modulecomm_impl::listenmsg(SMCallBack pCall)
-{
-    if(mnType == type_send)
-    {
-        std::cout<<"send not listen."<<std::endl;
-        return -1;
-    }
-    mbFunPlus = false;
-    mpCall = pCall;
-    ModuleFun topicFunction = std::bind(&modulecomm_impl::callbackTopic,this,std::placeholders::_1,
-                                                                                std::placeholders::_2,
-                                                                                std::placeholders::_3,
-                                                                                std::placeholders::_4,
-                                                                                std::placeholders::_5);
-    mpSub->setReceivedTopicFunction(topicFunction);
-    return 0;
-}
-
-void modulecomm_impl::writemsg(const char *str, int nlen)
-{
-    if(mnType == type_recv)
-    {
-        std::cout<<"recv not send."<<std::endl;
-        return ;
-    }
-
-    mpPub->senddata(str,nlen);
-
-}

+ 0 - 41
src1/common/modulecomm_fastrtps/modulecomm_impl.h

@@ -1,41 +0,0 @@
-#ifndef MODULECOMM_IMPL_H
-#define MODULECOMM_IMPL_H
-
-#include <QDateTime>
-
-#include "TopicsPublisher.h"
-#include "TopicsSubscriber.h"
-
-
-typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
-
-
-class modulecomm_impl
-{
-public:
-    const static int type_send = 1;
-    const static int type_recv = 2;
-public:
-    modulecomm_impl(const char * strcommname,int ntype = 2);
-    int listenmsg(SMCallBack pCall);
-    int listenmsg(ModuleFun xFun);
-    void writemsg(const char * str,int nlen);
-
-private:
-    char mstrtopic[256];
-    int mnType = type_recv;
-    TopicsPublisher * mpPub;
-    TopicsSubscriber * mpSub;
-    SMCallBack  mpCall;
-    ModuleFun mFun;
-    void callbackTopic(const char * strdata,const unsigned int nSize,const unsigned int index,QDateTime * dt,const char * strmemname);
-
-    int GetTempConfPath(char * strpath);
-
-
-
-    bool mbFunPlus = false;
-
-};
-
-#endif // MODULECOMM_IMPL_H

+ 0 - 323
src1/common/modulecomm_fastrtps_tcp/Topics.cxx

@@ -1,323 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file Topics.cpp
- * This source file contains the definition of the described types in the IDL file.
- *
- * This file was generated by the tool gen.
- */
-
-#ifdef _WIN32
-// Remove linker warning LNK4221 on Visual Studio
-namespace { char dummy; }
-#endif
-
-#include "Topics.h"
-#include <fastcdr/Cdr.h>
-
-#include <fastcdr/exceptions/BadParamException.h>
-using namespace eprosima::fastcdr::exception;
-
-#include <utility>
-
-
-TopicSample::Message::Message()
-{
-    // m_msgname com.eprosima.idl.parser.typecode.StringTypeCode@76329302
-    m_msgname ="";
-    // m_counter com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5e25a92e
-    m_counter = 0;
-    // m_sendtime com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4df828d7
-    m_sendtime = 0;
-    // m_xdata com.eprosima.idl.parser.typecode.AliasTypeCode@b59d31
-
-    m_xdata.push_back(1);
-    m_xdata.push_back(2);
-
-
-}
-
-TopicSample::Message::~Message()
-{
-
-
-
-
-}
-
-TopicSample::Message::Message(const Message &x)
-{
-    m_msgname = x.m_msgname;
-    m_counter = x.m_counter;
-    m_sendtime = x.m_sendtime;
-    m_xdata = x.m_xdata;
-}
-
-TopicSample::Message::Message(Message &&x)
-{
-    m_msgname = std::move(x.m_msgname);
-    m_counter = x.m_counter;
-    m_sendtime = x.m_sendtime;
-    m_xdata = std::move(x.m_xdata);
-}
-
-TopicSample::Message& TopicSample::Message::operator=(const Message &x)
-{
-
-    m_msgname = x.m_msgname;
-    m_counter = x.m_counter;
-    m_sendtime = x.m_sendtime;
-    m_xdata = x.m_xdata;
-
-    return *this;
-}
-
-TopicSample::Message& TopicSample::Message::operator=(Message &&x)
-{
-
-    m_msgname = std::move(x.m_msgname);
-    m_counter = x.m_counter;
-    m_sendtime = x.m_sendtime;
-    m_xdata = std::move(x.m_xdata);
-
-    return *this;
-}
-
-size_t TopicSample::Message::getMaxCdrSerializedSize(size_t current_alignment)
-{
-    size_t initial_alignment = current_alignment;
-
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1;
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
-
-
-    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
-
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
-
-    current_alignment += (100 * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
-
-
-
-    return 10000000;
-//    return current_alignment - initial_alignment;
-}
-
-size_t TopicSample::Message::getCdrSerializedSize(const TopicSample::Message& data, size_t current_alignment)
-{
-    (void)data;
-    size_t initial_alignment = current_alignment;
-
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.msgname().size() + 1;
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
-
-
-    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
-
-
-    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
-
-    if (data.xdata().size() > 0)
-    {
-        current_alignment += (data.xdata().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
-    }
-
-
-
-
-    return current_alignment - initial_alignment;
-}
-
-void TopicSample::Message::serialize(eprosima::fastcdr::Cdr &scdr) const
-{
-
-    scdr << m_msgname;
-    scdr << m_counter;
-    scdr << m_sendtime;
-    scdr << m_xdata;
-
-//    std::cout<<"serialize."<<std::endl;
-}
-
-void TopicSample::Message::deserialize(eprosima::fastcdr::Cdr &dcdr)
-{
-
-    dcdr >> m_msgname;
-    dcdr >> m_counter;
-    dcdr >> m_sendtime;
-    dcdr >> m_xdata;
-}
-
-/*!
- * @brief This function copies the value in member msgname
- * @param _msgname New value to be copied in member msgname
- */
-void TopicSample::Message::msgname(const std::string &_msgname)
-{
-m_msgname = _msgname;
-}
-
-/*!
- * @brief This function moves the value in member msgname
- * @param _msgname New value to be moved in member msgname
- */
-void TopicSample::Message::msgname(std::string &&_msgname)
-{
-m_msgname = std::move(_msgname);
-}
-
-/*!
- * @brief This function returns a constant reference to member msgname
- * @return Constant reference to member msgname
- */
-const std::string& TopicSample::Message::msgname() const
-{
-    return m_msgname;
-}
-
-/*!
- * @brief This function returns a reference to member msgname
- * @return Reference to member msgname
- */
-std::string& TopicSample::Message::msgname()
-{
-    return m_msgname;
-}
-/*!
- * @brief This function sets a value in member counter
- * @param _counter New value for member counter
- */
-void TopicSample::Message::counter(int32_t _counter)
-{
-m_counter = _counter;
-}
-
-/*!
- * @brief This function returns the value of member counter
- * @return Value of member counter
- */
-int32_t TopicSample::Message::counter() const
-{
-    return m_counter;
-}
-
-/*!
- * @brief This function returns a reference to member counter
- * @return Reference to member counter
- */
-int32_t& TopicSample::Message::counter()
-{
-    return m_counter;
-}
-
-/*!
- * @brief This function sets a value in member sendtime
- * @param _sendtime New value for member sendtime
- */
-void TopicSample::Message::sendtime(int64_t _sendtime)
-{
-m_sendtime = _sendtime;
-}
-
-/*!
- * @brief This function returns the value of member sendtime
- * @return Value of member sendtime
- */
-int64_t TopicSample::Message::sendtime() const
-{
-    return m_sendtime;
-}
-
-/*!
- * @brief This function returns a reference to member sendtime
- * @return Reference to member sendtime
- */
-int64_t& TopicSample::Message::sendtime()
-{
-    return m_sendtime;
-}
-
-/*!
- * @brief This function copies the value in member xdata
- * @param _xdata New value to be copied in member xdata
- */
-void TopicSample::Message::xdata(const TopicSample::SomeBytes &_xdata)
-{
- //   return;
-  m_xdata = _xdata;
-//int i;
-//for(i=0;i<300;i++)
-//    m_xdata.push_back(_xdata.at(i));
-}
-
-/*!
- * @brief This function moves the value in member xdata
- * @param _xdata New value to be moved in member xdata
- */
-void TopicSample::Message::xdata(TopicSample::SomeBytes &&_xdata)
-{
-m_xdata = std::move(_xdata);
-}
-
-/*!
- * @brief This function returns a constant reference to member xdata
- * @return Constant reference to member xdata
- */
-const TopicSample::SomeBytes& TopicSample::Message::xdata() const
-{
-    return m_xdata;
-}
-
-/*!
- * @brief This function returns a reference to member xdata
- * @return Reference to member xdata
- */
-TopicSample::SomeBytes& TopicSample::Message::xdata()
-{
-    return m_xdata;
-}
-
-size_t TopicSample::Message::getKeyMaxCdrSerializedSize(size_t current_alignment)
-{
-    size_t current_align = current_alignment;
-
-
-
-
-
-
-
-    return current_align;
-}
-
-bool TopicSample::Message::isKeyDefined()
-{
-   return false;
-}
-
-void TopicSample::Message::serializeKey(eprosima::fastcdr::Cdr &scdr) const
-{
-    (void) scdr;
-     
-     
-     
-     
-}
-

+ 0 - 253
src1/common/modulecomm_fastrtps_tcp/Topics.h

@@ -1,253 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file Topics.h
- * This header file contains the declaration of the described types in the IDL file.
- *
- * This file was generated by the tool gen.
- */
-
-#ifndef _TOPICSAMPLE_TOPICS_H_
-#define _TOPICSAMPLE_TOPICS_H_
-
-// TODO Poner en el contexto.
-
-#include <stdint.h>
-#include <array>
-#include <string>
-#include <vector>
-#include <map>
-#include <bitset>
-
-#if defined(_WIN32)
-#if defined(EPROSIMA_USER_DLL_EXPORT)
-#define eProsima_user_DllExport __declspec( dllexport )
-#else
-#define eProsima_user_DllExport
-#endif
-#else
-#define eProsima_user_DllExport
-#endif
-
-#if defined(_WIN32)
-#if defined(EPROSIMA_USER_DLL_EXPORT)
-#if defined(Topics_SOURCE)
-#define Topics_DllAPI __declspec( dllexport )
-#else
-#define Topics_DllAPI __declspec( dllimport )
-#endif // Topics_SOURCE
-#else
-#define Topics_DllAPI
-#endif
-#else
-#define Topics_DllAPI
-#endif // _WIN32
-
-namespace eprosima
-{
-    namespace fastcdr
-    {
-        class Cdr;
-    }
-}
-
-
-namespace TopicSample
-{
-    typedef std::vector<uint8_t> SomeBytes;
-    /*!
-     * @brief This class represents the structure Message defined by the user in the IDL file.
-     * @ingroup TOPICS
-     */
-    class Message
-    {
-    public:
-
-        /*!
-         * @brief Default constructor.
-         */
-        eProsima_user_DllExport Message();
-
-        /*!
-         * @brief Default destructor.
-         */
-        eProsima_user_DllExport ~Message();
-
-        /*!
-         * @brief Copy constructor.
-         * @param x Reference to the object TopicSample::Message that will be copied.
-         */
-        eProsima_user_DllExport Message(const Message &x);
-
-        /*!
-         * @brief Move constructor.
-         * @param x Reference to the object TopicSample::Message that will be copied.
-         */
-        eProsima_user_DllExport Message(Message &&x);
-
-        /*!
-         * @brief Copy assignment.
-         * @param x Reference to the object TopicSample::Message that will be copied.
-         */
-        eProsima_user_DllExport Message& operator=(const Message &x);
-
-        /*!
-         * @brief Move assignment.
-         * @param x Reference to the object TopicSample::Message that will be copied.
-         */
-        eProsima_user_DllExport Message& operator=(Message &&x);
-
-        /*!
-         * @brief This function copies the value in member msgname
-         * @param _msgname New value to be copied in member msgname
-         */
-        eProsima_user_DllExport void msgname(const std::string &_msgname);
-
-        /*!
-         * @brief This function moves the value in member msgname
-         * @param _msgname New value to be moved in member msgname
-         */
-        eProsima_user_DllExport void msgname(std::string &&_msgname);
-
-        /*!
-         * @brief This function returns a constant reference to member msgname
-         * @return Constant reference to member msgname
-         */
-        eProsima_user_DllExport const std::string& msgname() const;
-
-        /*!
-         * @brief This function returns a reference to member msgname
-         * @return Reference to member msgname
-         */
-        eProsima_user_DllExport std::string& msgname();
-        /*!
-         * @brief This function sets a value in member counter
-         * @param _counter New value for member counter
-         */
-        eProsima_user_DllExport void counter(int32_t _counter);
-
-        /*!
-         * @brief This function returns the value of member counter
-         * @return Value of member counter
-         */
-        eProsima_user_DllExport int32_t counter() const;
-
-        /*!
-         * @brief This function returns a reference to member counter
-         * @return Reference to member counter
-         */
-        eProsima_user_DllExport int32_t& counter();
-
-        /*!
-         * @brief This function sets a value in member sendtime
-         * @param _sendtime New value for member sendtime
-         */
-        eProsima_user_DllExport void sendtime(int64_t _sendtime);
-
-        /*!
-         * @brief This function returns the value of member sendtime
-         * @return Value of member sendtime
-         */
-        eProsima_user_DllExport int64_t sendtime() const;
-
-        /*!
-         * @brief This function returns a reference to member sendtime
-         * @return Reference to member sendtime
-         */
-        eProsima_user_DllExport int64_t& sendtime();
-
-        /*!
-         * @brief This function copies the value in member xdata
-         * @param _xdata New value to be copied in member xdata
-         */
-        eProsima_user_DllExport void xdata(const TopicSample::SomeBytes &_xdata);
-
-        /*!
-         * @brief This function moves the value in member xdata
-         * @param _xdata New value to be moved in member xdata
-         */
-        eProsima_user_DllExport void xdata(TopicSample::SomeBytes &&_xdata);
-
-        /*!
-         * @brief This function returns a constant reference to member xdata
-         * @return Constant reference to member xdata
-         */
-        eProsima_user_DllExport const TopicSample::SomeBytes& xdata() const;
-
-        /*!
-         * @brief This function returns a reference to member xdata
-         * @return Reference to member xdata
-         */
-        eProsima_user_DllExport TopicSample::SomeBytes& xdata();
-
-        /*!
-         * @brief This function returns the maximum serialized size of an object
-         * depending on the buffer alignment.
-         * @param current_alignment Buffer alignment.
-         * @return Maximum serialized size.
-         */
-        eProsima_user_DllExport static size_t getMaxCdrSerializedSize(size_t current_alignment = 0);
-
-        /*!
-         * @brief This function returns the serialized size of a data depending on the buffer alignment.
-         * @param data Data which is calculated its serialized size.
-         * @param current_alignment Buffer alignment.
-         * @return Serialized size.
-         */
-        eProsima_user_DllExport static size_t getCdrSerializedSize(const TopicSample::Message& data, size_t current_alignment = 0);
-
-
-        /*!
-         * @brief This function serializes an object using CDR serialization.
-         * @param cdr CDR serialization object.
-         */
-        eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const;
-
-        /*!
-         * @brief This function deserializes an object using CDR serialization.
-         * @param cdr CDR serialization object.
-         */
-        eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr);
-
-
-
-        /*!
-         * @brief This function returns the maximum serialized size of the Key of an object
-         * depending on the buffer alignment.
-         * @param current_alignment Buffer alignment.
-         * @return Maximum serialized size.
-         */
-        eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize(size_t current_alignment = 0);
-
-        /*!
-         * @brief This function tells you if the Key has been defined for this type
-         */
-        eProsima_user_DllExport static bool isKeyDefined();
-
-        /*!
-         * @brief This function serializes the key members of an object using CDR serialization.
-         * @param cdr CDR serialization object.
-         */
-        eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const;
-
-    private:
-        std::string m_msgname;
-        int32_t m_counter;
-        int64_t m_sendtime;
-        TopicSample::SomeBytes m_xdata;
-    };
-}
-
-#endif // _TOPICSAMPLE_TOPICS_H_

+ 0 - 13
src1/common/modulecomm_fastrtps_tcp/Topics.idl

@@ -1,13 +0,0 @@
-module TopicSample {
-
-#pragma DCPS_DATA_TYPE "TopicSample::Message"
-
-typedef sequence<octet> SomeBytes;
-struct Message {
-  string msgname;
-  long counter;
-  long long sendtime;
-  SomeBytes   xdata;
-};
-
-};

+ 0 - 138
src1/common/modulecomm_fastrtps_tcp/TopicsPubSubTypes.cxx

@@ -1,138 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsPubSubTypes.cpp
- * This header file contains the implementation of the serialization functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#include <fastcdr/FastBuffer.h>
-#include <fastcdr/Cdr.h>
-
-#include "TopicsPubSubTypes.h"
-
-using namespace eprosima::fastrtps;
-using namespace eprosima::fastrtps::rtps;
-
-namespace TopicSample
-{
-
-    MessagePubSubType::MessagePubSubType()
-    {
-        setName("TopicSample::Message");
-        m_typeSize = static_cast<uint32_t>(Message::getMaxCdrSerializedSize()) + 4 /*encapsulation*/;
-        m_isGetKeyDefined = Message::isKeyDefined();
-        size_t keyLength = Message::getKeyMaxCdrSerializedSize()>16 ? Message::getKeyMaxCdrSerializedSize() : 16;
-        m_keyBuffer = reinterpret_cast<unsigned char*>(malloc(keyLength));
-        memset(m_keyBuffer, 0, keyLength);
-    }
-
-    MessagePubSubType::~MessagePubSubType()
-    {
-        if(m_keyBuffer!=nullptr)
-            free(m_keyBuffer);
-    }
-
-    bool MessagePubSubType::serialize(void *data, SerializedPayload_t *payload)
-    {
-        Message *p_type = static_cast<Message*>(data);
-        eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->max_size); // Object that manages the raw buffer.
-        eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
-                eprosima::fastcdr::Cdr::DDS_CDR); // Object that serializes the data.
-        payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
-        // Serialize encapsulation
-        ser.serialize_encapsulation();
-
-        try
-        {
-            p_type->serialize(ser); // Serialize the object:
-        }
-        catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/)
-        {
-            return false;
-        }
-
-        payload->length = static_cast<uint32_t>(ser.getSerializedDataLength()); //Get the serialized length
-        return true;
-    }
-
-    bool MessagePubSubType::deserialize(SerializedPayload_t* payload, void* data)
-    {
-        Message* p_type = static_cast<Message*>(data); //Convert DATA to pointer of your type
-        eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(payload->data), payload->length); // Object that manages the raw buffer.
-        eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN,
-                eprosima::fastcdr::Cdr::DDS_CDR); // Object that deserializes the data.
-        // Deserialize encapsulation.
-        deser.read_encapsulation();
-        payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE;
-
-        try
-        {
-            p_type->deserialize(deser); //Deserialize the object:
-        }
-        catch(eprosima::fastcdr::exception::NotEnoughMemoryException& /*exception*/)
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    std::function<uint32_t()> MessagePubSubType::getSerializedSizeProvider(void* data)
-    {
-        return [data]() -> uint32_t
-        {
-            return static_cast<uint32_t>(type::getCdrSerializedSize(*static_cast<Message*>(data))) + 4 /*encapsulation*/;
-        };
-    }
-
-    void* MessagePubSubType::createData()
-    {
-        return reinterpret_cast<void*>(new Message());
-    }
-
-    void MessagePubSubType::deleteData(void* data)
-    {
-        delete(reinterpret_cast<Message*>(data));
-    }
-
-    bool MessagePubSubType::getKey(void *data, InstanceHandle_t* handle, bool force_md5)
-    {
-        if(!m_isGetKeyDefined)
-            return false;
-        Message* p_type = static_cast<Message*>(data);
-        eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast<char*>(m_keyBuffer),Message::getKeyMaxCdrSerializedSize());     // Object that manages the raw buffer.
-        eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS);     // Object that serializes the data.
-        p_type->serializeKey(ser);
-        if(force_md5 || Message::getKeyMaxCdrSerializedSize()>16)    {
-            m_md5.init();
-            m_md5.update(m_keyBuffer, static_cast<unsigned int>(ser.getSerializedDataLength()));
-            m_md5.finalize();
-            for(uint8_t i = 0;i<16;++i)        {
-                handle->value[i] = m_md5.digest[i];
-            }
-        }
-        else    {
-            for(uint8_t i = 0;i<16;++i)        {
-                handle->value[i] = m_keyBuffer[i];
-            }
-        }
-        return true;
-    }
-
-
-} //End of namespace TopicSample

+ 0 - 61
src1/common/modulecomm_fastrtps_tcp/TopicsPubSubTypes.h

@@ -1,61 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsPubSubTypes.h
- * This header file contains the declaration of the serialization functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#ifndef _TOPICSAMPLE_TOPICS_PUBSUBTYPES_H_
-#define _TOPICSAMPLE_TOPICS_PUBSUBTYPES_H_
-
-#include <fastrtps/config.h>
-#include <fastrtps/TopicDataType.h>
-
-#include "Topics.h"
-
-#if !defined(GEN_API_VER) || (GEN_API_VER != 1)
-#error Generated Topics is not compatible with current installed Fast-RTPS. Please, regenerate it with fastrtpsgen.
-#endif
-
-namespace TopicSample
-{
-    typedef std::vector<uint8_t> SomeBytes;
-    /*!
-     * @brief This class represents the TopicDataType of the type Message defined by the user in the IDL file.
-     * @ingroup TOPICS
-     */
-    class MessagePubSubType : public eprosima::fastrtps::TopicDataType {
-    public:
-        typedef Message type;
-
-        eProsima_user_DllExport MessagePubSubType();
-
-        eProsima_user_DllExport virtual ~MessagePubSubType();
-        eProsima_user_DllExport virtual bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload) override;
-        eProsima_user_DllExport virtual bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data) override;
-        eProsima_user_DllExport virtual std::function<uint32_t()> getSerializedSizeProvider(void* data) override;
-        eProsima_user_DllExport virtual bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle,
-            bool force_md5 = false) override;
-        eProsima_user_DllExport virtual void* createData() override;
-        eProsima_user_DllExport virtual void deleteData(void * data) override;
-        MD5 m_md5;
-        unsigned char* m_keyBuffer;
-    };
-}
-
-#endif // _TOPICSAMPLE_TOPICS_PUBSUBTYPES_H_

+ 0 - 202
src1/common/modulecomm_fastrtps_tcp/TopicsPublisher.cxx

@@ -1,202 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsPublisher.cpp
- * This file contains the implementation of the publisher functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#include <fastrtps/participant/Participant.h>
-#include <fastrtps/attributes/ParticipantAttributes.h>
-#include <fastrtps/publisher/Publisher.h>
-#include <fastrtps/attributes/PublisherAttributes.h>
-
-#include <fastrtps/Domain.h>
-
-#include <fastrtps/participant/Participant.h>
-#include <fastrtps/attributes/ParticipantAttributes.h>
-#include <fastrtps/attributes/PublisherAttributes.h>
-#include <fastrtps/publisher/Publisher.h>
-#include <fastrtps/Domain.h>
-#include <fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h>
-#include <fastdds/rtps/transport/UDPv4TransportDescriptor.h>
-#include <fastdds/rtps/transport/TCPv4TransportDescriptor.h>
-
-#include <thread>
-#include <chrono>
-
-#include "TopicsPublisher.h"
-
-using namespace eprosima::fastrtps;
-using namespace eprosima::fastrtps::rtps;
-
-using namespace eprosima::fastdds::rtps;
-
-TopicsPublisher::TopicsPublisher() : mp_participant(nullptr), mp_publisher(nullptr) {}
-
-TopicsPublisher::~TopicsPublisher() {	Domain::removeParticipant(mp_participant);}
-
-bool TopicsPublisher::init(const char * strtopic,const unsigned short nListenPort)
-{
-    strncpy(mstrtopic,strtopic,255);
-    mnListenPort = nListenPort;
-    // Create RTPSParticipant
-
-    ParticipantAttributes PParam;
-    PParam.rtps.sendSocketBufferSize = 100000000;
-    PParam.rtps.setName("Participant_publisher");  //You can put here the name you want
-
-    PParam.rtps.builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::SIMPLE;
-    PParam.rtps.builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = true;
-    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true;
-    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true;
-    PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
-
-    // SharedMem transport configuration
-    PParam.rtps.useBuiltinTransports = false;
-
-    //Create a descriptor for the new transport.
-    auto tcp_transport = std::make_shared<TCPv4TransportDescriptor>();
-    tcp_transport->add_listener_port(nListenPort);
-    tcp_transport->set_WAN_address("0.0.0.0");
-
-    tcp_transport->wait_for_tcp_negotiation = false;
-    tcp_transport->sendBufferSize = 0;
-    tcp_transport->receiveBufferSize = 0;
-
-    PParam.rtps.userTransports.push_back(tcp_transport);
-
-
-    mp_participant = Domain::createParticipant(PParam);
-    if(mp_participant == nullptr)
-    {
-        return false;
-    }
-
-    //Register the type
-
-    Domain::registerType(mp_participant, static_cast<TopicDataType*>(&myType));
-
-    // Create Publisher
-
-    PublisherAttributes Wparam;
-    Wparam.topic.topicKind = NO_KEY;
-    Wparam.topic.topicDataType = myType.getName();  //This type MUST be registered
-    Wparam.topic.topicName = strtopic;//"TopicsPubSubTopic";
-
-    Wparam.topic.historyQos.depth = 30;
-    Wparam.topic.resourceLimitsQos.max_samples = 50;
-    Wparam.topic.resourceLimitsQos.allocated_samples = 20;
-    Wparam.times.heartbeatPeriod.seconds = 2;
-    Wparam.times.heartbeatPeriod.nanosec = 200 * 1000 * 1000;
-    Wparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
-    Wparam.qos.m_publishMode.kind = ASYNCHRONOUS_PUBLISH_MODE;
-
-    mp_publisher = Domain::createPublisher(mp_participant,Wparam,static_cast<PublisherListener*>(&m_listener));
-
-    if(mp_publisher == nullptr)
-    {
-        return false;
-    }
-
-    std::cout << "Publisher created, waiting for Subscribers." << std::endl;
-    return true;
-}
-
-void TopicsPublisher::PubListener::onPublicationMatched(Publisher* pub,MatchingInfo& info)
-{
-    (void)pub;
-
-    if (info.status == MATCHED_MATCHING)
-    {
-        n_matched++;
-        std::cout << "Publisher matched" << std::endl;
-    }
-    else
-    {
-        n_matched--;
-        std::cout << "Publisher unmatched" << std::endl;
-    }
-}
-
-void TopicsPublisher::run()
-{
-    while(m_listener.n_matched == 0)
-    {
-        std::this_thread::sleep_for(std::chrono::milliseconds(250)); // Sleep 250 ms
-    }
-
-    // Publication code
-
-    TopicSample::Message st;
-
-    /* Initialize your structure here */
-
-    int msgsent = 0;
-    char ch = 'y';
-    do
-    {
-        if(ch == 'y')
-        {
-            mp_publisher->write(&st);  ++msgsent;
-            std::cout << "Sending sample, count=" << msgsent << ", send another sample?(y-yes,n-stop): ";
-        }
-        else if(ch == 'n')
-        {
-            std::cout << "Stopping execution " << std::endl;
-            break;
-        }
-        else
-        {
-            std::cout << "Command " << ch << " not recognized, please enter \"y/n\":";
-        }
-    } while(std::cin >> ch);
-}
-
-#include <QDateTime>
-
-void TopicsPublisher::senddata(const char *str, int nsize)
-{
-
-
-    static int ncount = 1;
-    std::cout<<"send data."<<std::endl;
-//    while(m_listener.n_matched == 0)
-    TopicSample::SomeBytes x;
-    x.resize(nsize);
-    memcpy(x.data(),str,nsize);
-
-    TopicSample::Message st;
-
-    st.msgname(mstrtopic);
-//    st.msgname("topictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopictopic");
-    st.counter(ncount);ncount++;
-    st.sendtime(QDateTime::currentMSecsSinceEpoch());
-    TopicSample::SomeBytes & px = x;
-    st.xdata(x);
-
-    int ndatasize = TopicSample::Message::getCdrSerializedSize(st);
-
-    std::cout<<"size is "<<ndatasize<<std::endl;
-
-
-    mp_publisher->write(&st);
-
-
-
-}
-

+ 0 - 57
src1/common/modulecomm_fastrtps_tcp/TopicsPublisher.h

@@ -1,57 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsPublisher.h
- * This header file contains the declaration of the publisher functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#ifndef _TOPICSAMPLE_TOPICS_PUBLISHER_H_
-#define _TOPICSAMPLE_TOPICS_PUBLISHER_H_
-
-#include <fastrtps/fastrtps_fwd.h>
-#include <fastrtps/publisher/PublisherListener.h>
-
-#include "TopicsPubSubTypes.h"
-
-class TopicsPublisher
-{
-public:
-	TopicsPublisher();
-	virtual ~TopicsPublisher();
-    bool init(const char * strtopic,const unsigned short nListenPort);
-	void run();
-    void senddata(const char *str, int nsize);
-private:
-	eprosima::fastrtps::Participant *mp_participant;
-	eprosima::fastrtps::Publisher *mp_publisher;
-
-    char mstrtopic[256];
-    unsigned short mnListenPort;
-
-	class PubListener : public eprosima::fastrtps::PublisherListener
-	{
-	public:
-		PubListener() : n_matched(0){};
-		~PubListener(){};
-		void onPublicationMatched(eprosima::fastrtps::Publisher* pub,eprosima::fastrtps::rtps::MatchingInfo& info);
-		int n_matched;
-	} m_listener;
-	TopicSample::MessagePubSubType myType;
-};
-
-#endif // _TOPICSAMPLE_TOPICS_PUBLISHER_H_

+ 0 - 216
src1/common/modulecomm_fastrtps_tcp/TopicsSubscriber.cxx

@@ -1,216 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsSubscriber.cpp
- * This file contains the implementation of the subscriber functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-#include <fastrtps/participant/Participant.h>
-#include <fastrtps/attributes/ParticipantAttributes.h>
-#include <fastrtps/subscriber/Subscriber.h>
-#include <fastrtps/attributes/SubscriberAttributes.h>
-
-#include <fastrtps/Domain.h>
-
-#include <fastcdr/FastBuffer.h>
-#include <fastcdr/FastCdr.h>
-#include <fastcdr/Cdr.h>
-
-#include <fastrtps/participant/Participant.h>
-#include <fastrtps/attributes/ParticipantAttributes.h>
-#include <fastrtps/attributes/PublisherAttributes.h>
-#include <fastrtps/publisher/Publisher.h>
-#include <fastrtps/Domain.h>
-#include <fastdds/rtps/transport/shared_mem/SharedMemTransportDescriptor.h>
-#include <fastdds/rtps/transport/UDPv4TransportDescriptor.h>
-#include <fastdds/rtps/transport/TCPv4TransportDescriptor.h>
-
-#include "TopicsSubscriber.h"
-
-using namespace eprosima::fastrtps;
-using namespace eprosima::fastrtps::rtps;
-
-using namespace eprosima::fastdds::rtps;
-
-
-
-
-#include <QDateTime>
-
-TopicsSubscriber::TopicsSubscriber() : mp_participant(nullptr), mp_subscriber(nullptr) {}
-
-TopicsSubscriber::~TopicsSubscriber() {	Domain::removeParticipant(mp_participant);}
-
-bool TopicsSubscriber::init(const char * strtopic,const char * strpubip,const unsigned short nPort)
-{
-
-    strncpy(mstrtopic,strtopic,255);
-    mnPort = nPort;
-    // Create RTPSParticipant
-
-    ParticipantAttributes PParam;
-    PParam.rtps.setName("Participant_subscriber"); //You can put the name you want
-
-    PParam.rtps.builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::SIMPLE;
-    PParam.rtps.builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = true;
-    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true;
-    PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true;
-    PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
-
-    // SharedMem transport configuration
-    PParam.rtps.useBuiltinTransports = false;
-
-    auto tcp2_transport = std::make_shared<TCPv4TransportDescriptor>();
-
-    //Set initial peers.
-    Locator_t initial_peer_locator;
-    initial_peer_locator.kind = LOCATOR_KIND_TCPv4;
-    IPLocator::setIPv4(initial_peer_locator, strpubip);
-    initial_peer_locator.port = mnPort;
-    PParam.rtps.builtin.initialPeersList.push_back(initial_peer_locator);
-
-//    PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
-//    PParam.rtps.builtin.discovery_config.leaseDuration_announcementperiod = Duration_t(5, 0);
-//    PParam.rtps.setName("Participant_sub");
-
-    tcp2_transport->wait_for_tcp_negotiation = false;
-    //Link the Transport Layer to the Participant.
-    PParam.rtps.userTransports.push_back(tcp2_transport);
-
-
-
-    mp_participant = Domain::createParticipant(PParam);
-    if(mp_participant == nullptr)
-    {
-        return false;
-    }
-
-    //Register the type
-
-    Domain::registerType(mp_participant, static_cast<TopicDataType*>(&myType));
-
-    // Create Subscriber
-
-    SubscriberAttributes Rparam;
-    Rparam.topic.topicKind = NO_KEY;
-    Rparam.topic.topicDataType = myType.getName(); //Must be registered before the creation of the subscriber
-    Rparam.topic.topicName = strtopic;//"TopicsPubSubTopic";
-
-    Rparam.topic.historyQos.depth = 30;
-    Rparam.topic.resourceLimitsQos.max_samples = 50;
-    Rparam.topic.resourceLimitsQos.allocated_samples = 20;
-
-    Rparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
-
-
-    mp_subscriber = Domain::createSubscriber(mp_participant,Rparam, static_cast<SubscriberListener*>(&m_listener));
-    if(mp_subscriber == nullptr)
-    {
-        return false;
-    }
-    return true;
-}
-
-void TopicsSubscriber::SubListener::onSubscriptionMatched(Subscriber* sub,MatchingInfo& info)
-{
-    (void)sub;
-
-    if (info.status == MATCHED_MATCHING)
-    {
-        n_matched++;
-        std::cout << "Subscriber matched" << std::endl;
-    }
-    else
-    {
-        n_matched--;
-        std::cout << "Subscriber unmatched" << std::endl;
-    }
-}
-
-
-void TopicsSubscriber::SubListener::setReceivedTopicFunction(ModuleFun xFun)
-{
-    mFun = xFun;
-    mbSetFun = true;
-}
-void TopicsSubscriber::SubListener::onNewDataMessage(Subscriber* sub)
-{
-    // Take data
-    TopicSample::Message st;
-    static int ncount = 0;
-
-    static int nmaxlatancy = 0;
-
-    std::cout<<"new msg"<<std::endl;
-
-
-//    char * strbuf = new char[1000000];
-//    eprosima::fastcdr::FastBuffer pbuf(strbuf,1000000);
-//    eprosima::fastcdr::Cdr * pxcdr;//
-//    pxcdr = new eprosima::fastcdr::Cdr(pbuf);
-
-//    if(sub->takeNextData(pxcdr, &m_info))
-//    {
-//        if(m_info.sampleKind == ALIVE)
-//        {
-//            // Print your structure data here.
-//            ++n_msg;
-//            std::cout << "Sample received, count=" << n_msg<<std::endl;
-//            st.deserialize(*pxcdr);
-
-//            std::cout<<" size is "<<TopicSample::Message::getCdrSerializedSize(st)<<std::endl;
-//        }
-//    }
-
-//    return;
-
-//    sub->get_first_untaken_info(&m_info);
-    std::cout<<"count is "<<sub->getUnreadCount()<<std::endl;
-
-    if(sub->takeNextData(&st, &m_info))
-    {
-        if(m_info.sampleKind == ALIVE)
-        {
-            // Print your structure data here.
-            ++n_msg;
-            ncount++;
-            std::cout << "Sample received, count=" << st.counter() <<" total: "<<ncount<<std::endl;
-            qint64 timex = QDateTime::currentMSecsSinceEpoch();
-            int nlatancy = (timex - st.sendtime());
-            if(nlatancy>nmaxlatancy)nmaxlatancy = nlatancy;
-            std::cout<<"  latency is "<<nlatancy<<" max: "<<nmaxlatancy<<std::endl;
-            std::cout<<" size is "<<st.xdata().size()<<std::endl;
-            QDateTime dt = QDateTime::fromMSecsSinceEpoch(st.sendtime());
-            if(mbSetFun) mFun((char *)(st.xdata().data()),st.xdata().size(),st.counter(),&dt,st.msgname().data());
-
-
-        }
-    }
-}
-
-void TopicsSubscriber::setReceivedTopicFunction(ModuleFun xFun)
-{
-    m_listener.setReceivedTopicFunction(xFun);
-}
-
-void TopicsSubscriber::run()
-{
-    std::cout << "Waiting for Data, press Enter to stop the Subscriber. "<<std::endl;
-    std::cin.ignore();
-    std::cout << "Shutting down the Subscriber." << std::endl;
-}
-

+ 0 - 73
src1/common/modulecomm_fastrtps_tcp/TopicsSubscriber.h

@@ -1,73 +0,0 @@
-// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/*!
- * @file TopicsSubscriber.h
- * This header file contains the declaration of the subscriber functions.
- *
- * This file was generated by the tool fastcdrgen.
- */
-
-
-#ifndef _TOPICSAMPLE_TOPICS_SUBSCRIBER_H_
-#define _TOPICSAMPLE_TOPICS_SUBSCRIBER_H_
-
-#include <fastrtps/fastrtps_fwd.h>
-#include <fastrtps/subscriber/SubscriberListener.h>
-#include <fastrtps/subscriber/SampleInfo.h>
-#include "TopicsPubSubTypes.h"
-
-
-#include <QDateTime>
-
-typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
-
-class TopicsSubscriber
-{
-public:
-	TopicsSubscriber();
-	virtual ~TopicsSubscriber();
-    bool init(const char * strtopic,const char * strpubip,const unsigned short nPort);
-	void run();
-
-    void setReceivedTopicFunction(ModuleFun xFun);
-private:
-	eprosima::fastrtps::Participant *mp_participant;
-	eprosima::fastrtps::Subscriber *mp_subscriber;
-
-
-    char mstrtopic[256];
-    unsigned short mnPort;
-
-	class SubListener : public eprosima::fastrtps::SubscriberListener
-	{
-	public:
-		SubListener() : n_matched(0),n_msg(0){};
-		~SubListener(){};
-		void onSubscriptionMatched(eprosima::fastrtps::Subscriber* sub,eprosima::fastrtps::rtps::MatchingInfo& info);
-		void onNewDataMessage(eprosima::fastrtps::Subscriber* sub);
-		eprosima::fastrtps::SampleInfo_t m_info;
-		int n_matched;
-		int n_msg;
-
-        void setReceivedTopicFunction(ModuleFun xFun);
-
-    private:
-        bool mbSetFun = false;
-        ModuleFun mFun;
-	} m_listener;
-	TopicSample::MessagePubSubType myType;
-};
-
-#endif // _TOPICSAMPLE_TOPICS_SUBSCRIBER_H_

+ 0 - 13
src1/common/modulecomm_fastrtps_tcp/ivmodulemsg_type.h

@@ -1,13 +0,0 @@
-#ifndef IVMODULEMSG_TYPE_H
-#define IVMODULEMSG_TYPE_H
-
-namespace iv {
-struct modulemsg_type
-{
-    char mstrmsgname[256];
-    int mnBufSize;
-    int mnMsgBufCount;
-};
-
-}
-#endif // IVMODULEMSG_TYPE_H

+ 0 - 63
src1/common/modulecomm_fastrtps_tcp/modulecomm_fastrtps_tcp.cpp

@@ -1,63 +0,0 @@
-#include "modulecomm_fastrtps_tcp.h"
-//#include "procsm_if.h"
-//#include "procsm.h"
-
-#include "modulecomm_impl.h"
-
-namespace iv {
-namespace modulecomm_fastrtps_tcp {
-
-
-void *  RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount,unsigned int nListenPort)
-{
-
-
-    modulecomm_impl * pif = new modulecomm_impl(strcommname,modulecomm_impl::type_send,nListenPort);
-
-//    procsm_if * pif = new procsm_if(strcommname,nBufSize,nMsgBufCount,procsm::ModeWrite);
-    return (void *)pif;
-}
-
-void  *  RegisterRecv(const char * strcommname,SMCallBack pCall,const char * strpubip,unsigned int nListenPort)
-{
-    modulecomm_impl * pif = new modulecomm_impl(strcommname,modulecomm_impl::type_recv,nListenPort,strpubip);
- //   procsm_if * pif = new procsm_if(strcommname,0,0,procsm::ModeRead);
-    pif->listenmsg(pCall);
-    return (void *)pif;
-}
-
-void * MODULECOMMFASTRTPSTCPSHARED_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun,const char * strpubip,unsigned int nListenPort)
-{
-    modulecomm_impl * pif = new modulecomm_impl(strcommname,modulecomm_impl::type_recv,nListenPort,strpubip);
- //   procsm_if * pif = new procsm_if(strcommname,0,0,procsm::ModeRead);
-    pif->listenmsg(xFun);
-    return (void *)pif;
-}
-void  ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen)
-{
-    modulecomm_impl * pif= (modulecomm_impl *)pHandle;
- //   procsm_if * pif = (procsm_if *)pHandle;
-    pif->writemsg(strdata,nDataLen);
-}
-
-void  Unregister(void * pHandle)
-{
-    modulecomm_impl * pif= (modulecomm_impl *)pHandle;
-//    procsm_if * pif = (procsm_if *)pHandle;
-    delete pif;
-}
-
-void PauseComm(void *pHandle)
-{
-//    procsm_if * pif = (procsm_if *)pHandle;
-//    pif->pausecomm();
-}
-
-void ContintuComm(void *pHandle)
-{
- //   procsm_if * pif = (procsm_if *)pHandle;
- //   pif->continuecomm();
-}
-
-}
-}

+ 0 - 44
src1/common/modulecomm_fastrtps_tcp/modulecomm_fastrtps_tcp.h

@@ -1,44 +0,0 @@
-#ifndef MODULECOMM_FASTRTPS_TCP_H
-#define MODULECOMM_FASTRTPS_TCP_H
-
-#include <QtCore/qglobal.h>
-#include <QDateTime>
-
-#include <functional>
-
-#if defined(MODULECOMM_FASTRTPS_TCP_LIBRARY)
-#  define MODULECOMMFASTRTPSTCPSHARED_EXPORT Q_DECL_EXPORT
-#else
-#  define MODULECOMMFASTRTPSTCPSHARED_EXPORT Q_DECL_IMPORT
-#endif
-
-
-
-//#include <iostream>
-//#include <thread>
-
-#ifndef IV_MODULE_FUN
-
-typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
-typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
-#define IV_MODULE_FUN
-#endif
-
-
-namespace iv {
-namespace modulecomm_fastrtps_tcp {
-void * MODULECOMMFASTRTPSTCPSHARED_EXPORT RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount,unsigned int nListenPort);
-void * MODULECOMMFASTRTPSTCPSHARED_EXPORT RegisterRecv(const char * strcommname,SMCallBack pCall,const char * strpubip,unsigned int nListenPort);
-void * MODULECOMMFASTRTPSTCPSHARED_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun,const char * strpubip,unsigned int nListenPort);
-void MODULECOMMFASTRTPSTCPSHARED_EXPORT ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen);
-void MODULECOMMFASTRTPSTCPSHARED_EXPORT Unregister(void * pHandle);
-void MODULECOMMFASTRTPSTCPSHARED_EXPORT PauseComm(void * pHandle);
-void MODULECOMMFASTRTPSTCPSHARED_EXPORT ContintuComm(void * pHandle);
-
-}
-
-}
-
-
-
-#endif 

+ 0 - 45
src1/common/modulecomm_fastrtps_tcp/modulecomm_fastrtps_tcp.pro

@@ -1,45 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2018-07-10T05:46:48
-#
-#-------------------------------------------------
-
-QT       -= gui
-
-
-#DEFINES += dds_use_shm
-
-TARGET = modulecomm_fastrtps_tcp
-TEMPLATE = lib
-
-DEFINES += MODULECOMM_FASTRTPS_TCP_LIBRARY
-
-VERSION = 1.0.1
-CONFIG += plugin
-
-
-SOURCES += modulecomm_fastrtps_tcp.cpp \
-    Topics.cxx \
-    TopicsPubSubTypes.cxx \
-    TopicsPublisher.cxx \
-    TopicsSubscriber.cxx \
-    modulecomm_impl.cpp
-
-HEADERS += modulecomm_fastrtps_tcp.h \
-    Topics.h \
-    TopicsPubSubTypes.h \
-    TopicsPublisher.h \
-    TopicsSubscriber.h \
-    modulecomm_impl.h \
-    ivmodulemsg_type.h
-
-unix {
-    target.path = /usr/lib
-    INSTALLS += target
-}
-
-#INCLUDEPATH += $$PWD/../../../include/
-
-
-LIBS += -L$$PWD -lfastcdr -lfastrtps
-

+ 0 - 140
src1/common/modulecomm_fastrtps_tcp/modulecomm_impl.cpp

@@ -1,140 +0,0 @@
-#include "modulecomm_impl.h"
-
-#include <thread>
-#include <iostream>
-#include <QDateTime>
-
-#include <QMutex>
-#include <QFile>
-
-namespace iv {
-namespace modulecomm {
-QMutex gmodulecomm_dds_Mutex;
-int createcount = 0;
-}
-
-}
-
-
-void modulecomm_impl::callbackTopic(const char * strdata,const unsigned int nSize,const unsigned int index, QDateTime * dt,const char * strmemname) {
-
-  if(mbFunPlus)
-  {
-      mFun(strdata,nSize,index,dt,strmemname);
-  }
-  else
-  {
-     (*mpCall)(strdata,nSize,index,dt,strmemname);
-  }
-}
-
-
-int modulecomm_impl::GetTempConfPath(char *strpath)
-{
-    char strtmppath[256];
-    QDateTime dt = QDateTime::currentDateTime();
-    snprintf(strtmppath,256,"/tmp/adc_modulecomm_conf_%04d%02d%02d%02d%02d.ini",dt.date().year(),
-             dt.date().month(),dt.date().day(),dt.time().hour(),dt.time().minute());
-    QFile xFile;
-    xFile.setFileName(strtmppath);
-    char strtem[256];
-    char strdata[10000];
-    snprintf(strdata,10000,"");
-    if(!xFile.exists())
-    {
-        if(xFile.open(QIODevice::ReadWrite))
-        {
-            snprintf(strtem,256,"[common]\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"DCPSDefaultDiscovery=TheRTPSConfig\n");strncat(strdata,strtem,10000);
-#ifdef dds_use_shm
-            snprintf(strtem,256,"DCPSGlobalTransportConfig=myconfig\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"[config/myconfig]\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"transports=share\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"[transport/share]\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"transport_type=shmem\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"pool_size=100000000\n");strncat(strdata,strtem,10000);
-#endif
-            snprintf(strtem,256,"[rtps_discovery/TheRTPSConfig]\n");strncat(strdata,strtem,10000);
-            snprintf(strtem,256,"ResendPeriod=5\n");strncat(strdata,strtem,10000);
-            xFile.write(strdata,strnlen(strdata,10000));
-            xFile.close();
-        }
-    }
-    strncpy(strpath,strtmppath,255);
-    return 0;
-}
-
-modulecomm_impl::modulecomm_impl(const char * strcommname,int ntype,const unsigned short nport ,const char * strip )
-{
-
-    strncpy(mstrtopic,strcommname,255);
-
-    iv::modulecomm::gmodulecomm_dds_Mutex.lock();
-    if(ntype == type_recv)
-    {
-        mpSub = new TopicsSubscriber();
-        mpSub->init(strcommname,strip,nport);
-//        std::this_thread::sleep_for(std::chrono::milliseconds(10));
-
-        mnType = type_recv;
-    }
-    else
-    {
-        mpPub = new TopicsPublisher();
-        mpPub->init(strcommname,nport);
- //       std::this_thread::sleep_for(std::chrono::milliseconds(10));
-        mnType = type_send;
-    }
-    iv::modulecomm::createcount++;
-    std::cout<<"count is "<<iv::modulecomm::createcount<<std::endl;
-    iv::modulecomm::gmodulecomm_dds_Mutex.unlock();
-
-}
-
-int modulecomm_impl::listenmsg(ModuleFun xFun)
-{
-    if(mnType == type_send)
-    {
-        std::cout<<"send not listen."<<std::endl;;
-        return -1;
-    }
-    mbFunPlus = true;
-    mFun = xFun;
-    ModuleFun topicFunction = std::bind(&modulecomm_impl::callbackTopic,this,std::placeholders::_1,
-                                                                                std::placeholders::_2,
-                                                                                std::placeholders::_3,
-                                                                                std::placeholders::_4,
-                                                                                std::placeholders::_5);
-    mpSub->setReceivedTopicFunction(topicFunction);
-    return 0;
-}
-
-int modulecomm_impl::listenmsg(SMCallBack pCall)
-{
-    if(mnType == type_send)
-    {
-        std::cout<<"send not listen."<<std::endl;
-        return -1;
-    }
-    mbFunPlus = false;
-    mpCall = pCall;
-    ModuleFun topicFunction = std::bind(&modulecomm_impl::callbackTopic,this,std::placeholders::_1,
-                                                                                std::placeholders::_2,
-                                                                                std::placeholders::_3,
-                                                                                std::placeholders::_4,
-                                                                                std::placeholders::_5);
-    mpSub->setReceivedTopicFunction(topicFunction);
-    return 0;
-}
-
-void modulecomm_impl::writemsg(const char *str, int nlen)
-{
-    if(mnType == type_recv)
-    {
-        std::cout<<"recv not send."<<std::endl;
-        return ;
-    }
-
-    mpPub->senddata(str,nlen);
-
-}

+ 0 - 41
src1/common/modulecomm_fastrtps_tcp/modulecomm_impl.h

@@ -1,41 +0,0 @@
-#ifndef MODULECOMM_IMPL_H
-#define MODULECOMM_IMPL_H
-
-#include <QDateTime>
-
-#include "TopicsPublisher.h"
-#include "TopicsSubscriber.h"
-
-
-typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
-
-
-class modulecomm_impl
-{
-public:
-    const static int type_send = 1;
-    const static int type_recv = 2;
-public:
-    modulecomm_impl(const char * strcommname,int ntype = 2,const unsigned short nport =1,const char * strip = 0);
-    int listenmsg(SMCallBack pCall);
-    int listenmsg(ModuleFun xFun);
-    void writemsg(const char * str,int nlen);
-
-private:
-    char mstrtopic[256];
-    int mnType = type_recv;
-    TopicsPublisher * mpPub;
-    TopicsSubscriber * mpSub;
-    SMCallBack  mpCall;
-    ModuleFun mFun;
-    void callbackTopic(const char * strdata,const unsigned int nSize,const unsigned int index,QDateTime * dt,const char * strmemname);
-
-    int GetTempConfPath(char * strpath);
-
-
-
-    bool mbFunPlus = false;
-
-};
-
-#endif // MODULECOMM_IMPL_H

+ 0 - 73
src1/common/modulecomm_inter/.gitignore

@@ -1,73 +0,0 @@
-# This file is used to ignore files which are generated
-# ----------------------------------------------------------------------------
-
-*~
-*.autosave
-*.a
-*.core
-*.moc
-*.o
-*.obj
-*.orig
-*.rej
-*.so
-*.so.*
-*_pch.h.cpp
-*_resource.rc
-*.qm
-.#*
-*.*#
-core
-!core/
-tags
-.DS_Store
-.directory
-*.debug
-Makefile*
-*.prl
-*.app
-moc_*.cpp
-ui_*.h
-qrc_*.cpp
-Thumbs.db
-*.res
-*.rc
-/.qmake.cache
-/.qmake.stash
-
-# qtcreator generated files
-*.pro.user*
-
-# xemacs temporary files
-*.flc
-
-# Vim temporary files
-.*.swp
-
-# Visual Studio generated files
-*.ib_pdb_index
-*.idb
-*.ilk
-*.pdb
-*.sln
-*.suo
-*.vcproj
-*vcproj.*.*.user
-*.ncb
-*.sdf
-*.opensdf
-*.vcxproj
-*vcxproj.*
-
-# MinGW generated files
-*.Debug
-*.Release
-
-# Python byte code
-*.pyc
-
-# Binaries
-# --------
-*.dll
-*.exe
-

+ 0 - 480
src1/common/modulecomm_inter/intercomm.cpp

@@ -1,480 +0,0 @@
-#include "intercomm.h"
-
-#include <QMutex>
-#include <QWaitCondition>
-#include <iostream>
-
-namespace  iv {
-
-struct InterListenUnit
-{
-    QMutex mWaitMutex;
-    SMCallBack  mpCall;
-    ModuleFun mFun;
-    QWaitCondition * mpwc;
-    bool mbFunPlus = false;
-};
-
-struct interunit
-{
-    char strintername[256];
-    char * strdatabuf;
-    int nbufsize = 0;
-    int nPacCount;
-    QMutex mMutexUnit;
-    std::vector<InterListenUnit *> mvectorlisten;
-    QWaitCondition mwc;
-    bool mbHaveWriter = false;
-
-};
-
-std::vector<interunit *> gvectorinter;
-QMutex gMutexInter;
-
-
-static interunit * FindInterUnitByName(const char * strname)
-{
-    interunit * p = 0;
-    int i;
-    int nsize;
-    nsize = gvectorinter.size();
-    for(i=0;i<nsize;i++)
-    {
-        if(strncmp(strname,gvectorinter.at(i)->strintername,256) == 0)
-        {
-            return (gvectorinter.at(i));
-        }
-    }
-    return p;
-}
-
-
-intercomm::intercomm(const char * strsmname,const unsigned int nBufSize,const unsigned int nMaxPacCount,const int nMode)
-{
-    strncpy(mstrsmname,strsmname,256);
-
-    mnMode = nMode;
-    if(nMode == ModeWrite)
-    {
-        gMutexInter.lock();
-        interunit * p = FindInterUnitByName(strsmname);
-        if(p == 0)
-        {
-            interunit * pnewinter = new interunit;
-            strncpy(pnewinter->strintername,strsmname,256);
-            pnewinter->strdatabuf = new char[sizeof(procinter_info)+nMaxPacCount*sizeof(procinter_head) + nBufSize];
-            pnewinter->nPacCount = nMaxPacCount;
-            pnewinter->nbufsize = nBufSize;
-            gvectorinter.push_back(pnewinter);
-            mpa = pnewinter;
-
-
-        }
-        else
-        {
-            p->mMutexUnit.lock();
-            delete p->strdatabuf;
-            p->strdatabuf = new char[sizeof(procinter_info)+nMaxPacCount*sizeof(procinter_head) + nBufSize];
-            p->nPacCount = nMaxPacCount;
-            p->nbufsize = nBufSize;
-            p->mMutexUnit.unlock();
-            mpa = p;
-        }
-
-        interunit * pinter = (interunit * )mpa;
-        char * pdata = (char *)pinter->strdatabuf;
-        mpinfo = (procinter_info *)pdata;
-        mphead = (procinter_head *)(pdata+sizeof(procinter_info));
-        mpinfo->mCap = nMaxPacCount;
-        mpinfo->mnBufSize = nBufSize;
-        mpinfo->mFirst = 0;
-        mpinfo->mNext = 0;
-        mpinfo->mLock = 0;
-        pinter->mbHaveWriter = true;
-
-        gMutexInter.unlock();
-
-    }
-    else
-    {
-        gMutexInter.lock();
-        interunit * p = FindInterUnitByName(strsmname);
-        if(p == 0)
-        {
-            interunit * pnewinter = new interunit;
-            strncpy(pnewinter->strintername,strsmname,256);
-            gvectorinter.push_back(pnewinter);
-            mpa = pnewinter;
-        }
-        else
-        {
-            mpa = p;
-        }
-
-        interunit * pinter = (interunit * )mpa;
-        char * pdata = (char *)pinter->strdatabuf;
-        mpinfo = (procinter_info *)pdata;
-        mphead = (procinter_head *)(pdata+sizeof(procinter_info));
-
-        gMutexInter.unlock();
-    }
-}
-
-intercomm::~intercomm()
-{
-    if(mnMode == ModeRead)
-    {
-        stoplisten();
-        interunit * p = (interunit *)mpa;
-        p->mMutexUnit.lock();
-        InterListenUnit * plisten = (InterListenUnit *)mplistenunit;
-        int i;
-        for(i=0;i<p->mvectorlisten.size();i++)
-        {
-            if(plisten == p->mvectorlisten.at(i))
-            {
-                p->mvectorlisten.erase(p->mvectorlisten.begin() + i);
-                delete plisten;
-                break;
-            }
-        }
-        p->mMutexUnit.unlock();
-    }
-}
-
-int intercomm::listenmsg(ModuleFun xFun)
-{
-    if(mnMode == ModeWrite)
-    {
-        std::cout<<"intercomm::listenmsg this is Write. Can't Listen."<<std::endl;
-        return - 1;
-    }
-
-    interunit * p = (interunit *)mpa;
-    p->mMutexUnit.lock();
-    InterListenUnit * pnewlisten = new InterListenUnit;
-    pnewlisten->mbFunPlus = true;
-    pnewlisten->mFun = xFun;
-    pnewlisten->mpwc = &p->mwc;
-    p->mvectorlisten.push_back(pnewlisten);
-    p->mMutexUnit.unlock();
-
-    mplistenunit = (void *)pnewlisten;
-
-    mplistenthread = new std::thread(&intercomm::listernrun,this);
-    return 0;
-}
-
-int intercomm::listenmsg(SMCallBack pCall)
-{
-    if(mnMode == ModeWrite)
-    {
-        std::cout<<"intercomm::listenmsg this is Write. Can't Listen."<<std::endl;
-        return - 1;
-    }
-
-    interunit * p = (interunit *)mpa;
-    p->mMutexUnit.lock();
-    InterListenUnit * pnewlisten = new InterListenUnit;
-    pnewlisten->mbFunPlus = false;
-    pnewlisten->mpCall = pCall;
-    pnewlisten->mpwc = &p->mwc;
-    p->mvectorlisten.push_back(pnewlisten);
-    p->mMutexUnit.unlock();
-    mplistenunit = (void *)pnewlisten;
-    mplistenthread = new std::thread(&intercomm::listernrun,this);
-    return 0;
-}
-
-void intercomm::stoplisten()
-{
-    mblistenrun = false;
-    if(mplistenthread != 0)
-    {
-        mplistenthread->join();
-        mplistenthread = 0;
-    }
-}
-
-void intercomm::pausecomm()
-{
-    mbPause = true;
-}
-
-void intercomm::continuecomm()
-{
-    mbPause = false;
-}
-
-void intercomm::listernrun()
-{
-    InterListenUnit * pILU = (InterListenUnit * )mplistenunit;
-    QTime xTime;
-    xTime.start();
-    unsigned int nBufLen = 1;
-    unsigned int nRead;
-    char * str = new char[nBufLen];
-    unsigned int index =0;
-    QDateTime *pdt = new QDateTime();
-    interunit * pinter = (interunit *)mpa;
-    while(mblistenrun)
-    {
-        if(mbPause)
-        {
-            std::this_thread::sleep_for(std::chrono::milliseconds(100));
-            continue;
-        }
-        if(pinter->mbHaveWriter == false)
-        {
-            std::this_thread::sleep_for(std::chrono::milliseconds(100));
-            continue;
-        }
-        pILU->mWaitMutex.lock();
-        pILU->mpwc->wait(&pILU->mWaitMutex,100);
-        pILU->mWaitMutex.unlock();
-        int nRtn = readmsg(index,str,nBufLen,&nRead,pdt);
-        while ((nRtn != 0)&&(mblistenrun))
-        {
-            if(nRtn == -1)
-            {
-                nBufLen = nRead;
-                delete str;
-                if(nBufLen < 1)nBufLen = 1;
-                str = new char[nBufLen];
-            }
-            else
-            {
-                if(nRtn == -2)
-                {
-                   index = getcurrentnext();
-                }
-                else
-                {
-                   if(nRtn >0)
-                   {
-                       if(pILU->mbFunPlus)
-                       {
-                           pILU->mFun(str,nRtn,index,pdt,mstrsmname);
-                       }
-                       else
-                       {
-                          (*pILU->mpCall)(str,nRtn,index,pdt,mstrsmname);
-                       }
-                       index++;
-                   }
-                   else
-                   {
-                       std::this_thread::sleep_for(std::chrono::milliseconds(100));
-                   }
-                }
-            }
-            nRtn = readmsg(index,str,nBufLen,&nRead,pdt);
-        }
-
-    }
-
-    delete str;
-    delete pdt;
-}
-
-int intercomm::writemsg(const char *str, const unsigned int nSize)
-{
-    if(mbPause)return -2;
-    if(mnMode == ModeRead)
-    {
-        std::cout<<"Register read. can't write."<<std::endl;
-        return -1;
-    }
-    interunit * pinter = (interunit *)mpa;
-
-    pinter->mMutexUnit.lock();
-    char * pdata = (char *)pinter->strdatabuf;
-    mpinfo = (procinter_info *)pdata;
-    mphead = (procinter_head *)(pdata+sizeof(procinter_info));
-    if(nSize > pinter->nbufsize)
-    {
-        qDebug("procsm::writemsg message size is very big");
-        return -1;
-    }
-
-WRITEMSG:
-
-    char * pH,*pD;
-    QDateTime dt;
-    pH = (char *)pinter->strdatabuf;pH = pH + sizeof(procinter_info);
-    pD = (char *)pinter->strdatabuf;pD = pD + sizeof(procinter_info) + pinter->nPacCount * sizeof(procinter_head);
-    procinter_head * phh = (procinter_head *)pH;
-    unsigned int nPac = mpinfo->mNext - mpinfo->mFirst;
-    if(nPac>=pinter->nPacCount)
-    {
-        unsigned int nRemove = pinter->nPacCount/3;
-        if(nRemove == 0)nRemove = 1;
-        MoveMem(nRemove);
-        goto WRITEMSG;
-    }
-    if(nPac == 0)
-    {
-        memcpy(pD,str,nSize);
-        dt = QDateTime::currentDateTime();
-        phh->SetDate(dt);
-        phh->mindex = mpinfo->mNext;
-        phh->mnPos = 0;
-        phh->mnLen = nSize;
-        mpinfo->mNext = mpinfo->mNext+1;
-    }
-    else
-    {
-        if(((phh+nPac-1)->mnPos+(phh+nPac-1)->mnLen + nSize)>=pinter->nbufsize)
-        {
-            unsigned int nRemove = pinter->nPacCount/2;
-            if(nRemove == 0)nRemove = 1;
-            MoveMem(nRemove);
-            goto WRITEMSG;
-        }
-        else
-        {
-            unsigned int nPos = (phh+nPac-1)->mnPos + (phh+nPac-1)->mnLen;
-            memcpy(pD+nPos,str,nSize);
-            dt = QDateTime::currentDateTime();
-            (phh+nPac)->SetDate(dt);
-            (phh+nPac)->mindex = mpinfo->mNext;
-            (phh+nPac)->mnPos = nPos;
-            (phh+nPac)->mnLen = nSize;
-            mpinfo->mNext = mpinfo->mNext+1;
-        }
-    }
-
-    const unsigned int nTM = 0x6fffffff;
-    if((mpinfo->mNext >nTM)&&(mpinfo->mFirst>nTM))
-    {
-       nPac = mpinfo->mNext - mpinfo->mFirst;
-       unsigned int i;
-       for(i=0;i<nPac;i++)
-       {
-           (phh+i)->mindex = (phh+i)->mindex-nTM;
-       }
-       mpinfo->mFirst = mpinfo->mFirst-nTM;
-       mpinfo->mNext = mpinfo->mNext - nTM;
-    }
-
-    pinter->mMutexUnit.unlock();
-    pinter->mwc.wakeAll();
-    return 0;
-}
-
-int intercomm::MoveMem(const unsigned int nSize)
-{
-    unsigned int nRemove = nSize;
-    if(nRemove == 0)return -1;
-    interunit * pinter = (interunit *)mpa;
-    char * pH,*pD;
-    pH = (char *)pinter->strdatabuf;pH = pH + sizeof(procinter_info);
-    pD = (char *)pinter->strdatabuf;pD = pD + sizeof(procinter_info) + pinter->nPacCount * sizeof(procinter_head);
-    procinter_head * phh = (procinter_head *)pH;
-    unsigned int nPac = mpinfo->mNext - mpinfo->mFirst;
-
-    if(nRemove >nPac)
-    {
-        nRemove = nPac;
-    }
-
-    if(nRemove == nPac)
-    {
-        mpinfo->mFirst = mpinfo->mFirst + (unsigned int)nRemove;
-        return 0;
-    }
-
-    unsigned int i;
-    int nDataMove = 0;
-    for(i=0;i<nRemove;i++)
-    {
-        procinter_head * phd = phh+i;
-        nDataMove = nDataMove + phd->mnLen;
-    }
-    unsigned int nDataTotal;
-    for(i=0;i<(nPac - nRemove);i++)
-    {
-        memcpy(phh+i,phh+i+nRemove,sizeof(procinter_head));
-        (phh+i)->mnPos = (phh+i)->mnPos - nDataMove;
-    }
-    nDataTotal = (phh + nPac-nRemove-1)->mnPos + (phh+nPac-nRemove-1)->mnLen;
-    char * strtem = new char[pinter->nbufsize];
-    memcpy(strtem,pD+nDataMove,nDataTotal);
-    memcpy(pD,strtem,nDataTotal);
-    delete strtem;
-
-    mpinfo->mFirst = mpinfo->mFirst + (unsigned int)nRemove;
-    return 0;
-}
-
-int intercomm::readmsg(unsigned int index, char *str, unsigned int nMaxSize, unsigned int *nRead, QDateTime *pdt)
-{
-    int nRtn = 0;
-
-    interunit * pinter = (interunit *)mpa;
-
-    if(pinter->nbufsize == 0)return 0;
-    char * pdata = (char *)pinter->strdatabuf;
-    mpinfo = (procinter_info *)pdata;
-    mphead = (procinter_head *)(pdata+sizeof(procinter_info));
-
-    if((index< mpinfo->mFirst)||(index > mpinfo->mNext))
-    {
-        nRtn = -2;
-    }
-    if(nRtn != (-2))
-    {
-        if(index == mpinfo->mNext)
-        {
-            nRtn = 0;
-        }
-        else
-        {
-            char * pH,*pD;
- //           pH = (char *)mpASM->data();pH = pH + 2*sizeof(unsigned int);
-
- //           pD = (char *)mpASM->data();pD = pD + 2*sizeof(unsigned int) + mnMaxPacCount * sizeof(procsm_head);
-            pD = (char *)pinter->strdatabuf;pD = pD+ sizeof(procinter_info) + mpinfo->mCap*sizeof(procinter_head);
-            pH = (char *)pinter->strdatabuf;pH = pH+sizeof(procinter_info);
-            procinter_head * phh = (procinter_head *)pH;
-            unsigned int nPac = mpinfo->mNext - mpinfo->mFirst;
-            if(nPac == 0)
-            {
-                nRtn = 0;
-            }
-            else
-            {
-                unsigned int nPos = index - mpinfo->mFirst;
-                *nRead = (phh+nPos)->mnLen;
-                if((phh+nPos)->mnLen > nMaxSize)
-                {
-                    nRtn = -1;
-
-                }
-                else
-                {
-        //            qDebug("read pos = %d",(phh+nPos)->mnPos);
-                   memcpy(str,pD + (phh+nPos)->mnPos,(phh+nPos)->mnLen);
-          //         qDebug("read pos = %d",(phh+nPos)->mnPos);
-                   nRtn = (phh+nPos)->mnLen;
-                   (phh+nPos)->GetDate(pdt);
-           //        memcpy(pdt,&((phh+nPos)->mdt),sizeof(QDateTime));
-                }
-            }
-        }
-    }
-    return nRtn;
-}
-
-unsigned int intercomm::getcurrentnext()
-{
-    unsigned int nNext;
-    interunit * pinter = (interunit *)mpa;
-    char * pdata = (char *)pinter->strdatabuf;
-    mpinfo = (procinter_info *)pdata;
-    mphead = (procinter_head *)(pdata+sizeof(procinter_info));
-    nNext = mpinfo->mNext;
-    return nNext;
-}
-
-}

+ 0 - 109
src1/common/modulecomm_inter/intercomm.h

@@ -1,109 +0,0 @@
-#ifndef INTERCOMM_H
-#define INTERCOMM_H
-
-#include <QDateTime>
-#include "vector"
-#include <functional>
-#include <thread>
-
-typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
-using namespace std::placeholders;
-typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
-
-
-class procinter_info
-{
-public:
-  unsigned int mFirst;
-  unsigned int mNext;
-  unsigned int mCap;
-  unsigned int mLock;
-  unsigned int mnBufSize;
-};
-
-class procinter_head
-{
-public:
-    unsigned short mYear;
-    unsigned char mMonth;
-    unsigned char mDay;
-    unsigned char mHour;
-    unsigned char mMinute;
-    unsigned char mSec;
-    unsigned short mMSec;
-    unsigned int mindex;
-    unsigned int mnPos;
-    unsigned int mnLen;
-public:
-    void SetDate(QDateTime dt)
-    {
-        mYear = dt.date().year();
-        mMonth = dt.date().month();
-        mDay = dt.date().day();
-        mHour = dt.time().hour();
-        mMinute = dt.time().minute();
-        mSec = dt.time().second();
-        mMSec = dt.time().msec();
-    }
-    void GetDate(QDateTime * pdt)
-    {
-        QDate dt;
-        dt.setDate(mYear,mMonth,mDay);
-        QTime time;
-        time.setHMS(mHour,mMinute,mSec,mMSec);
-        pdt->setDate(dt);
-        pdt->setTime(time);
-
-    }
-};
-
-
-namespace  iv {
-
-class intercomm
-{
-public:
-    intercomm(const char * strsmname,const unsigned int nBufSize,const unsigned int nMaxPacCount,const int nMode);
-    ~intercomm();
-
-    int listenmsg(SMCallBack pCall);
-    int listenmsg(ModuleFun xFun);
-    void stoplisten();
-
-    void pausecomm();
-    void continuecomm();
-
-    const static int ModeRead = 1;
-    const static int ModeWrite = 0;
-
-    int writemsg(const char * str,const unsigned int nSize);
-
-private:
-
-
-    char mstrsmname[256];
-    int mnMode;
-    void * mpa;
-    void * mplistenunit;
-
-private:
-    void listernrun();
-    bool mblistenrun = true;
-    bool mbPause = false;
-    std::thread * mplistenthread = 0;
-
-    procinter_info * mpinfo;
-    procinter_head * mphead;
-
-
-private:
-
-    int readmsg(unsigned int index,char * str,unsigned int nMaxSize,unsigned int * nRead,QDateTime * pdt);
-    int MoveMem(const unsigned int nSize);
-    unsigned int getcurrentnext();
-};
-}
-
-
-
-#endif // INTERCOMM_H

+ 0 - 56
src1/common/modulecomm_inter/modulecomm_inter.cpp

@@ -1,56 +0,0 @@
-#include "modulecomm_inter.h"
-#include <iostream>
-
-#include "intercomm.h"
-
-namespace iv {
-namespace modulecomm_inter {
-
-void *  RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount)
-{
-    iv::intercomm * pinter = new iv::intercomm(strcommname,nBufSize,nMsgBufCount,iv::intercomm::ModeWrite);
-    return (void *)pinter;
-}
-
-void  *  RegisterRecv(const char * strcommname,SMCallBack pCall)
-{
-    iv::intercomm * pif = new iv::intercomm(strcommname,0,0,iv::intercomm::ModeRead);
-    pif->listenmsg(pCall);
-    return (void *)pif;
-}
-
-void * MODULECOMM_INTER_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun)
-{
-    iv::intercomm * pif = new iv::intercomm(strcommname,0,0,iv::intercomm::ModeRead);
-    pif->listenmsg(xFun);
-    return (void *)pif;
-}
-void  ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen)
-{
-    iv::intercomm * pif = (iv::intercomm *)pHandle;
-    pif->writemsg(strdata,nDataLen);
-}
-
-void  Unregister(void * pHandle)
-{
-    iv::intercomm * pif = (iv::intercomm *)pHandle;
-    delete pif;
-}
-
-void PauseComm(void *pHandle)
-{
-    iv::intercomm * pif = (iv::intercomm *)pHandle;
-    pif->pausecomm();
-}
-
-void ContintuComm(void *pHandle)
-{
-    iv::intercomm * pif = (iv::intercomm *)pHandle;
-    pif->continuecomm();
-}
-
-}
-}
-
-
-

+ 0 - 37
src1/common/modulecomm_inter/modulecomm_inter.h

@@ -1,37 +0,0 @@
-#ifndef MODULECOMM_INTER_H
-#define MODULECOMM_INTER_H
-
-#include <QtCore/qglobal.h>
-
-#include <functional>
-#include <QDateTime>
-
-#if defined(MODULECOMM_INTER_LIBRARY)
-#  define MODULECOMM_INTER_EXPORT Q_DECL_EXPORT
-#else
-#  define MODULECOMM_INTER_EXPORT Q_DECL_IMPORT
-#endif
-
-#ifndef IV_MODULE_FUN
-
-typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
-typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
-#define IV_MODULE_FUN
-#endif
-
-
-namespace iv {
-namespace modulecomm_inter {
-void * MODULECOMM_INTER_EXPORT RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount);
-void * MODULECOMM_INTER_EXPORT RegisterRecv(const char * strcommname,SMCallBack pCall);
-void * MODULECOMM_INTER_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun);
-void MODULECOMM_INTER_EXPORT ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen);
-void MODULECOMM_INTER_EXPORT Unregister(void * pHandle);
-void MODULECOMM_INTER_EXPORT PauseComm(void * pHandle);
-void MODULECOMM_INTER_EXPORT ContintuComm(void * pHandle);
-
-}
-
-}
-
-#endif // MODULECOMM_INTER_H

+ 0 - 33
src1/common/modulecomm_inter/modulecomm_inter.pro

@@ -1,33 +0,0 @@
-QT -= gui
-
-TEMPLATE = lib
-DEFINES += MODULECOMM_INTER_LIBRARY
-
-CONFIG += c++11
-
-CONFIG += plugin
-
-# The following define makes your compiler emit warnings if you use
-# any Qt feature that has been marked deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-# You can also make your code fail to compile if it uses deprecated APIs.
-# In order to do so, uncomment the following line.
-# You can also select to disable deprecated APIs only up to a certain version of Qt.
-#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
-
-SOURCES += \
-    intercomm.cpp \
-    modulecomm_inter.cpp
-
-HEADERS += \
-    intercomm.h \
-    modulecomm_inter.h
-
-# Default rules for deployment.
-unix {
-    target.path = /usr/lib
-}
-!isEmpty(target.path): INSTALLS += target

+ 0 - 90
src1/common/modulecomm_shm/ReadMe.md

@@ -1,90 +0,0 @@
-# How to use share memory
-
-共享内存使用分为发送端和接收端,以下分别介绍
-
-## 发送端
-
-**1. 添加共享内存消息格式文件**
-
-共享内存中数据采用protobuf格式存储,Protobuf是一种平台无关、语言无关、可扩展且轻便高效的序列化数据结构的协议,可以用于**网络通信**和**数据存储**。
-
-为使用共享内存,需添加一个相应的proto文件,文件位于`modularization/src/include/proto/hmi.proto`,可参考已有的文件编写
-
-```protobuf
-syntax = "proto2";
-package iv.hmi;
-message hmimsg
-{
- required bool mbPause = 1;
- required bool mbBocheMode = 2;
- required bool mbbusmode = 3;
-};
-```
-
-**2. 注册共享内存**
-
-在工程配置文件***.pro中添加引用信息:
-
-```
-SOURCES += \
-    ../../include/msgtype/ui.pb.cc
-HEADERS += \   
-    ../../include/msgtype/ui.pb.h
-LIBS += -lprotobuf
-INCLUDEPATH += $$PWD/../../include/msgtype
-LIBS += -L$$PWD/../../../bin/ -lmodulecomm 
-```
-
-设置共享内存名并注册:
-
-```c++
-std::string strmemvbox = "test"
-gpa = iv::modulecomm::RegisterSend(strmemvbox.data(),100000,3);iv::modulecomm::RegisterSend(strmemvbox.data(),100000,3);
-```
-
-写入数据:
-
-```c++
-char * str = new char[gobj.ByteSize()]; //gobj是一个probuf数据,使用方法参考protobuf的使用
-int nsize = gobj.ByteSize();
-if(gobj.SerializeToArray(str,nsize))
-{
-    iv::modulecomm::ModuleSendMsg(gpa,str,nsize);
-}
-```
-
-## 接收端
-
-**从共享内中读取数据**
-
-工程配置文件中添加配置信息:
-
-```pro
-SOURCES += \
-    ../../include/msgtype/ui.pb.cc
-HEADERS += \   
-    ../../include/msgtype/ui.pb.h
-LIBS += -lprotobuf
-INCLUDEPATH += $$PWD/../../include/msgtype
-LIBS += -L$$PWD/../../../bin/ -lmodulecomm 
-```
-
-源码中实现:
-
-```c++
-std::string strmemcan = “test”;//设置共享内存名字
-iv::modulecomm::RegisterRecv(strmemcan.data(),listen); 
-//数据接收函数,共享内存收到数据时,会调用:
-void listen(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
-{
-    if(nSize<1)return;
-    iv::can::canmsg xmsg;
-    if(false == xmsg.ParseFromArray(strdata,nSize))
-    {
-        std::cout<<"esr Listencan0 fail."<<std::endl;
-        return;
-    }
-    DecodeVboxData(xmsg);
-}
-```
-

+ 0 - 13
src1/common/modulecomm_shm/ivmodulemsg_type.h

@@ -1,13 +0,0 @@
-#ifndef IVMODULEMSG_TYPE_H
-#define IVMODULEMSG_TYPE_H
-
-namespace iv {
-struct modulemsg_type
-{
-    char mstrmsgname[256];
-    int mnBufSize;
-    int mnMsgBufCount;
-};
-
-}
-#endif // IVMODULEMSG_TYPE_H

+ 0 - 54
src1/common/modulecomm_shm/modulecomm_shm.cpp

@@ -1,54 +0,0 @@
-#include "modulecomm_shm.h"
-#include "procsm_if.h"
-#include "procsm.h"
-#include <iostream>
-
-namespace iv {
-namespace modulecomm_shm {
-
-void *  RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount)
-{
-
-    procsm_if * pif = new procsm_if(strcommname,nBufSize,nMsgBufCount,procsm::ModeWrite);
-    return (void *)pif;
-}
-
-void  *  RegisterRecv(const char * strcommname,SMCallBack pCall)
-{
-    procsm_if * pif = new procsm_if(strcommname,0,0,procsm::ModeRead);
-    pif->listenmsg(pCall);
-    return (void *)pif;
-}
-
-void * MODULECOMMSHARED_SHM_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun)
-{
-    procsm_if * pif = new procsm_if(strcommname,0,0,procsm::ModeRead);
-    pif->listenmsg(xFun);
-    return (void *)pif;
-}
-void  ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen)
-{
-    procsm_if * pif = (procsm_if *)pHandle;
-    pif->writemsg(strdata,nDataLen);
-}
-
-void  Unregister(void * pHandle)
-{
-    procsm_if * pif = (procsm_if *)pHandle;
-    delete pif;
-}
-
-void PauseComm(void *pHandle)
-{
-    procsm_if * pif = (procsm_if *)pHandle;
-    pif->pausecomm();
-}
-
-void ContintuComm(void *pHandle)
-{
-    procsm_if * pif = (procsm_if *)pHandle;
-    pif->continuecomm();
-}
-
-}
-}

+ 0 - 42
src1/common/modulecomm_shm/modulecomm_shm.h

@@ -1,42 +0,0 @@
-#ifndef MODULECOMM_SHM_H
-#define MODULECOMM_SHM_H
-
-#include <QtCore/qglobal.h>
-#include <QDateTime>
-
-#include <functional>
-
-#if defined(MODULECOMM_SHM_LIBRARY)
-#  define MODULECOMMSHARED_SHM_EXPORT Q_DECL_EXPORT
-#else
-#  define MODULECOMMSHARED_SHM_EXPORT Q_DECL_IMPORT
-#endif
-
-
-
-//#include <iostream>
-//#include <thread>
-
-#ifndef IV_MODULE_FUN
-
-typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
-typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
-#define IV_MODULE_FUN
-#endif
-namespace iv {
-namespace modulecomm_shm {
-void * MODULECOMMSHARED_SHM_EXPORT RegisterSend(const char * strcommname,const unsigned int nBufSize,const unsigned int nMsgBufCount);
-void * MODULECOMMSHARED_SHM_EXPORT RegisterRecv(const char * strcommname,SMCallBack pCall);
-void * MODULECOMMSHARED_SHM_EXPORT RegisterRecvPlus(const char * strcommname,ModuleFun xFun);
-void MODULECOMMSHARED_SHM_EXPORT ModuleSendMsg(void * pHandle,const char * strdata,const unsigned int nDataLen);
-void MODULECOMMSHARED_SHM_EXPORT Unregister(void * pHandle);
-void MODULECOMMSHARED_SHM_EXPORT PauseComm(void * pHandle);
-void MODULECOMMSHARED_SHM_EXPORT ContintuComm(void * pHandle);
-
-}
-
-}
-
-
-
-#endif 

+ 0 - 41
src1/common/modulecomm_shm/modulecomm_shm.pro

@@ -1,41 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2018-07-10T05:46:48
-#
-#-------------------------------------------------
-
-QT       -= gui
-
-QT       += dbus
-
-
-#DEFINES += USELCM
-
-DEFINES += USEDBUS
-
-TARGET = modulecomm_shm
-TEMPLATE = lib
-
-DEFINES += MODULECOMM_SHM_LIBRARY
-
-#VERSION = 1.0.1
-CONFIG += plugin
-
-
-SOURCES += modulecomm_shm.cpp \
-    procsm.cpp \
-    procsm_if.cpp
-
-HEADERS += modulecomm_shm.h \
-    procsm.h \
-    procsm_if.h \
-    ivmodulemsg_type.h
-
-unix {
-    target.path = /usr/lib
-    INSTALLS += target
-}
-
-#INCLUDEPATH += $$PWD/../../../include/
-LIBS += -L$$PWD
-

+ 0 - 378
src1/common/modulecomm_shm/procsm.cpp

@@ -1,378 +0,0 @@
-#include <iostream>
-#include <thread>
-#include <QTime>
-#include <QThread>
-
-#include "procsm.h"
-
-
-class AttachThread : public QThread
-{
-  public:
-    AttachThread(QSharedMemory * pa,bool & bAttach)
-    {
-       mbAttach = bAttach;
-       mpa = pa;
-       mbrun = true;
-    }
-    QSharedMemory * mpa;
-    bool mbAttach = false;
-    bool mbrun = true;
-    void run()
-    {
-        mbAttach = mpa->attach();
-        mbrun = false;
-    }
-};
-
-procsm::procsm(const char * strsmname,const unsigned int nBufSize,const unsigned int nMaxPacCount,const int nMode)
-{
-//    mnBufSize = nBufSize;
-
-//    qDebug("create dbus");
-
-    mpASM = new QSharedMemory(strsmname);
-
-    if(nMode == ModeWrite)
-    {
-
-        mmodulemsg_type.mnBufSize = nBufSize;
-        mmodulemsg_type.mnMsgBufCount = nMaxPacCount;
-        strncpy(mmodulemsg_type.mstrmsgname,strsmname,255);
-#ifdef USEDBUS
-        mmsg = QDBusMessage::createSignal("/catarc/adc",  "adc.adciv.modulecomm", strsmname);
-        mmsg<<1;
-#endif
-
-        bool bAttach = false;
-        AttachThread AT(mpASM,bAttach);
-        AT.start();
-        QTime xTime;
-        xTime.start();
-        while(xTime.elapsed()<100)
-        {
-            if(AT.mbrun == false)
-            {
-                bAttach = AT.mbAttach;
-                break;
-            }
-        }
- //       qDebug("time is %d",xTime.elapsed());
-        if(xTime.elapsed()>= 1000)
-        {
-            qDebug("in 1000ms Attach fail.terminate it .");
-            AT.terminate();
-            bAttach = false;
-        }
-
- //       if(!mpASM->attach())
-        if(!bAttach)
-        {
-
-            mpASM->create(sizeof(procsm_info)+nMaxPacCount*sizeof(procsm_head) + nBufSize);
-            char * p = (char *)mpASM->data();
-            mpinfo = (procsm_info *)p;
-            mphead = (procsm_head *)(p+sizeof(procsm_info));
-            mpinfo->mCap = nMaxPacCount;
-            mpinfo->mnBufSize = nBufSize;
-            mpinfo->mFirst = 0;
-            mpinfo->mNext = 0;
-            mpinfo->mLock = 0;
-        }
-
-
-
-
-        if(mpASM->isAttached())
-        {
-
-            mbAttach = true;
-            char * p = (char *)mpASM->data();
-            mpinfo = (procsm_info *)p;
-            mphead = (procsm_head *)(p+sizeof(procsm_info));
-            mnMaxPacCount = mpinfo->mCap;
-            mnBufSize = mpinfo->mnBufSize;
-    //        qDebug("attach successful");
-            mstrtem = new char[mnBufSize];
-
-#ifdef USEDBUS
-            mmsgres = QDBusMessage::createSignal("/catarc/adc",  "adciv.interface", "modulemsgres");
-            mmsgres<<1;
-
-            bool bconnect = QDBusConnection::sessionBus().connect(QString(),"/catarc/adc",  "adciv.interface", "modulemsgquery",this,SLOT(onQuery()));
-            if(bconnect == false)
-            {
-                std::cout<<"procsm_if_readthread::procsm_if_readthread bconect is false"<<std::endl;
-            }
-#endif
-        }
-        else
-        {
-          mbAttach = false;
-            qDebug("Share Memory Error.");
-        }
-
-
-    }
-}
-
-#ifdef USEDBUS
-    void procsm::onQuery()
-    {
-        QByteArray ba;
-        ba.append((char *)&mmodulemsg_type,sizeof(iv::modulemsg_type));
-
-        QList<QVariant> x;
-        x<<ba;
-        mmsgres.setArguments(x);
-        QDBusConnection::sessionBus().send(mmsgres);
-    }
-
-#endif
-
-bool procsm::AttachMem()
-{
-    mpASM->attach();
-    if(mpASM->isAttached())
-    {
-        mbAttach = true;
-        char * p = (char *)mpASM->data();
-        mpinfo = (procsm_info *)p;
-        mphead = (procsm_head *)(p+sizeof(procsm_info));
-        mnMaxPacCount = mpinfo->mCap;
-        mnBufSize = mpinfo->mnBufSize;
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-int procsm::MoveMem(const unsigned int nSize)
-{
-//    qDebug("move mem");
-     unsigned int nRemove = nSize;
-     if(nRemove == 0)return -1;
-
-//     unsigned int * pIndexFirst = (unsigned int *)mpASM->data();
-//     unsigned int * pIndexNext = pIndexFirst+1;
-//     qDebug("first = %d next = %d",*pIndexFirst,*pIndexNext);
-//    unsigned int * pIndexNext = pIndexFirst;
-    char * pH,*pD;
-    pH = (char *)mpASM->data();pH = pH + sizeof(procsm_info);
-    pD = (char *)mpASM->data();pD = pD + sizeof(procsm_info) + mnMaxPacCount * sizeof(procsm_head);
-    procsm_head * phh = (procsm_head *)pH;
-    unsigned int nPac = mpinfo->mNext - mpinfo->mFirst;
-
-    if(nRemove >nPac)
-    {
-  //      qDebug("procsm::MoveMem nRemove > nPac nRemove = %d",nRemove);
-        nRemove = nPac;
-    }
-
-    if(nRemove == nPac)
-    {
-        mpinfo->mFirst = mpinfo->mFirst + (unsigned int)nRemove;
-        return 0;
-    }
-
-    unsigned int i;
-    int nDataMove = 0;
-    for(i=0;i<nRemove;i++)
-    {
-        procsm_head * phd = phh+i;
-        nDataMove = nDataMove + phd->mnLen;
-    }
-    unsigned int nDataTotal;
-    for(i=0;i<(nPac - nRemove);i++)
-    {
-        memcpy(phh+i,phh+i+nRemove,sizeof(procsm_head));
-        (phh+i)->mnPos = (phh+i)->mnPos - nDataMove;
-    }
-    nDataTotal = (phh + nPac-nRemove-1)->mnPos + (phh+nPac-nRemove-1)->mnLen;
-    memcpy(mstrtem,pD+nDataMove,nDataTotal);
-    memcpy(pD,mstrtem,nDataTotal);
-
-//    for(i=0;i<nDataTotal;i++)
-//    {
-//        *(pD+i) = *(pD+i+nDataMove);
-//    }
-    mpinfo->mFirst = mpinfo->mFirst + (unsigned int)nRemove;
-    return 0;
-}
-
-int procsm::writemsg(const char *str, const unsigned int nSize)
-{
-    if(nSize > mnBufSize)
-    {
-        qDebug("procsm::writemsg message size is very big");
-        return -1;
-    }
-    if(mbAttach == false)
-    {
-        std::cout<<"ShareMemory Attach fail."<<std::endl;
-        return -1;
-    }
-    mpASM->lock();
-
-
-
-//    unsigned int * pIndexFirst = (unsigned int *)mpASM->data();
-//    unsigned int * pIndexNext = pIndexFirst+1;
-    if(mpinfo->mLock == 1)
-    {
-        std::cout<<"ShareMemory have lock.Init."<<std::endl;
-        mpinfo->mLock = 0;
-        mpinfo->mFirst = 0;
-        mpinfo->mNext = 0;
-    }
-    mpinfo->mLock =1;
-WRITEMSG:
-    char * pH,*pD;
-    QDateTime dt;
-    pH = (char *)mpASM->data();pH = pH + sizeof(procsm_info);
-    pD = (char *)mpASM->data();pD = pD + sizeof(procsm_info) + mnMaxPacCount * sizeof(procsm_head);
-    procsm_head * phh = (procsm_head *)pH;
-    unsigned int nPac = mpinfo->mNext - mpinfo->mFirst;
-    if(nPac>=mnMaxPacCount)
-    {
-        unsigned int nRemove = mnMaxPacCount/3;
-        if(nRemove == 0)nRemove = 1;
-        MoveMem(nRemove);
-        goto WRITEMSG;
-    }
-    if(nPac == 0)
-    {
-        memcpy(pD,str,nSize);
-        dt = QDateTime::currentDateTime();
-    //    phh->mdt = dt;
-        phh->SetDate(dt);
-   //     memcpy(&phh->mdt,&dt,sizeof(QDateTime));
-   //     phh->mdt = QDateTime::currentDateTime();
-        phh->mindex = mpinfo->mNext;
-        phh->mnPos = 0;
-        phh->mnLen = nSize;
-        mpinfo->mNext = mpinfo->mNext+1;
-    }
-    else
-    {
-        if(((phh+nPac-1)->mnPos+(phh+nPac-1)->mnLen + nSize)>=mnBufSize)
-        {
-            unsigned int nRemove = mnMaxPacCount/2;
-            if(nRemove == 0)nRemove = 1;
-            MoveMem(nRemove);
-            goto WRITEMSG;
-        }
-        else
-        {
-            unsigned int nPos = (phh+nPac-1)->mnPos + (phh+nPac-1)->mnLen;
-     //       qDebug("write pos = %d",nPos);
-            memcpy(pD+nPos,str,nSize);
-            dt = QDateTime::currentDateTime();
-            (phh+nPac)->SetDate(dt);
- //           memcpy(&(phh+nPac)->mdt,&dt,sizeof(QDateTime));
- //           (phh+nPac)->mdt = QDateTime::currentDateTime();
-            (phh+nPac)->mindex = mpinfo->mNext;
-            (phh+nPac)->mnPos = nPos;
-            (phh+nPac)->mnLen = nSize;
-            mpinfo->mNext = mpinfo->mNext+1;
-        }
-    }
-
-    const unsigned int nTM = 0x6fffffff;
-    if((mpinfo->mNext >nTM)&&(mpinfo->mFirst>nTM))
-    {
-       nPac = mpinfo->mNext - mpinfo->mFirst;
-       unsigned int i;
-       for(i=0;i<nPac;i++)
-       {
-           (phh+i)->mindex = (phh+i)->mindex-nTM;
-       }
-       mpinfo->mFirst = mpinfo->mFirst-nTM;
-       mpinfo->mNext = mpinfo->mNext - nTM;
-    }
-
-    mpinfo->mLock = 0;
-    mpASM->unlock();
-#ifdef USEDBUS
-    QDBusConnection::sessionBus().send(mmsg);
-#endif
-    return 0;
-}
-
-unsigned int procsm::getcurrentnext()
-{
-
-
-    unsigned int nNext;
-    mpASM->lock();
-    nNext = mpinfo->mNext;
-    mpASM->unlock();
-    return nNext;
-}
-
-
-//if return 0 No Data.
-//if return -1 nMaxSize is small
-//if retrun -2 index is not in range,call getcurrentnext get position
-//if return > 0 readdata
-int procsm::readmsg(unsigned int index, char *str, unsigned int nMaxSize,unsigned int * nRead,QDateTime * pdt)
-{
-    if(mbAttach == false)
-    {
-        std::cout<<"ShareMemory Attach fail."<<std::endl;
-        return -1;
-    }
-    int nRtn = 0;
-    mpASM->lock();
-
-    if((index< mpinfo->mFirst)||(index > mpinfo->mNext))
-    {
-        nRtn = -2;
-    }
-    if(nRtn != (-2))
-    {
-        if(index == mpinfo->mNext)
-        {
-            nRtn = 0;
-        }
-        else
-        {
-            char * pH,*pD;
- //           pH = (char *)mpASM->data();pH = pH + 2*sizeof(unsigned int);
-
- //           pD = (char *)mpASM->data();pD = pD + 2*sizeof(unsigned int) + mnMaxPacCount * sizeof(procsm_head);
-            pD = (char *)mpASM->data();pD = pD+ sizeof(procsm_info) + mpinfo->mCap*sizeof(procsm_head);
-            pH = (char *)mpASM->data();pH = pH+sizeof(procsm_info);
-            procsm_head * phh = (procsm_head *)pH;
-            unsigned int nPac = mpinfo->mNext - mpinfo->mFirst;
-            if(nPac == 0)
-            {
-                nRtn = 0;
-            }
-            else
-            {
-                unsigned int nPos = index - mpinfo->mFirst;
-                *nRead = (phh+nPos)->mnLen;
-                if((phh+nPos)->mnLen > nMaxSize)
-                {
-                    nRtn = -1;
-
-                }
-                else
-                {
-        //            qDebug("read pos = %d",(phh+nPos)->mnPos);
-                   memcpy(str,pD + (phh+nPos)->mnPos,(phh+nPos)->mnLen);
-          //         qDebug("read pos = %d",(phh+nPos)->mnPos);
-                   nRtn = (phh+nPos)->mnLen;
-                   (phh+nPos)->GetDate(pdt);
-           //        memcpy(pdt,&((phh+nPos)->mdt),sizeof(QDateTime));
-                }
-            }
-        }
-    }
-    mpASM->unlock();
-    return nRtn;
-}
-

+ 0 - 112
src1/common/modulecomm_shm/procsm.h

@@ -1,112 +0,0 @@
-#ifndef PROCSM_H
-#define PROCSM_H
-
-#include <QThread>
-#include <QSharedMemory>
-#include <QDateTime>
-#include <QList>
-#include <QVariant>
-
-#ifdef USEDBUS
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusConnection>
-
-#endif
-
-#include "ivmodulemsg_type.h"
-
-class procsm_info
-{
-public:
-  unsigned int mFirst;
-  unsigned int mNext;
-  unsigned int mCap;
-  unsigned int mLock;
-  unsigned int mnBufSize;
-};
-
-class procsm_head
-{
-public:
-    unsigned short mYear;
-    unsigned char mMonth;
-    unsigned char mDay;
-    unsigned char mHour;
-    unsigned char mMinute;
-    unsigned char mSec;
-    unsigned short mMSec;
-    unsigned int mindex;
-    unsigned int mnPos;
-    unsigned int mnLen;
-public:
-    void SetDate(QDateTime dt)
-    {
-        mYear = dt.date().year();
-        mMonth = dt.date().month();
-        mDay = dt.date().day();
-        mHour = dt.time().hour();
-        mMinute = dt.time().minute();
-        mSec = dt.time().second();
-        mMSec = dt.time().msec();
-    }
-    void GetDate(QDateTime * pdt)
-    {
-        QDate dt;
-        dt.setDate(mYear,mMonth,mDay);
-        QTime time;
-        time.setHMS(mHour,mMinute,mSec,mMSec);
-        pdt->setDate(dt);
-        pdt->setTime(time);
-
-    }
-};
-
-class procsm : public QObject
-{
-#ifdef USEDBUS
-    Q_OBJECT
-
-#endif
-public:
-    procsm(const char * strsmname,const unsigned int nBufSize,const unsigned int nMaxPacCount,const int nMode);
-    int writemsg(const char * str,const unsigned int nSize);
-    unsigned int getcurrentnext();
-    int readmsg(unsigned int index,char * str,unsigned int nMaxSize,unsigned int * nRead,QDateTime * pdt);
-
-    bool AttachMem();
-
-private:
-    int MoveMem(const unsigned int nSize);
-    QSharedMemory * mpASM;
-    unsigned int mnBufSize;
-    unsigned int mnMaxPacCount;
-    procsm_info * mpinfo;
-    procsm_head * mphead;
-
-    bool mbAttach;
-
-    char * mstrtem;
-
-public:
-    const static int ModeRead = 1;
-    const static int ModeWrite = 0;
-
-    iv::modulemsg_type mmodulemsg_type;
-
-#ifdef USEDBUS
-private slots:
-    void onQuery();
-
-#endif
-private:
-#ifdef USEDBUS
-    QDBusMessage mmsg;
-    QDBusMessage mmsgres;  //Response Message Query;
-
-#endif
-
-
-
-};
-
-#endif // PROCSM_H

+ 0 - 310
src1/common/modulecomm_shm/procsm_if.cpp

@@ -1,310 +0,0 @@
-#include "procsm_if.h"
-#include <QTimer>
-
-#include <iostream>
-
-
-
-procsm_if_readthread::procsm_if_readthread(procsm *pPSM,SMCallBack pCall,const char * strsmname)
-{
-    mpPSM = pPSM;
-    mpCall = pCall;
-    strncpy(mstrsmname,strsmname,255);
-
-#ifdef USEDBUS
-    bool bconnect = QDBusConnection::sessionBus().connect(QString(),"/catarc/adc",  "adc.adciv.modulecomm", strsmname,this,SLOT(onNewMsg(int)));
-    if(bconnect == false)
-    {
-        std::cout<<"procsm_if_readthread::procsm_if_readthread bconect is false"<<std::endl;
-    }
-#endif
-}
-
-procsm_if_readthread::procsm_if_readthread(procsm *pPSM,ModuleFun xFun,const char * strsmname)
-{
-    mpPSM = pPSM;
-    mFun = xFun;
-    strncpy(mstrsmname,strsmname,255);
-    mbFunPlus = true;
-
-#ifdef USEDBUS
-    bool bconnect = QDBusConnection::sessionBus().connect(QString(),"/catarc/adc",  "adc.adciv.modulecomm", strsmname,this,SLOT(onNewMsg(int)));
-    if(bconnect == false)
-    {
-        std::cout<<"procsm_if_readthread::procsm_if_readthread bconect is false"<<std::endl;
-        mbDBUSOK = false;
-        QTimer * timer = new QTimer();
-        timer->setTimerType(Qt::PreciseTimer);
-        delete timer;
-    }
-#endif
-}
-
-
-#ifdef USELCM
-    void procsm_if_readthread::handlerMethod(const lcm::ReceiveBuffer *rbuf, const std::string &channel)
-    {
-        qDebug("lcm receiv data. ");
-        mxindex++;
-        QDateTime dt = QDateTime::currentDateTime();
-        if(mbFunPlus)
-        {
-            mFun((char *)rbuf->data,rbuf->data_size,mxindex,&dt,mstrsmname);
-        }
-        else
-        {
-           (*mpCall)((char *)rbuf->data,rbuf->data_size,mxindex,&dt,mstrsmname);
-        }
-    }
-#endif
-
-
-void procsm_if_readthread::puaseread()
-{
-    mbRun = false;
-}
-
-void procsm_if_readthread::continueread()
-{
-    mbRun = true;
-}
-
-void procsm_if_readthread::run()
-{
-#ifdef USELCM
-    mlcm.subscribe(mstrsmname,&procsm_if_readthread::handlerMethod,this);
-    while(!QThread::isInterruptionRequested())
-    {
-        mlcm.handle();
-    }
-    return;
-#endif
-    QTime xTime;
-    xTime.start();
-    unsigned int nBufLen = 1;
-    unsigned int nRead;
-    char * str = new char[nBufLen];
-    unsigned int index =0;
-
-
-    QDateTime *pdt = new QDateTime();
-
-    bool bAttach = false;
-    while(!QThread::isInterruptionRequested())
-    {
-        if(mbRun == false)
-        {
-            msleep(10);
-            continue;
-        }
-        if(bAttach == false)
-        {
-            bAttach = mpPSM->AttachMem();
-            if(bAttach == false)
-            {
-                msleep(1);
-                continue;
-            }
-            else
-            {
-                index = mpPSM->getcurrentnext();
-            }
-        }
-
-        int nRtn = mpPSM->readmsg(index,str,nBufLen,&nRead,pdt);
-        if(nRtn == 0)
-        {
-#ifdef USEDBUS
-            if(mbDBUSOK == true)
-            {
-                mWaitMutex.lock();
-                mwc.wait(&mWaitMutex,10);
-                mWaitMutex.unlock();
-            }
-            else
-            {
-                msleep(1);
-            }
-#else
-            msleep(1);
-#endif
-        }
-        else
-        {
-            if(nRtn == -1)
-            {
-                nBufLen = nRead;
-                delete str;
-                if(nBufLen < 1)nBufLen = 1;
-                str = new char[nBufLen];
-            }
-            else
-            {
-                if(nRtn == -2)
-                {
-                   index = mpPSM->getcurrentnext();
-                }
-                else
-                {
-                   if(nRtn >0)
-                   {
-                       if(mbFunPlus)
-                       {
-                           mFun(str,nRtn,index,pdt,mstrsmname);
-                       }
-                       else
-                       {
-                          (*mpCall)(str,nRtn,index,pdt,mstrsmname);
-                       }
-                       index++;
-                   }
-                   else
-                   {
-                       usleep(100);
-                   }
-                }
-            }
-        }
-
-    }
-    delete str;
-    delete pdt;
-//    qDebug("Thread finish.");
-}
-
-#ifdef USEDBUS
-
-void procsm_if_readthread::onNewMsg(int x)
-{
-    if(x == 100)std::cout<<x<<std::endl;
-    mwc.wakeAll();
-//    qDebug("wake");
-}
-
-#endif
-
-procsm_if::procsm_if(const char * strsmname,const unsigned int nBufSize,const unsigned int nMaxPacCount,const int nMode)
-{
-    strncpy(mstrsmname,strsmname,255);
-#ifdef USELCM
-    if(nMode == procsm::ModeWrite)
-    {
-
-    }
-    else
-    {
-
-    }
-    return;
-#endif
-    mpPSM = new procsm(strsmname,nBufSize,nMaxPacCount,nMode);
-    mnType = nMode;
-
-    mTimer.setTimerType(Qt::PreciseTimer);
-
-}
-
-procsm_if::~procsm_if()
-{
-    if(mnType == procsm::ModeRead)
-    {
-
-        mpReadThread->requestInterruption();
-        while(!mpReadThread->isFinished())
-        {
-
-        }
-        delete mpReadThread;
-    }
-    delete mpPSM;
-}
-
-
-
-int procsm_if::writemsg(const char *str, const unsigned int nSize)
-{
-    if(mbRun == false)return -2;
-#ifdef USELCM
-    int nres = mlcm.publish(mstrsmname,str,nSize);
-    qDebug("publish message. res = %d",nres);
-    return 0;
-#endif
-    if(mnType == procsm::ModeRead)return -1; //this is listen.
-    return mpPSM->writemsg(str,nSize);
-}
-
-#ifdef USELCM
-    void procsm_if::handlerMethod(const lcm::ReceiveBuffer *rbuf, const std::string &channel)
-    {
-        qDebug("receiv data. ");
-    }
-#endif
-int procsm_if::listenmsg(SMCallBack pCall)
-{
-//#ifdef USELCM
-////     mlcm.subscribe(mstrsmname,&handlerMethod2);
-//    mlcm.subscribe(mstrsmname,&procsm_if::handlerMethod,this);
-//    while(true)
-//    {
-//        mlcm.handle();
-//    }
-//    return 0;
-//#endif
-    if(mnType == procsm::ModeWrite)return -1; //listening.
-    mpReadThread = new procsm_if_readthread(mpPSM,pCall,mstrsmname);
-//    mpReadThread->setPriority(QThread::TimeCriticalPriority);
-//    mpReadThread->start();
-    mpReadThread->start(QThread::HighestPriority);
-//    mnType = 1;
-    return 0;
-}
-
-int procsm_if::listenmsg(ModuleFun xFun)
-{
-//#ifdef USELCM
-//    mlcm.subscribe(mstrsmname,&procsm_if::handlerMethod,this);
-//    while(true)
-//    {
-//        mlcm.handle();
-//    }
-//    return 0;
-//#endif
-    if(mnType == procsm::ModeWrite)return -1; //listening.
-    mpReadThread = new procsm_if_readthread(mpPSM,xFun,mstrsmname);
-//    mpReadThread->setPriority(QThread::TimeCriticalPriority);
-//    mpReadThread->start();
-    mpReadThread->start(QThread::HighestPriority);
-//    mnType = 1;
-    return 0;
-}
-
-void procsm_if::stoplisten()
-{
-    if(mnType != 1)return;
-    mpReadThread->requestInterruption();
-    while(!mpReadThread->isFinished());
-    mnType = 0;
-//    mpReadThread->deleteLater();
-    qDebug("stop listen ok");
-}
-
-void procsm_if::pausecomm()
-{
-    mbRun = false;
-    if(mnType == procsm::ModeRead)
-    {
-        mpReadThread->puaseread();
-    }
-}
-
-void procsm_if::continuecomm()
-{
-    mbRun = true;
-    if(mnType == procsm::ModeRead)
-    {
-        mpReadThread->continueread();
-    }
-}
-
-
-

+ 0 - 99
src1/common/modulecomm_shm/procsm_if.h

@@ -1,99 +0,0 @@
-#ifndef PROCSM_IF_H
-#define PROCSM_IF_H
-
-#include <QThread>
-#include <QTimer>
-#include <QWaitCondition>
-#include <QMutex>
-#include <functional>
-
-#ifdef USEDBUS
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusConnection>
-
-#endif
-
-#include "procsm.h"
-
-typedef void (* SMCallBack)(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname);
-using namespace std::placeholders;
-typedef std::function<void(const char * ,const unsigned int , const unsigned int , QDateTime * ,const char *)> ModuleFun;
-
-class procsm_if_readthread:public QThread
-{
-    Q_OBJECT
-public:
-#ifdef USELCM
-
-#endif
-    procsm_if_readthread(procsm * pPSM,SMCallBack pCall,const char * strsmname);
-    procsm_if_readthread(procsm * pPSM,ModuleFun xFun,const char * strsmname);
-
-    void puaseread();
-    void continueread();
-private slots:
-#ifdef USEDBUS
-    void onNewMsg(int x);
-#endif
-private:
-
-#ifdef USELCM
-    lcm::LCM mlcm;
-    void handlerMethod(const lcm::ReceiveBuffer *rbuf,const std::string &channel);
-    int mxindex = 0;
-#endif
-    void run();
-    procsm * mpPSM;
-    SMCallBack  mpCall;
-    ModuleFun mFun;
-    char mstrsmname[256];
-
-    QWaitCondition mwc;
-
-    QMutex mWaitMutex;
-    bool mbFunPlus = false;
-    bool mbRun = true;
-    bool mbDBUSOK = true;
-};
-
-class procsm_if
-{
-
-
-public:
-    procsm_if(const char * strsmname,const unsigned int nBufSize,const unsigned int nMaxPacCount,const int nMode);
-    ~procsm_if();
-
-    int writemsg(const char * str,const unsigned int nSize);
-    int listenmsg(SMCallBack pCall);
-    int listenmsg(ModuleFun xFun);
-    void stoplisten();
-
-    void pausecomm();
-    void continuecomm();
-
-
-private:
-    procsm * mpPSM;
-    int mnType;
-    procsm_if_readthread * mpReadThread;
-    QTimer mTimer;
-    char mstrsmname[256];
-
-    bool mbRun = true;
-
-
-
-#ifdef USELCM
-    lcm::LCM mlcm;
-    void handlerMethod(const lcm::ReceiveBuffer *rbuf,const std::string &channel);
-#endif
-
-
-
-
-
-
-};
-
-#endif // PROCSM_IF_H