1. 调整idl。

main
baocm 8 months ago
parent b7a813b18f
commit e5a3c9f9d5

@ -31,15 +31,15 @@ add_library(System_lib lib/SystemTypeObjectSupport.cxx lib/SystemPubSubTypes.cxx
target_link_libraries(System_lib fastcdr fastdds)
# Demo Application.
add_executable(Demo
demo/main.cxx
demo/Publisher.cxx
demo/Subscriber.cxx
)
target_include_directories(Demo PRIVATE demo)
target_link_libraries(Demo fastcdr fastdds
System_lib
)
# add_executable(Demo
# demo/main.cxx
# demo/Publisher.cxx
# demo/Subscriber.cxx
# )
# target_include_directories(Demo PRIVATE demo)
# target_link_libraries(Demo fastcdr fastdds
# System_lib
# )
# IoCtrl Application.
add_executable(IoCtrl

@ -46,7 +46,7 @@ PublisherApp::PublisherApp(
, publisher_(nullptr)
, topic_(nullptr)
, writer_(nullptr)
, type_(new LicencePlateRspPubSubType())
, type_(new WeighingSystem::LicenseSnapUpdatePubSubType())
, matched_(0)
, samples_sent_(0)
, stop_(false)
@ -74,28 +74,34 @@ PublisherApp::PublisherApp(
publisher_ = participant_->create_publisher(pub_qos, nullptr, StatusMask::none());
if (publisher_ == nullptr)
{
throw std::runtime_error("LicencePlateRsp Publisher initialization failed");
throw std::runtime_error("HttpServer Publisher initialization failed");
}
// Create the topic
TopicQos topic_qos = TOPIC_QOS_DEFAULT;
participant_->get_default_topic_qos(topic_qos);
topic_ = participant_->create_topic("LicencePlateRspTopic", type_.get_type_name(), topic_qos);
topic_ = participant_->create_topic("LicenseSnapUpdate", type_.get_type_name(), topic_qos);
if (topic_ == nullptr)
{
throw std::runtime_error("LicencePlateRsp Topic initialization failed");
throw std::runtime_error("WeighingSystem::LicenseSnapUpdate Topic initialization failed");
}
// Create the data writer
DataWriterQos writer_qos = DATAWRITER_QOS_DEFAULT;
publisher_->get_default_datawriter_qos(writer_qos);
writer_qos.reliability().kind = ReliabilityQosPolicyKind::RELIABLE_RELIABILITY_QOS;
writer_qos.reliability().max_blocking_time = Duration_t(1, 0);
writer_qos.durability().kind = DurabilityQosPolicyKind::TRANSIENT_LOCAL_DURABILITY_QOS;
writer_qos.history().kind = HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS;
writer_qos.history().depth = 1;
writer_qos.resource_limits().max_samples = 200;
writer_qos.resource_limits().max_instances = 1;
writer_qos.resource_limits().max_samples_per_instance = 100;
writer_qos.data_sharing().off();
writer_ = publisher_->create_datawriter(topic_, writer_qos, this, StatusMask::all());
if (writer_ == nullptr)
{
throw std::runtime_error("LicencePlateRsp DataWriter initialization failed");
throw std::runtime_error("WeighingSystem::LicenseSnapUpdate DataWriter initialization failed");
}
}
@ -141,6 +147,7 @@ void PublisherApp::on_publication_matched(
void PublisherApp::run(std::shared_ptr<HTTPServer> handler)
{
std::string old_License = "";
while (!is_stopped())
{
handler->run();
@ -150,9 +157,15 @@ void PublisherApp::run(std::shared_ptr<HTTPServer> handler)
json j = json::parse(handler->PostMsg);
std::cout << "车牌: " << j["AlarmInfoPlate"]["result"]["PlateResult"]["license"] << std::endl;
LicencePlateRsp rsp;
rsp.licence() = j["AlarmInfoPlate"]["result"]["PlateResult"]["license"];
writer_->write(&rsp);
WeighingSystem::LicenseSnapUpdate info;
info.License() = j["AlarmInfoPlate"]["result"]["PlateResult"]["license"];
info.NewTag() = 1;
if (info.License() == old_License)
{
info.NewTag() = 2;
}
old_License = info.License();
writer_->write(&info);
handler->PostMsg.clear();
}
@ -180,7 +193,7 @@ bool PublisherApp::publish()
if (!is_stopped())
{
/* Initialize your structure here */
WeighRsp sample_;
WeighingSystem::LicenseSnapUpdate sample_;
ret = (RETCODE_OK == writer_->write(&sample_));
}
return ret;

@ -43,7 +43,7 @@ SubscriberApp::SubscriberApp(
, subscriber_(nullptr)
, topic_(nullptr)
, reader_(nullptr)
, type_(new LicencePlateReqPubSubType())
, type_(new WeighingSystem::LicenseSnapUpdatePubSubType())
, samples_received_(0)
, stop_(false)
{
@ -68,16 +68,16 @@ SubscriberApp::SubscriberApp(
subscriber_ = participant_->create_subscriber(sub_qos, nullptr, StatusMask::none());
if (subscriber_ == nullptr)
{
throw std::runtime_error("LicencePlateReq Subscriber initialization failed");
throw std::runtime_error("HttpServer Subscriber initialization failed");
}
// Create the topic
TopicQos topic_qos = TOPIC_QOS_DEFAULT;
participant_->get_default_topic_qos(topic_qos);
topic_ = participant_->create_topic("LicencePlateReqTopic", type_.get_type_name(), topic_qos);
topic_ = participant_->create_topic("LicenseSnapUpdate", type_.get_type_name(), topic_qos);
if (topic_ == nullptr)
{
throw std::runtime_error("LicencePlateReq Topic initialization failed");
throw std::runtime_error("WeighingSystem::LicenseSnapUpdate Topic initialization failed");
}
// Create the reader
@ -89,7 +89,7 @@ SubscriberApp::SubscriberApp(
reader_ = subscriber_->create_datareader(topic_, reader_qos, this, StatusMask::all());
if (reader_ == nullptr)
{
throw std::runtime_error("LicencePlateReq DataReader initialization failed");
throw std::runtime_error("WeighingSystem::LicenseSnapUpdate DataReader initialization failed");
}
}
@ -127,7 +127,7 @@ void SubscriberApp::on_subscription_matched(
void SubscriberApp::on_data_available(
DataReader* reader)
{
LicencePlateReq sample_;
WeighingSystem::LicenseSnapUpdate sample_;
SampleInfo info;
while ((!is_stopped()) && (RETCODE_OK == reader->take_next_sample(&sample_, &info)))
{

@ -33,7 +33,7 @@
#include "httpserver.hpp"
#define VERSION "v1.0"
#define VERSION "v1.0.0"
using eprosima::fastdds::dds::Log;
@ -67,7 +67,7 @@ std::string parse_signal(
int main(int argc, char** argv)
{
auto ret = EXIT_SUCCESS;
std::shared_ptr<SubscriberApp> sub;
// std::shared_ptr<SubscriberApp> sub;
std::shared_ptr<PublisherApp> pub;
std::shared_ptr<HTTPServer> dev;
@ -112,7 +112,7 @@ int main(int argc, char** argv)
}
}
sub = std::make_shared<SubscriberApp>(domain_id);
// sub = std::make_shared<SubscriberApp>(domain_id);
pub = std::make_shared<PublisherApp>(domain_id);
dev = std::make_shared<HTTPServer>();

@ -1,14 +0,0 @@
#ifndef _MSG_HPP_
#define _MSG_HPP_
#include <queue>
#include <mutex>
#include "System.hpp"
class MsgData {
public:
static std::queue<PrintReq> PrintReq_queue_;
static std::mutex queue_cv_mtx_;
};
#endif

File diff suppressed because it is too large Load Diff

@ -1,42 +1,199 @@
@extensibility(APPENDABLE)
module InternalSystem
{
struct LicencePlateReq
{
unsigned long index;
map<string, string> msg;
module WeighingSystem {
// ============================================
// Topic: onScaleInfoUpdate
// 称重设备信息更新主题
// ============================================
struct ScaleInfo {
boolean HasVehicle; // 有车 0:无车 1:有车
boolean WeightOK; // 重量稳定信号 0: 不稳定 1:稳定
boolean State; // 设备状态 0:异常仪表 1正常接收仪表
float Value; // 实时重量
float StableValue; // 稳定重量
};
struct LicencePlateRsp
{
unsigned long index;
string licence;
// ============================================
// Topic: onScaleCommandUpdate
// 称重设备命令更新主题
// ============================================
struct ScaleCommand {
boolean Enable; // 是否启用 启动参数
long ResetZero; // 仪表重置0 脉冲信号 1:清零 自动变0
};
struct PrintReq
{
unsigned long index;
map<string, string> msg;
// ============================================
// Topic: onWeightInfoOKUpdate
// 称重业务成功信息更新主题
// ============================================
struct WeightInfoOk {
// 基础信息属性
long DeviceID; // 磅称编号
string DeviceName; // 磅称名称
string DeviceType; // 磅称类型 1:重磅 2:轻磅 3:通用称重 4:转煤
string EnterpriseName; // 本系统企业名称
// 业务单据属性
string BillNumber; // 票据号
string CarNumber; // 车牌号
string Supplier; // 往来单位
string GoodsType; // 品种
// 重量数据属性
float GrossWeight; // 毛重
string GrossTime; // 毛重时间
string GrossOperater; // 毛重操作员
float Tare; // 皮重
string TareTime; // 皮重时间
string TareOperater; // 皮重操作员
float Suttle; // 净重
// 扣重属性
float duduction1; // 扣矸 大宗物资扣吨打印
float duduction2; // 扣水 大宗物资扣钱打印
float duduction3; // 扣杂
// 物流信息属性
string INCoalYard; // 卸货点
string OutCoalYard; // 装货点
string BatchNumber; // 批次号
// 操作结果提示属性
string Warning; // 提示 字符串
};
struct PrintRsp
{
unsigned long index;
string msg;
// ============================================
// Topic: onWeightInfoErrorUpdate
// 称重业务成功信息更新主题
// ============================================
struct WeightInfoError {
//车牌
string CarNumber; // 车牌号
// 操作结果提示属性
string Warning; // 提示 字符串
};
// ============================================
// Topic: onBarCommandUpdate
// 拦车器命令更新主题
// ============================================
struct BarCommandUpdate {
// 前拦车器控制
long FrontBarSignalUp; // 前拦车器抬起信号 脉冲信号 1-》0 发1 自动置为0
long FrontBarSignalDown; // 前拦车器放下信号 脉冲信号 1-》0 发1 自动置为0
boolean FrontBarEnable; // 前拦车器是否启用 1 启用 0 不启用
// 后拦车器控制
long BackBarSignalUp; // 后拦车器抬起信号 脉冲信号 1-》0 发1 自动置为0 (属性ID: 7)
long BackBarSignalDown; // 后拦车器放下信号 脉冲信号 1-》0 发1 自动置为0
boolean BackBarEnable; // 后拦车器是否启用 1 启用 0 不启用
};
// ============================================
// Topic: onLightsCommandUpdate
// 红绿灯命令更新主题
// ============================================
struct LightsCommandUpdate {
// 前红绿灯控制
long FrontLEDSignal; // 前红绿灯信号 1.红 2.绿
boolean FrontLEDEnable; // 前红绿灯是否启用 1 启用 0 不启用
// 后红绿灯控制
long BackLEDSignal; // 后红绿灯信号 1.红 2.绿
long BackLEDEnable; // 后红绿灯是否启用 1 启用 0 不启用
};
// ============================================
// Topic: InfraredCommandUpdate
// 拦车器与红绿灯命令更新主题
// ============================================
struct InfraredCommandUpdate {
// 前红外对射控制
long FrontResistanceUnLock; // 前红外对射临时解除 1.解除 0.不解除
boolean FrontResistanceEnable; // 前红外对射启用 1 启用 0 不启用
// 后红外对射控制
long BackResistanceUnLock; // 后红外对射临时解除 1.解除 0.不解除
boolean BackResistanceEnable; // 后红外对射启用 1 启用 0 不启用
};
// ============================================
// Topic: onBarUpdate
// 拦车器更新主题
// ============================================
struct BarUpdate {
// 前拦车器状态
long FrontBarState; // 1 抬起状态 2 放下状态
// 后拦车器状态
long BackBarState; // 1 抬起状态 2 放下状态
};
// ============================================
// Topic: onLightsUpdate
// 红绿灯状态更新主题
// ============================================
struct LightsUpdate {
// 前红绿灯状态
long FrontLEDState; // 1.红 2.绿
// 后红绿灯状态
long BackLEDState; // 1.红 2.绿
};
struct WeighReq
// ============================================
// Topic: onInfraredUpdate
// 拦车器与红绿灯状态更新主题
// ============================================
struct InfraredUpdate {
// 前红外对射状态
long FrontResistanceSignal; // 1 有阻挡 0 无阻挡
// 后红外对射状态
long BackResistanceSignal; // 1 有阻挡 0 无阻挡
};
// ============================================
// Topic: LicenseSnap
// 车牌识别类
// ============================================
struct LicenseSnapUpdate {
long NewTag; // 车牌更新 1 新的 2 旧的不变
string License; // 车牌号
};
// ============================================
// Topic: LicenseSnap
// 语音播放ID
// ============================================
struct Voice {
long VoiceID; //语音ID
string VoiceContent; //语音string,后续如果可以程序用tts直接播放语音内容
};
};
module InternalSystem
{
struct PrintReq
{
unsigned long index;
map<string, string> msg;
};
struct WeighRsp
struct PrintRsp
{
unsigned long index;
float stable_weight;
float instantaneous_weight;
string msg;
};
struct IoCtrlReq

@ -24,30 +24,54 @@
#include "System.hpp"
constexpr uint32_t InternalSystem_WeighRsp_max_cdr_typesize {16UL};
constexpr uint32_t InternalSystem_WeighRsp_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_LightsUpdate_max_cdr_typesize {12UL};
constexpr uint32_t WeighingSystem_LightsUpdate_max_key_cdr_typesize {0UL};
constexpr uint32_t InternalSystem_PrintRsp_max_cdr_typesize {268UL};
constexpr uint32_t InternalSystem_PrintRsp_max_key_cdr_typesize {0UL};
constexpr uint32_t InternalSystem_WeighReq_max_cdr_typesize {16UL};
constexpr uint32_t InternalSystem_WeighReq_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_InfraredUpdate_max_cdr_typesize {12UL};
constexpr uint32_t WeighingSystem_InfraredUpdate_max_key_cdr_typesize {0UL};
constexpr uint32_t InternalSystem_PrintReq_max_cdr_typesize {16UL};
constexpr uint32_t InternalSystem_PrintReq_max_key_cdr_typesize {0UL};
constexpr uint32_t InternalSystem_LicencePlateReq_max_cdr_typesize {16UL};
constexpr uint32_t InternalSystem_LicencePlateReq_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_WeightInfoError_max_cdr_typesize {524UL};
constexpr uint32_t WeighingSystem_WeightInfoError_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_WeightInfoOk_max_cdr_typesize {3932UL};
constexpr uint32_t WeighingSystem_WeightInfoOk_max_key_cdr_typesize {0UL};
constexpr uint32_t InternalSystem_IoCtrlRsp_max_cdr_typesize {16UL};
constexpr uint32_t InternalSystem_IoCtrlRsp_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_InfraredCommandUpdate_max_cdr_typesize {17UL};
constexpr uint32_t WeighingSystem_InfraredCommandUpdate_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_LightsCommandUpdate_max_cdr_typesize {20UL};
constexpr uint32_t WeighingSystem_LightsCommandUpdate_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_LicenseSnapUpdate_max_cdr_typesize {268UL};
constexpr uint32_t WeighingSystem_LicenseSnapUpdate_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_ScaleInfo_max_cdr_typesize {16UL};
constexpr uint32_t WeighingSystem_ScaleInfo_max_key_cdr_typesize {0UL};
constexpr uint32_t InternalSystem_PrintRsp_max_cdr_typesize {268UL};
constexpr uint32_t InternalSystem_PrintRsp_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_Voice_max_cdr_typesize {268UL};
constexpr uint32_t WeighingSystem_Voice_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_BarCommandUpdate_max_cdr_typesize {25UL};
constexpr uint32_t WeighingSystem_BarCommandUpdate_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_ScaleCommand_max_cdr_typesize {12UL};
constexpr uint32_t WeighingSystem_ScaleCommand_max_key_cdr_typesize {0UL};
constexpr uint32_t WeighingSystem_BarUpdate_max_cdr_typesize {12UL};
constexpr uint32_t WeighingSystem_BarUpdate_max_key_cdr_typesize {0UL};
constexpr uint32_t InternalSystem_IoCtrlReq_max_cdr_typesize {16UL};
constexpr uint32_t InternalSystem_IoCtrlReq_max_key_cdr_typesize {0UL};
constexpr uint32_t InternalSystem_LicencePlateRsp_max_cdr_typesize {268UL};
constexpr uint32_t InternalSystem_LicencePlateRsp_max_key_cdr_typesize {0UL};
namespace eprosima {
namespace fastcdr {
@ -57,27 +81,59 @@ class CdrSizeCalculator;
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const InternalSystem::LicencePlateReq& data);
const WeighingSystem::ScaleInfo& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const InternalSystem::LicencePlateRsp& data);
const WeighingSystem::ScaleCommand& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const InternalSystem::PrintReq& data);
const WeighingSystem::WeightInfoOk& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const InternalSystem::PrintRsp& data);
const WeighingSystem::WeightInfoError& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const WeighingSystem::BarCommandUpdate& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const WeighingSystem::LightsCommandUpdate& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const WeighingSystem::InfraredCommandUpdate& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const WeighingSystem::BarUpdate& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const WeighingSystem::LightsUpdate& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const InternalSystem::WeighReq& data);
const WeighingSystem::InfraredUpdate& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const InternalSystem::WeighRsp& data);
const WeighingSystem::LicenseSnapUpdate& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const WeighingSystem::Voice& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const InternalSystem::PrintReq& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const InternalSystem::PrintRsp& data);
eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -37,22 +37,22 @@
Generated System is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen.
#endif // FASTDDS_GEN_API_VER
namespace InternalSystem
namespace WeighingSystem
{
/*!
* @brief This class represents the TopicDataType of the type LicencePlateReq defined by the user in the IDL file.
* @brief This class represents the TopicDataType of the type ScaleInfo defined by the user in the IDL file.
* @ingroup System
*/
class LicencePlateReqPubSubType : public eprosima::fastdds::dds::TopicDataType
class ScaleInfoPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef LicencePlateReq type;
typedef ScaleInfo type;
eProsima_user_DllExport LicencePlateReqPubSubType();
eProsima_user_DllExport ScaleInfoPubSubType();
eProsima_user_DllExport ~LicencePlateReqPubSubType() override;
eProsima_user_DllExport ~ScaleInfoPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
@ -88,9 +88,90 @@ namespace InternalSystem
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type ScaleCommand defined by the user in the IDL file.
* @ingroup System
*/
class ScaleCommandPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef ScaleCommand type;
eProsima_user_DllExport ScaleCommandPubSubType();
eProsima_user_DllExport ~ScaleCommandPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
@ -122,18 +203,18 @@ namespace InternalSystem
};
/*!
* @brief This class represents the TopicDataType of the type LicencePlateRsp defined by the user in the IDL file.
* @brief This class represents the TopicDataType of the type WeightInfoOk defined by the user in the IDL file.
* @ingroup System
*/
class LicencePlateRspPubSubType : public eprosima::fastdds::dds::TopicDataType
class WeightInfoOkPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef LicencePlateRsp type;
typedef WeightInfoOk type;
eProsima_user_DllExport LicencePlateRspPubSubType();
eProsima_user_DllExport WeightInfoOkPubSubType();
eProsima_user_DllExport ~LicencePlateRspPubSubType() override;
eProsima_user_DllExport ~WeightInfoOkPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
@ -203,18 +284,18 @@ namespace InternalSystem
};
/*!
* @brief This class represents the TopicDataType of the type PrintReq defined by the user in the IDL file.
* @brief This class represents the TopicDataType of the type WeightInfoError defined by the user in the IDL file.
* @ingroup System
*/
class PrintReqPubSubType : public eprosima::fastdds::dds::TopicDataType
class WeightInfoErrorPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef PrintReq type;
typedef WeightInfoError type;
eProsima_user_DllExport PrintReqPubSubType();
eProsima_user_DllExport WeightInfoErrorPubSubType();
eProsima_user_DllExport ~PrintReqPubSubType() override;
eProsima_user_DllExport ~WeightInfoErrorPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
@ -284,18 +365,18 @@ namespace InternalSystem
};
/*!
* @brief This class represents the TopicDataType of the type PrintRsp defined by the user in the IDL file.
* @brief This class represents the TopicDataType of the type BarCommandUpdate defined by the user in the IDL file.
* @ingroup System
*/
class PrintRspPubSubType : public eprosima::fastdds::dds::TopicDataType
class BarCommandUpdatePubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef PrintRsp type;
typedef BarCommandUpdate type;
eProsima_user_DllExport PrintRspPubSubType();
eProsima_user_DllExport BarCommandUpdatePubSubType();
eProsima_user_DllExport ~PrintRspPubSubType() override;
eProsima_user_DllExport ~BarCommandUpdatePubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
@ -331,9 +412,90 @@ namespace InternalSystem
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type LightsCommandUpdate defined by the user in the IDL file.
* @ingroup System
*/
class LightsCommandUpdatePubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef LightsCommandUpdate type;
eProsima_user_DllExport LightsCommandUpdatePubSubType();
eProsima_user_DllExport ~LightsCommandUpdatePubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
@ -365,18 +527,18 @@ namespace InternalSystem
};
/*!
* @brief This class represents the TopicDataType of the type WeighReq defined by the user in the IDL file.
* @brief This class represents the TopicDataType of the type InfraredCommandUpdate defined by the user in the IDL file.
* @ingroup System
*/
class WeighReqPubSubType : public eprosima::fastdds::dds::TopicDataType
class InfraredCommandUpdatePubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef WeighReq type;
typedef InfraredCommandUpdate type;
eProsima_user_DllExport WeighReqPubSubType();
eProsima_user_DllExport InfraredCommandUpdatePubSubType();
eProsima_user_DllExport ~WeighReqPubSubType() override;
eProsima_user_DllExport ~InfraredCommandUpdatePubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
@ -412,9 +574,90 @@ namespace InternalSystem
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type BarUpdate defined by the user in the IDL file.
* @ingroup System
*/
class BarUpdatePubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef BarUpdate type;
eProsima_user_DllExport BarUpdatePubSubType();
eProsima_user_DllExport ~BarUpdatePubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
@ -446,18 +689,18 @@ namespace InternalSystem
};
/*!
* @brief This class represents the TopicDataType of the type WeighRsp defined by the user in the IDL file.
* @brief This class represents the TopicDataType of the type LightsUpdate defined by the user in the IDL file.
* @ingroup System
*/
class WeighRspPubSubType : public eprosima::fastdds::dds::TopicDataType
class LightsUpdatePubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef WeighRsp type;
typedef LightsUpdate type;
eProsima_user_DllExport WeighRspPubSubType();
eProsima_user_DllExport LightsUpdatePubSubType();
eProsima_user_DllExport ~WeighRspPubSubType() override;
eProsima_user_DllExport ~LightsUpdatePubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
@ -526,6 +769,414 @@ namespace InternalSystem
};
/*!
* @brief This class represents the TopicDataType of the type InfraredUpdate defined by the user in the IDL file.
* @ingroup System
*/
class InfraredUpdatePubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef InfraredUpdate type;
eProsima_user_DllExport InfraredUpdatePubSubType();
eProsima_user_DllExport ~InfraredUpdatePubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return true;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type LicenseSnapUpdate defined by the user in the IDL file.
* @ingroup System
*/
class LicenseSnapUpdatePubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef LicenseSnapUpdate type;
eProsima_user_DllExport LicenseSnapUpdatePubSubType();
eProsima_user_DllExport ~LicenseSnapUpdatePubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type Voice defined by the user in the IDL file.
* @ingroup System
*/
class VoicePubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef Voice type;
eProsima_user_DllExport VoicePubSubType();
eProsima_user_DllExport ~VoicePubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
} // namespace WeighingSystem
namespace InternalSystem
{
/*!
* @brief This class represents the TopicDataType of the type PrintReq defined by the user in the IDL file.
* @ingroup System
*/
class PrintReqPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef PrintReq type;
eProsima_user_DllExport PrintReqPubSubType();
eProsima_user_DllExport ~PrintReqPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type PrintRsp defined by the user in the IDL file.
* @ingroup System
*/
class PrintRspPubSubType : public eprosima::fastdds::dds::TopicDataType
{
public:
typedef PrintRsp type;
eProsima_user_DllExport PrintRspPubSubType();
eProsima_user_DllExport ~PrintRspPubSubType() override;
eProsima_user_DllExport bool serialize(
const void* const data,
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool deserialize(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
void* data) override;
eProsima_user_DllExport uint32_t calculate_serialized_size(
const void* const data,
eprosima::fastdds::dds::DataRepresentationId_t data_representation) override;
eProsima_user_DllExport bool compute_key(
eprosima::fastdds::rtps::SerializedPayload_t& payload,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport bool compute_key(
const void* const data,
eprosima::fastdds::rtps::InstanceHandle_t& ihandle,
bool force_md5 = false) override;
eProsima_user_DllExport void* create_data() override;
eProsima_user_DllExport void delete_data(
void* data) override;
//Register TypeObject representation in Fast DDS TypeObjectRegistry
eProsima_user_DllExport void register_type_object_representation() override;
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
eProsima_user_DllExport inline bool is_bounded() const override
{
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
static_cast<void>(data_representation);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
eProsima_user_DllExport inline bool construct_sample(
void* memory) const override
{
static_cast<void>(memory);
return false;
}
#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
private:
eprosima::fastdds::MD5 md5_;
unsigned char* key_buffer_;
};
/*!
* @brief This class represents the TopicDataType of the type IoCtrlReq defined by the user in the IDL file.
* @ingroup System

File diff suppressed because it is too large Load Diff

@ -37,9 +37,9 @@
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
namespace InternalSystem {
namespace WeighingSystem {
/**
* @brief Register LicencePlateReq related TypeIdentifier.
* @brief Register ScaleInfo related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
@ -48,11 +48,11 @@ namespace InternalSystem {
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_LicencePlateReq_type_identifier(
eProsima_user_DllExport void register_ScaleInfo_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register LicencePlateRsp related TypeIdentifier.
* @brief Register ScaleCommand related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
@ -61,11 +61,11 @@ eProsima_user_DllExport void register_LicencePlateReq_type_identifier(
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_LicencePlateRsp_type_identifier(
eProsima_user_DllExport void register_ScaleCommand_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register PrintReq related TypeIdentifier.
* @brief Register WeightInfoOk related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
@ -74,11 +74,11 @@ eProsima_user_DllExport void register_LicencePlateRsp_type_identifier(
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_PrintReq_type_identifier(
eProsima_user_DllExport void register_WeightInfoOk_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register PrintRsp related TypeIdentifier.
* @brief Register WeightInfoError related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
@ -87,11 +87,63 @@ eProsima_user_DllExport void register_PrintReq_type_identifier(
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_PrintRsp_type_identifier(
eProsima_user_DllExport void register_WeightInfoError_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register BarCommandUpdate related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_BarCommandUpdate_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register LightsCommandUpdate related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_LightsCommandUpdate_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register InfraredCommandUpdate related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_InfraredCommandUpdate_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register BarUpdate related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_BarUpdate_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register WeighReq related TypeIdentifier.
* @brief Register LightsUpdate related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
@ -100,11 +152,11 @@ eProsima_user_DllExport void register_PrintRsp_type_identifier(
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_WeighReq_type_identifier(
eProsima_user_DllExport void register_LightsUpdate_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register WeighRsp related TypeIdentifier.
* @brief Register InfraredUpdate related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
@ -113,7 +165,61 @@ eProsima_user_DllExport void register_WeighReq_type_identifier(
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_WeighRsp_type_identifier(
eProsima_user_DllExport void register_InfraredUpdate_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register LicenseSnapUpdate related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_LicenseSnapUpdate_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register Voice related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_Voice_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
} // namespace WeighingSystem
namespace InternalSystem {
/**
* @brief Register PrintReq related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_PrintReq_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**
* @brief Register PrintRsp related TypeIdentifier.
* Fully-descriptive TypeIdentifiers are directly registered.
* Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is
* indirectly registered as well.
*
* @param[out] TypeIdentifier of the registered type.
* The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers.
* Invalid TypeIdentifier is returned in case of error.
*/
eProsima_user_DllExport void register_PrintRsp_type_identifier(
eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids);
/**

@ -47,7 +47,7 @@ PublisherApp::PublisherApp(
, publisher_(nullptr)
, topic_(nullptr)
, writer_(nullptr)
, type_(new PrintRspPubSubType())
, type_(new InternalSystem::PrintRspPubSubType())
, matched_(0)
, samples_sent_(0)
, stop_(false)
@ -190,7 +190,7 @@ bool PublisherApp::publish()
if (!is_stopped())
{
/* Initialize your structure here */
InternalSystem::LicencePlateRsp sample_;
InternalSystem::PrintReq sample_;
ret = (RETCODE_OK == writer_->write(&sample_));
}
return ret;

@ -45,7 +45,7 @@ SubscriberApp::SubscriberApp(
, subscriber_(nullptr)
, topic_(nullptr)
, reader_(nullptr)
, type_(new PrintReqPubSubType())
, type_(new InternalSystem::PrintReqPubSubType())
, samples_received_(0)
, stop_(false)
{

@ -33,6 +33,13 @@ bool MsgHandler::SetDevice(const std::string& device)
return true;
}
bool MsgHandler::SetEmptyWeight(const int& empty_weight)
{
this->empty_weight = empty_weight;
return true;
}
int MsgHandler::SendDeviceMsg(const std::vector<uint8_t>& data)
{
std::cout << "write to " << this->device << std::endl;

@ -10,6 +10,7 @@ class MsgHandler {
public:
int fd;
std::string device;
int empty_weight;
std::vector<uint8_t> m_WeightData;
MsgHandler();
@ -19,6 +20,7 @@ public:
template<typename T>
bool HandleDeviceMsg(T& msg);
bool SetDevice(const std::string& device);
bool SetEmptyWeight(const int& empty_weight);
virtual bool OpenPort(const std::string& port, const std::string& baudrate);
virtual int SendDeviceMsg(const std::vector<uint8_t>& data);

@ -48,7 +48,7 @@ PublisherApp::PublisherApp(
, publisher_(nullptr)
, topic_(nullptr)
, writer_(nullptr)
, type_(new WeighRspPubSubType())
, type_(new WeighingSystem::ScaleInfoPubSubType())
, matched_(0)
, samples_sent_(0)
, stop_(false)
@ -64,7 +64,7 @@ PublisherApp::PublisherApp(
participant_ = factory_->create_participant(domain_id, pqos, nullptr, StatusMask::none());
if (participant_ == nullptr)
{
throw std::runtime_error("WeighRsp Participant initialization failed");
throw std::runtime_error("WeighingSystem::ScaleInfo Participant initialization failed");
}
// Register the type
@ -76,28 +76,34 @@ PublisherApp::PublisherApp(
publisher_ = participant_->create_publisher(pub_qos, nullptr, StatusMask::none());
if (publisher_ == nullptr)
{
throw std::runtime_error("WeighRsp Publisher initialization failed");
throw std::runtime_error("WeighingSystem::ScaleInfo Publisher initialization failed");
}
// Create the topic
TopicQos topic_qos = TOPIC_QOS_DEFAULT;
participant_->get_default_topic_qos(topic_qos);
topic_ = participant_->create_topic("WeighRspTopic", type_.get_type_name(), topic_qos);
topic_ = participant_->create_topic("ScaleInfo", type_.get_type_name(), topic_qos);
if (topic_ == nullptr)
{
throw std::runtime_error("WeighRsp Topic initialization failed");
throw std::runtime_error("WeighingSystem::ScaleInfo Topic initialization failed");
}
// Create the data writer
DataWriterQos writer_qos = DATAWRITER_QOS_DEFAULT;
publisher_->get_default_datawriter_qos(writer_qos);
writer_qos.reliability().kind = ReliabilityQosPolicyKind::RELIABLE_RELIABILITY_QOS;
writer_qos.reliability().max_blocking_time = Duration_t(1, 0);
writer_qos.durability().kind = DurabilityQosPolicyKind::TRANSIENT_LOCAL_DURABILITY_QOS;
writer_qos.history().kind = HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS;
writer_qos.history().depth = 1;
writer_qos.resource_limits().max_samples = 200;
writer_qos.resource_limits().max_instances = 1;
writer_qos.resource_limits().max_samples_per_instance = 100;
writer_qos.data_sharing().off();
writer_ = publisher_->create_datawriter(topic_, writer_qos, this, StatusMask::all());
if (writer_ == nullptr)
{
throw std::runtime_error("WeighRsp DataWriter initialization failed");
throw std::runtime_error("WeighingSystem::ScaleInfo DataWriter initialization failed");
}
}
@ -143,13 +149,11 @@ void PublisherApp::on_publication_matched(
void PublisherApp::run(std::shared_ptr<MsgHandler> handler)
{
uint8_t send_stable = 0;
// 配置检测器 - 使用更合理的参数
WeightStabilityDetector::Config config;
config.jitter_threshold = 30.0f; // 30kg抖动阈值
config.min_weight_threshold = 5000.0f; // 5吨开始检测
config.empty_car_threshold = 300.0f; // 300kg为空车
config.min_weight_threshold = handler->empty_weight; // 300kg开始检测
config.empty_car_threshold = handler->empty_weight; // 默认300kg为空车
config.fast_drop_threshold = 1000.0f; // 快速下降1吨认为车辆离开
config.required_stable_count = 6; // 6次稳定即可
config.min_jitter_count = 2; // 至少2次非增长
@ -190,9 +194,9 @@ void PublisherApp::run(std::shared_ptr<MsgHandler> handler)
std::unique_lock<std::mutex> lock(MsgData::queue_cv_mtx_, std::try_to_lock);
if (lock.owns_lock())
{
if(!MsgData::WeighReq_queue_.empty())
if(!MsgData::ScaleCommand_queue_.empty())
{
MsgData::WeighReq_queue_.pop();
MsgData::ScaleCommand_queue_.pop();
lock.unlock();
}
else
@ -206,9 +210,6 @@ void PublisherApp::run(std::shared_ptr<MsgHandler> handler)
float weight;
if (handler->HandleDeviceMsg(weight) == true)
{
WeighRsp rsp;
rsp.instantaneous_weight() = weight;
bool success = detector.processWeight(weight);
if (!success)
{
@ -236,22 +237,31 @@ void PublisherApp::run(std::shared_ptr<MsgHandler> handler)
}
// 如果稳定,显示稳定重量
WeighingSystem::ScaleInfo info;
info.State() = 1;
if (weight < handler->empty_weight)
{
info.HasVehicle() = 0;
}
else
{
info.HasVehicle() = 1;
}
if (detector.isStable())
{
if(send_stable == 0)
{
rsp.stable_weight() = rsp.instantaneous_weight();
send_stable = 1;
}
info.WeightOK() = 1;
info.Value() = weight;
info.StableValue() = weight;
std::cout << "STABLE WEIGHT: " << detector.getStableWeight() << " kg" << std::endl;
}
else
{
rsp.stable_weight() = 0;
send_stable = 0;
info.WeightOK() = 0;
info.Value() = weight;
info.StableValue() = 0;
}
writer_->write(&rsp);
writer_->write(&info);
}
}
@ -279,7 +289,7 @@ bool PublisherApp::publish()
if (!is_stopped())
{
/* Initialize your structure here */
WeighRsp sample_;
WeighingSystem::ScaleInfo sample_;
ret = (RETCODE_OK == writer_->write(&sample_));
}
return ret;

@ -45,7 +45,7 @@ SubscriberApp::SubscriberApp(
, subscriber_(nullptr)
, topic_(nullptr)
, reader_(nullptr)
, type_(new WeighReqPubSubType())
, type_(new WeighingSystem::ScaleCommandPubSubType())
, samples_received_(0)
, stop_(false)
{
@ -58,7 +58,7 @@ SubscriberApp::SubscriberApp(
participant_ = factory_->create_participant(domain_id, pqos, nullptr, StatusMask::none());
if (participant_ == nullptr)
{
throw std::runtime_error("WeighReq Participant initialization failed");
throw std::runtime_error("WeighingSystem::ScaleCommand Participant initialization failed");
}
// Register the type
@ -70,28 +70,34 @@ SubscriberApp::SubscriberApp(
subscriber_ = participant_->create_subscriber(sub_qos, nullptr, StatusMask::none());
if (subscriber_ == nullptr)
{
throw std::runtime_error("WeighReq Subscriber initialization failed");
throw std::runtime_error("WeighingSystem::ScaleCommand Subscriber initialization failed");
}
// Create the topic
TopicQos topic_qos = TOPIC_QOS_DEFAULT;
participant_->get_default_topic_qos(topic_qos);
topic_ = participant_->create_topic("WeighReqTopic", type_.get_type_name(), topic_qos);
topic_ = participant_->create_topic("ScaleCommand", type_.get_type_name(), topic_qos);
if (topic_ == nullptr)
{
throw std::runtime_error("WeighReq Topic initialization failed");
throw std::runtime_error("WeighingSystem::ScaleCommand Topic initialization failed");
}
// Create the reader
DataReaderQos reader_qos = DATAREADER_QOS_DEFAULT;
subscriber_->get_default_datareader_qos(reader_qos);
reader_qos.reliability().kind = ReliabilityQosPolicyKind::RELIABLE_RELIABILITY_QOS;
reader_qos.durability().kind = DurabilityQosPolicyKind::TRANSIENT_LOCAL_DURABILITY_QOS;
reader_qos.reliability().max_blocking_time = Duration_t(1, 0);
reader_qos.durability().kind = DurabilityQosPolicyKind::VOLATILE_DURABILITY_QOS;
reader_qos.history().kind = HistoryQosPolicyKind::KEEP_LAST_HISTORY_QOS;
reader_qos.history().depth = 1;
reader_qos.resource_limits().max_samples = 200;
reader_qos.resource_limits().max_instances = 1;
reader_qos.resource_limits().max_samples_per_instance = 100;
reader_qos.data_sharing().off();
reader_ = subscriber_->create_datareader(topic_, reader_qos, this, StatusMask::all());
if (reader_ == nullptr)
{
throw std::runtime_error("WeighReq DataReader initialization failed");
throw std::runtime_error("WeighingSystem::ScaleCommand DataReader initialization failed");
}
}
@ -133,16 +139,16 @@ void SubscriberApp::on_data_available(
std::string topic_name = reader->get_topicdescription()->get_name();
std::cout << topic_name << std::endl;
if (topic_name == "WeighReqTopic")
if (topic_name == "ScaleCommand")
{
WeighReq sample_;
WeighingSystem::ScaleCommand sample_;
while ((!is_stopped()) && (RETCODE_OK == reader->take_next_sample(&sample_, &info)))
{
if ((info.instance_state == ALIVE_INSTANCE_STATE) && info.valid_data)
{
{
std::unique_lock<std::mutex> lock(MsgData::queue_cv_mtx_);
MsgData::WeighReq_queue_.push(std::move(sample_));
MsgData::ScaleCommand_queue_.push(std::move(sample_));
lock.unlock();
}
}

@ -64,7 +64,7 @@ std::string parse_signal(
}
}
std::queue<WeighReq> MsgData::WeighReq_queue_;
std::queue<WeighingSystem::ScaleCommand> MsgData::ScaleCommand_queue_;
std::mutex MsgData::queue_cv_mtx_;
int main(int argc, char** argv)
@ -78,7 +78,8 @@ int main(int argc, char** argv)
const char* interface = "serial";
const char* port = "ttyS1";
const char* baudrate = "9600";
const char* device = "Toledo";
const char* device = "Keli";
int empty_weight = 300;
for (int i = 1; i < argc; i++)
{
@ -102,6 +103,10 @@ int main(int argc, char** argv)
{
device = argv[++i];
}
else if (strcmp(argv[i], "--empty") == 0 && i + 1 < argc)
{
empty_weight = atoi(argv[++i]);
}
else if (strcmp(argv[i], "--version") == 0)
{
std::cout << "Vesrion: " << VERSION << "\n";
@ -116,6 +121,7 @@ int main(int argc, char** argv)
<< " --baudrate Set baudrate (e.g., 9600)\n"
<< " --port Set port name (e.g., ttyS1)\n"
<< " --device Set device name (e.g., Toledo)\n"
<< " --empty Set empty weight (e.g., 300)\n"
<< " --version Show software Version\n"
<< " --help Show this help message\n";
return EXIT_SUCCESS;
@ -142,6 +148,7 @@ int main(int argc, char** argv)
dev->OpenPort(port, baudrate);
dev->SetDevice(device);
dev->SetEmptyWeight(empty_weight);
std::thread pub_thread(&PublisherApp::run, pub, dev);

@ -7,7 +7,7 @@
class MsgData {
public:
static std::queue<WeighReq> WeighReq_queue_;
static std::queue<WeighingSystem::ScaleCommand> ScaleCommand_queue_;
static std::mutex queue_cv_mtx_;
};

Loading…
Cancel
Save