devices have long and short names
This commit is contained in:
parent
d8a768848e
commit
98ca641adc
|
@ -35,6 +35,8 @@ namespace ARTNET {
|
|||
*/
|
||||
Device::Device()
|
||||
: diagnostic_reporting_threshold(DpCritial)
|
||||
, _shortName("OpenLCP Device")
|
||||
, _longName("Generic OpenLCP Art-Net Device")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -403,4 +405,44 @@ void Device::txArtDiagData()
|
|||
/// \todo impliment txArtDiagData
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::shortName
|
||||
* @return
|
||||
*/
|
||||
std::string Device::shortName() const
|
||||
{
|
||||
return _shortName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::setShortName
|
||||
* @param newShortName
|
||||
*/
|
||||
void Device::setShortName(const std::string &newShortName)
|
||||
{
|
||||
_shortName = newShortName.substr(0, Short_Name_Length-1); // leave room for null terminator
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::longName
|
||||
* @return
|
||||
*/
|
||||
std::string Device::longName() const
|
||||
{
|
||||
return _longName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Device::setLongName
|
||||
* @param newLongName
|
||||
*/
|
||||
void Device::setLongName(const std::string &newLongName)
|
||||
{
|
||||
_longName = newLongName.substr(0, Long_Name_Length-1); // leave room for null terminator
|
||||
}
|
||||
|
||||
} // namespace ARTNET
|
||||
|
|
|
@ -46,6 +46,12 @@ public:
|
|||
std::shared_ptr<void> setSender(const std::function<void(std::shared_ptr<bufferstream>,
|
||||
ipAddress)>);
|
||||
|
||||
std::string shortName() const;
|
||||
void setShortName(const std::string &newShortName);
|
||||
|
||||
std::string longName() const;
|
||||
void setLongName(const std::string &newLongName);
|
||||
|
||||
protected:
|
||||
TalkToMe diagnostic_reporting_behavior; //!< behavior flags
|
||||
Priority diagnostic_reporting_threshold; //!< lowest priority dignostic message to send
|
||||
|
@ -95,6 +101,9 @@ protected:
|
|||
|
||||
private:
|
||||
std::weak_ptr<const std::function<void(std::shared_ptr<bufferstream>, ipAddress)>> _sender;
|
||||
|
||||
std::string _shortName;
|
||||
std::string _longName;
|
||||
};
|
||||
|
||||
} // namespace ARTNET
|
||||
|
|
|
@ -30,4 +30,27 @@ Node::Node()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Node::rxArtAddress
|
||||
* @param packet
|
||||
*/
|
||||
void Node::rxArtAddress(std::shared_ptr<ArtAddress> packet)
|
||||
{
|
||||
auto data_opt = packet->data<address_data>();
|
||||
if (!data_opt.has_value())
|
||||
return;
|
||||
auto data = data_opt.value();
|
||||
|
||||
if (data->short_name.length()) // The Node will ignore this value if the string is null.
|
||||
setShortName(data->short_name);
|
||||
if (data->long_name.length()) // The Node will ignore this value if the string is null.
|
||||
setLongName(data->long_name);
|
||||
|
||||
/// \todo process additional fields in this packet
|
||||
|
||||
/// \cite ARTNET Reply by broadcasting ArtPollReply.
|
||||
txArtPollReply();
|
||||
}
|
||||
|
||||
} // namespace ARTNET
|
||||
|
|
|
@ -38,6 +38,9 @@ class Node
|
|||
public:
|
||||
explicit Node();
|
||||
|
||||
protected:
|
||||
virtual void rxArtAddress(std::shared_ptr<ArtAddress>) override;
|
||||
|
||||
private:
|
||||
std::vector<Port*> _ports;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue