Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Send an ArtPollReply message
- */
- bool ArtNetNodeImpl::SendPollReply(const IPV4Address &destination) {
- artnet_packet packet;
- PopulatePacketHeader(&packet, ARTNET_REPLY);
- memset(&packet.data.reply, 0, sizeof(packet.data.reply));
- m_interface.ip_address.Get(packet.data.reply.ip);
- packet.data.reply.port = HostToLittleEndian(ARTNET_PORT);
- packet.data.reply.net_address = m_net_address;
- packet.data.reply.subnet_address = m_input_ports[0].universe_address >> 4;
- packet.data.reply.oem = HostToNetwork(OEM_CODE);
- packet.data.reply.status1 = 0xd2; // normal indicators, rdm enabled
- packet.data.reply.esta_id = HostToLittleEndian(OPEN_LIGHTING_ESTA_CODE);
- strncpy(packet.data.reply.short_name,
- m_short_name.data(),
- ARTNET_SHORT_NAME_LENGTH);
- strncpy(packet.data.reply.long_name,
- m_long_name.data(),
- ARTNET_LONG_NAME_LENGTH);
- std::stringstream str;
- str << "#0001 [" << m_unsolicited_replies << "] OLA";
- strncpy(packet.data.reply.node_report,
- str.str().data(),
- ARTNET_REPORT_LENGTH);
- packet.data.reply.number_ports[1] = ARTNET_MAX_PORTS;
- for (unsigned int i = 0; i < ARTNET_MAX_PORTS; i++) {
- packet.data.reply.port_types[i] = 0xc0; // input and output DMX
- packet.data.reply.good_input[i] = m_input_ports[i].enabled ? 0x0 : 0x8;
- packet.data.reply.sw_in[i] = m_input_ports[i].universe_address;
- packet.data.reply.good_output[i] = (
- (m_output_ports[i].enabled ? 0x80 : 0x00) |
- (m_output_ports[i].merge_mode == ARTNET_MERGE_LTP ? 0x2 : 0x0) |
- (m_output_ports[i].is_merging ? 0x8 : 0x0));
- packet.data.reply.sw_out[i] = m_output_ports[i].universe_address;
- }
- packet.data.reply.style = NODE_CODE;
- memcpy(packet.data.reply.mac,
- m_interface.hw_address,
- ola::network::MAC_LENGTH);
- m_interface.ip_address.Get(packet.data.reply.bind_ip);
- // maybe set status2 here if the web UI is enabled
- packet.data.reply.status2 = 0x08; // node supports 15 bit port addresses
- if (!SendPacket(packet, sizeof(packet.data.reply), destination)) {
- OLA_INFO << "Failed to send ArtPollReply";
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement