1
0
Fork 0

certain high bits are used to encode enable/disable flags

This commit is contained in:
Kevin Matz 2023-05-22 10:15:53 -04:00
parent db2d793805
commit 47ac0220b4
2 changed files with 12 additions and 15 deletions

View File

@ -247,15 +247,13 @@ void address_data::iStream(std::shared_ptr<bufferstream> stream)
stream->get(); // 4
if (version < VERSION)
return stream->setstate(std::ios_base::failbit);
net_sub_switch.value = stream->get() << 8; // 5
*stream >> net_switch; // 5
*stream >> bind_index; // 6
stream->readString(short_name, Short_Name_Length); // 7
stream->readString(long_name, Long_Name_Length); // 8
for( size_t i = 0; i < sizeof(SwIn); i++)
SwIn[i] = stream->get() & 0x0f; // 9
for( size_t i = 0; i < sizeof(SwOut); i++)
SwOut[i] = stream->get() & 0x0f; // 10
net_sub_switch.value |= stream->get() << 4; // 11
stream->read(SwIn, sizeof(SwIn)); // 9
stream->read(SwOut, sizeof(SwOut)); // 10
*stream >> sub_switch; // 11
*stream >> SwVideo; // 12
command = static_cast<AddressCommand>(stream->get()); // 13
}
@ -265,15 +263,13 @@ void address_data::oStream(std::shared_ptr<bufferstream> stream) const
{ // Field #
stream->put(version >> 8); // 3
stream->put(version & 0xff); // 4
stream->put(net_sub_switch.value >> 8); // 5
*stream << net_switch; // 5
*stream << bind_index; // 6
stream->writeString(short_name, Short_Name_Length, true); // 7
stream->writeString(long_name, Long_Name_Length, true); // 8
for( size_t i = 0; i < sizeof(SwIn); i++)
stream->put(SwIn[i] &0x0f); // 9
for( size_t i = 0; i < sizeof(SwOut); i++)
stream->put(SwOut[i] &0x0f); // 10
stream->put(net_sub_switch.value >> 4 & 0x0f); // 11
stream->write(SwIn, sizeof(SwIn)); // 9
stream->write(SwOut, sizeof(SwOut)); // 10
*stream << sub_switch; // 11
*stream << SwVideo; // 12
*stream << command; // 13
}

View File

@ -196,12 +196,13 @@ private:
struct address_data
: public packet_data
{
PortAddress net_sub_switch; //!< Net and Subnet switch positions
uint8_t net_switch = 0x7f; //!< Net and Subnet switch positions
uint8_t bind_index = 1; //!< the order of bound devices.
std::string short_name = ""; //!< short name for the Node
std::string long_name = ""; //!< long name for the Node
uint8_t SwIn[4]; //!< Bits 3-0 of the 15 bit Port-Address for each input port
uint8_t SwOut[4]; //!< Bits 3-0 of the 15 bit Port-Address for each output port
uint8_t SwIn[4] = {0x7f}; //!< Bits 3-0 of the 15 bit Port-Address for each input port
uint8_t SwOut[4] = {0x7f}; //!< Bits 3-0 of the 15 bit Port-Address for each output port
uint8_t sub_switch = 0x7f; //!< Subnet switch positions
uint8_t SwVideo = 0; //!< This field is now deprecated.
AddressCommand command; //!< Node configuration command.