Example #1
0
/**
 * Record a show
 */
int RecordShow(const options &opts) {
  if (opts.universes.empty()) {
    OLA_FATAL << "No universes specified, use -u";
    exit(ola::EXIT_USAGE);
  }

  vector<string> universe_strs;
  vector<unsigned int> universes;
  ola::StringSplit(opts.universes, universe_strs, ",");
  vector<string>::const_iterator iter = universe_strs.begin();
  for (; iter != universe_strs.end(); ++iter) {
    unsigned int universe;
    if (!ola::StringToInt(*iter, &universe)) {
      OLA_FATAL << *iter << " isn't a valid universe number";
      exit(ola::EXIT_USAGE);
    }
    universes.push_back(universe);
  }

  show_recorder.reset(new ShowRecorder(opts.file, universes));
  int status = show_recorder->Init();
  if (status)
    return status;

  cout << "Recording, hit Control-C to end" << endl;
  InstallSignals();
  show_recorder->Record();
  cout << "Saved " << show_recorder->FrameCount() << " frames" << endl;
  return ola::EXIT_OK;
}
Example #2
0
void OPCServerTest::setUp() {
  IPV4SocketAddress listen_addr(IPV4Address::Loopback(), 0);
  m_server.reset(new OPCServer(&m_ss, listen_addr));
  m_server->SetCallback(
      CHANNEL,
      ola::NewCallback(this, &OPCServerTest::CaptureData));

  OLA_ASSERT_TRUE(m_server->Init());

  m_client_socket.reset(TCPSocket::Connect(m_server->ListenAddress()));
}
Example #3
0
bool SimpleE133Monitor::Init() {
  if (!m_slp_thread.get())
    return true;

  if (!m_slp_thread->Init()) {
    OLA_WARN << "SLPThread Init() failed";
    return false;
  }

  m_slp_thread->Start();
  return true;
}
Example #4
0
void OSCNodeTest::setUp() {
  // Init logging
  ola::InitLogging(ola::OLA_LOG_INFO, ola::OLA_LOG_STDERR);

  // Setup and register the Timeout.
  m_timeout_id = m_ss.RegisterSingleTimeout(
        ABORT_TIMEOUT_IN_MS,
        ola::NewSingleCallback(this, &OSCNodeTest::Timeout));
  OLA_ASSERT_TRUE(m_timeout_id);

  // Init our UDP socket.
  OLA_ASSERT_TRUE(m_udp_socket.Init());
  // Put some data into the DMXBuffer
  m_dmx_data.SetFromString("0,1,2,3,4,5,6,7,8,9,10");

  // Initialize the OSCNode
  OLA_ASSERT_TRUE(m_osc_node->Init());
}
/**
 * Start up the controller
 */
bool SimpleE133Controller::Init() {
  if (!m_udp_socket.Init())
    return false;

  if (!m_udp_socket.Bind(IPV4SocketAddress(m_controller_ip, 0))) {
    OLA_INFO << "Failed to bind to UDP port";
    return false;
  }

  m_ss.AddReadDescriptor(&m_udp_socket);

  if (m_slp_thread.get()) {
    if (!m_slp_thread->Init()) {
      OLA_WARN << "SLPThread Init() failed";
      return false;
    }

    m_slp_thread->Start();
  }
  return true;
}