Skip to content

Commit

Permalink
Allow to specify ArtNet packet data size per controller
Browse files Browse the repository at this point in the history
  • Loading branch information
navFooh committed May 23, 2022
1 parent 7443002 commit a2295c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions modules/napartnet/src/artnetcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ RTTI_BEGIN_CLASS(nap::ArtNetController)
RTTI_PROPERTY("UnicastLimit", &nap::ArtNetController::mUnicastLimit, nap::rtti::EPropertyMetaData::Default)
RTTI_PROPERTY("Verbose", &nap::ArtNetController::mVerbose, nap::rtti::EPropertyMetaData::Default)
RTTI_PROPERTY("Timeout", &nap::ArtNetController::mReadTimeout, nap::rtti::EPropertyMetaData::Default)
RTTI_PROPERTY("DataSize", &nap::ArtNetController::mDataSize, nap::rtti::EPropertyMetaData::Default)
RTTI_END_CLASS

namespace nap
Expand All @@ -49,6 +50,9 @@ namespace nap
if (!errorState.check(mUniverse < 16, "%s: Universe must be between 0 and 16", mID.c_str()))
return false;

if (!errorState.check(mDataSize >= 2 && mDataSize <= 512, "%s: DataSize must be between 2 and 512", mID.c_str()))
return false;

// Create a new artnet (controller) node
assert(mNode == nullptr);
mNode = artnet_new((mIpAddress.empty() ? NULL : mIpAddress.c_str()), (mVerbose ? 1 : 0));
Expand Down
1 change: 1 addition & 0 deletions modules/napartnet/src/artnetcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ namespace nap
bool mVerbose = false; ///< Property: 'Verbose' prints artnet network traffic information to the console
float mReadTimeout = 2.0f; ///< Property: 'Timeout' poll network node read timeout, only used when mode is set to Unicast
std::string mIpAddress = ""; ///< Property: 'IP Address' this controller's IP Address, when left empty the first available ethernet adapter is chosen.
uint16 mDataSize = 512; ///< Property: 'DataSize' the amount of channels sent with each data packet, must be between 2 and 512

private:

Expand Down
2 changes: 1 addition & 1 deletion modules/napartnet/src/artnetservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace nap

std::unique_ptr<ControllerData> controller_data = std::make_unique<ControllerData>();
controller_data->mController = &controller;
controller_data->mData.resize(512);
controller_data->mData.resize(controller.mDataSize);
controller_data->mIsDirty = true;
controller_data->mLastUpdateTime = 0.0f;

Expand Down

0 comments on commit a2295c2

Please sign in to comment.