예제 #1
0
/*
 * Handle a E1.33 Status PDU.
 */
bool E133StatusInflator::HandlePDUData(uint32_t vector,
                                       const HeaderSet &headers,
                                       const uint8_t *data,
                                       unsigned int pdu_len) {
  unsigned int size = std::min(
      pdu_len,
      static_cast<unsigned int>(ola::e133::MAX_E133_STATUS_STRING_SIZE));
  string description(reinterpret_cast<const char*>(&data[0]), size);

  m_handler->Run(&headers.GetTransportHeader(),
                 &headers.GetE133Header(),
                 static_cast<uint16_t>(vector),
                 description);
  return true;
}
예제 #2
0
/*
 * Check that the header set works
 */
void HeaderSetTest::testHeaderSet() {
  HeaderSet headers;
  RootHeader root_header;
  E131Header e131_header("e131", 1, 2, 6001);
  E133Header e133_header("foo", 1, 2050);
  DMPHeader dmp_header(false, false, NON_RANGE, ONE_BYTES);

  // test the root header component
  CID cid = CID::Generate();
  root_header.SetCid(cid);
  headers.SetRootHeader(root_header);
  OLA_ASSERT(root_header == headers.GetRootHeader());

  // test the E1.31 header component
  headers.SetE131Header(e131_header);
  OLA_ASSERT(e131_header == headers.GetE131Header());

  // test the E1.33 header component
  headers.SetE133Header(e133_header);
  OLA_ASSERT(e133_header == headers.GetE133Header());

  // test the DMP headers component
  headers.SetDMPHeader(dmp_header);
  OLA_ASSERT(dmp_header == headers.GetDMPHeader());

  // test assign
  HeaderSet headers2 = headers;
  OLA_ASSERT(root_header == headers2.GetRootHeader());
  OLA_ASSERT(e131_header == headers2.GetE131Header());
  OLA_ASSERT(e133_header == headers2.GetE133Header());
  OLA_ASSERT(dmp_header == headers2.GetDMPHeader());
  OLA_ASSERT(headers2 == headers);

  // test copy
  HeaderSet headers3(headers);
  OLA_ASSERT(root_header == headers3.GetRootHeader());
  OLA_ASSERT(e131_header == headers3.GetE131Header());
  OLA_ASSERT(e133_header == headers3.GetE133Header());
  OLA_ASSERT(dmp_header == headers3.GetDMPHeader());
  OLA_ASSERT(headers3 == headers);
}
예제 #3
0
/*
 * Handle a DMP PDU for E1.33.
 */
bool RDMInflator::HandlePDUData(uint32_t vector,
                                const HeaderSet &headers,
                                const uint8_t *data,
                                unsigned int pdu_len) {
  if (vector != VECTOR_RDMNET_DATA) {
    OLA_INFO << "Not a RDM message, vector was " << vector;
    return true;
  }

  string rdm_message(reinterpret_cast<const char*>(&data[0]), pdu_len);

  E133Header e133_header = headers.GetE133Header();

  if (m_rdm_handler.get()) {
    m_rdm_handler->Run(&headers.GetTransportHeader(), &e133_header,
                       rdm_message);
  } else {
    OLA_WARN << "No RDM handler defined!";
  }
  return true;
}