Commit 2d46a772 by DavidHeitbrink

Changes from VidCap

parent 31b3817b
...@@ -123,25 +123,32 @@ namespace NDDSClient { ...@@ -123,25 +123,32 @@ namespace NDDSClient {
return; return;
} }
_map.ReadInputElements(); _map.ReadInputElements();
if (_HeartBeat) {
_HeartBeat->asShort()[0]++; bool stateOK = true;
_HeartBeat->Publish(); bool stateNotReady = false;
} for (auto& cb : _FrameCBs) {
for (auto& cb : _FrameCBs) {
bool stateOK = true;
if (auto frameCB = cb.lock()) { if (auto frameCB = cb.lock()) {
if (!frameCB->Frame(*this, state, frame)) int res = frameCB->Frame(*this, state, frame);
if (res < 0 )
stateOK = false; stateOK = false;
if (res == 0) {
stateNotReady = true;
}
} }
if (!stateOK)
_StateAck->asInt()[0] = -1;
else
_StateAck->asInt()[0] = state;
_StateAck->Publish();
} }
if (!stateOK)
_StateAck->asShort()[0] = -1;
else
_StateAck->asShort()[0] = state;
if (_HeartBeat && !stateNotReady) {
_HeartBeat->asInt()[0] = frame;
_HeartBeat->Publish();
}
_StateAck->Publish();
_omap.WriteOutputElements(); _omap.WriteOutputElements();
} }
...@@ -159,8 +166,8 @@ namespace NDDSClient { ...@@ -159,8 +166,8 @@ namespace NDDSClient {
string stateAck = "_StateAck_" + _name; string stateAck = "_StateAck_" + _name;
string heartBeat = "_HeartBeat_" + _name; string heartBeat = "_HeartBeat_" + _name;
_HeartBeat = NADSDDS::CPublication::MakePublication(stateAck, -1, 1, 's'); _HeartBeat = NADSDDS::CPublication::MakePublication(heartBeat, -1, 1, 'i');
_StateAck = NADSDDS::CPublication::MakePublication(heartBeat, -1, 1, 'i'); _StateAck = NADSDDS::CPublication::MakePublication(stateAck, -1, 1, 's');
for (auto& cb : _StartupCBs) { for (auto& cb : _StartupCBs) {
if (auto startCB = cb.lock()) { if (auto startCB = cb.lock()) {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<ProjectGuid>{FCE83303-FBAE-4E08-B252-A7A7EFFF60F6}</ProjectGuid> <ProjectGuid>{FCE83303-FBAE-4E08-B252-A7A7EFFF60F6}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>NadsDDSLib</RootNamespace> <RootNamespace>NadsDDSLib</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)lib</OutDir> <OutDir>$(SolutionDir)lib</OutDir>
<TargetName>$(ProjectName)_64s</TargetName>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
...@@ -140,7 +141,7 @@ ...@@ -140,7 +141,7 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
...@@ -149,6 +150,7 @@ ...@@ -149,6 +150,7 @@
<PreprocessorDefinitions>RTI_WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>RTI_WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.\;.\src;.\include;$(NDDSHOME)\include;$(NDDSHOME)\include\ndds;$(NDDSHOME)\include\ndds\hpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>.\;.\src;.\include;$(NDDSHOME)\include;$(NDDSHOME)\include\ndds;$(NDDSHOME)\include\ndds\hpp;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
......
...@@ -91,6 +91,8 @@ namespace NDDSClient { ...@@ -91,6 +91,8 @@ namespace NDDSClient {
template<class T> class StartUpC : public StartUpCB { template<class T> class StartUpC : public StartUpCB {
public: public:
typedef std::shared_ptr<StartUpC<T>> TRef;
static TRef Make(T* ptr) { return std::make_shared<StartUpC<T>>(ptr); }
StartUpC(T* par) :_par(par) {} StartUpC(T* par) :_par(par) {}
virtual void Startup(DDSSimClient& core) override{ virtual void Startup(DDSSimClient& core) override{
_par->Startup(core); _par->Startup(core);
...@@ -125,13 +127,15 @@ namespace NDDSClient { ...@@ -125,13 +127,15 @@ namespace NDDSClient {
template<class T> class NewFrame : public FrameCB { template<class T> class NewFrame : public FrameCB {
public: public:
typedef std::shared_ptr<NewFrame<T>> TRef;
static TRef Make(T* ptr) { return std::make_shared<NewFrame<T>>(ptr); }
NewFrame(T* par) :_par(par) {} NewFrame(T* par) :_par(par) {}
virtual int Frame(DDSSimClient& core, int state, int frameNum) override { virtual int Frame(DDSSimClient& core, int state, int frameNum) override {
return _par->Frame(core,state,frameNum); return _par->Frame(core,state,frameNum);
} }
T* _par; T* _par;
}; };
void RegisterFrameCB(TFrameCBRef); void RegisterFrameCB(TFrameCBRef);
virtual void OnFrame(int frame); virtual void OnFrame(int frame);
......
...@@ -19,28 +19,50 @@ ...@@ -19,28 +19,50 @@
#ifndef NO_AUTOLINK_NADS_DDS_LIB #ifndef NO_AUTOLINK_NADS_DDS_LIB
#ifdef _MSC_VER #ifdef _MSC_VER
#ifdef _DEBUG #ifdef _DEBUG
#ifdef _X86_ #ifdef _X86_
#ifndef NADSDDDS_DLL #ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_32ds.lib") #pragma comment(lib,"NadsDDSLib_32ds.lib")
#pragma comment(lib,"nddscpp2zd.lib") #pragma comment(lib,"nddscpp2zd.lib")
#pragma comment(lib,"nddsczd.lib") #pragma comment(lib,"nddsczd.lib")
#pragma comment(lib,"nddscorezd.lib") #pragma comment(lib,"nddscorezd.lib")
#pragma comment(lib,"netapi32.lib") #pragma comment(lib,"netapi32.lib")
#pragma comment(lib,"advapi32.lib") #pragma comment(lib,"advapi32.lib")
#pragma comment(lib,"user32.lib") #pragma comment(lib,"user32.lib")
#endif #endif
#else
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_64ds.lib")
#pragma comment(lib,"nddscpp2zd.lib")
#pragma comment(lib,"nddsczd.lib")
#pragma comment(lib,"nddscorezd.lib")
#pragma comment(lib,"netapi32.lib")
#pragma comment(lib,"advapi32.lib")
#pragma comment(lib,"user32.lib")
#endif
#endif // DEBUG
#else #else
#ifndef NADSDDDS_DLL #ifdef _X86_
#pragma comment(lib,"NadsDDSLib_64ds.lib") #ifndef NADSDDDS_DLL
#pragma comment(lib,"nddscpp2zd.lib") #pragma comment(lib,"NadsDDSLib_32s.lib")
#pragma comment(lib,"nddsczd.lib") #pragma comment(lib,"nddscpp2z.lib")
#pragma comment(lib,"nddscorezd.lib") #pragma comment(lib,"nddscz.lib")
#pragma comment(lib,"netapi32.lib") #pragma comment(lib,"nddscorez.lib")
#pragma comment(lib,"advapi32.lib") #pragma comment(lib,"netapi32.lib")
#pragma comment(lib,"user32.lib") #pragma comment(lib,"advapi32.lib")
#endif #pragma comment(lib,"user32.lib")
#endif // DEBUG #endif
#endif #else
#ifndef NADSDDDS_DLL
#pragma comment(lib,"NadsDDSLib_64s.lib")
#pragma comment(lib,"nddscpp2z.lib")
#pragma comment(lib,"nddscz.lib")
#pragma comment(lib,"nddscorez.lib")
#pragma comment(lib,"netapi32.lib")
#pragma comment(lib,"advapi32.lib")
#pragma comment(lib,"user32.lib")
#endif
#endif // DEBUG
#endif
#endif #endif
#endif #endif
namespace NADSDDS { namespace NADSDDS {
......
...@@ -36,18 +36,20 @@ namespace NADSDDS { ...@@ -36,18 +36,20 @@ namespace NADSDDS {
DDSTopicInfo::Get()->RefreshImpl(); DDSTopicInfo::Get()->RefreshImpl();
} }
void DDSTopicInfo::RefreshImpl() { void DDSTopicInfo::RefreshImpl() {
dds::domain::qos::DomainParticipantQos participant_qos = dds::core::QosProvider::Default().participant_qos(); //dds::domain::qos::DomainParticipantQos participant_qos = dds::core::QosProvider::Default().participant_qos();
dds::domain::qos::DomainParticipantFactoryQos qos; //dds::domain::qos::DomainParticipantFactoryQos qos;
qos << dds::core::policy::EntityFactory::ManuallyEnable(); //qos << dds::core::policy::EntityFactory::ManuallyEnable();
dds::domain::DomainParticipant::participant_factory_qos(qos); //dds::domain::DomainParticipant::participant_factory_qos(qos);
//DomainParticipant participant(0, participant_qos); //DomainParticipant participant(0, participant_qos);
//DDSDomainRepo::GetDomain(0) //DDSDomainRepo::GetDomain(0)
GenericSubscriber subscriber(DDSDomainRepo::GetDomain(0), false); GenericSubscriber subscriber(DDSDomainRepo::GetDomain(0), false);
Sleep(100);
//GenericSubscriber subscriber(participant, false); //GenericSubscriber subscriber(participant, false);
GenericSubscriber::TTopics topics; GenericSubscriber::TTopics topics;
subscriber.list_topics(topics); subscriber.list_topics(topics);
_info.clear(); _info.clear();
for (auto& itr : topics) { for (auto& itr : topics) {
if (itr.second == "TypeInt") { if (itr.second == "TypeInt") {
...@@ -66,6 +68,7 @@ namespace NADSDDS { ...@@ -66,6 +68,7 @@ namespace NADSDDS {
_info.push_back(std::make_tuple(itr.first, 'd')); _info.push_back(std::make_tuple(itr.first, 'd'));
} }
} }
} }
const DDSTopicInfo::TTypeVect& DDSTopicInfo::GetTopics() { const DDSTopicInfo::TTypeVect& DDSTopicInfo::GetTopics() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment