Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | List of all members
ola::client::StreamingClient Class Reference

Detailed Description

Send DMX512 data to olad.

StreamingClient sends DMX512 data to OLAD without waiting for an acknowledgement. It's best suited to simple clients which only ever send DMX512 data.

#include <stdlib.h>
#include <unistd.h>
#include <ola/DmxBuffer.h>
#include <ola/Logging.h>
#include <iostream>
using std::cout;
using std::endl;
int main(int, char *[]) {
unsigned int universe = 1; // universe to use for sending data
// turn on OLA logging
ola::DmxBuffer buffer; // A DmxBuffer to hold the data.
buffer.Blackout(); // Set all channels to 0
// Create a new client.
// Setup the client, this connects to the server
if (!ola_client.Setup()) {
std::cerr << "Setup failed" << endl;
exit(1);
}
// Send 100 frames to the server. Increment slot (channel) 0 each time a
// frame is sent.
for (unsigned int i = 0; i < 100; i++) {
buffer.SetChannel(0, i);
if (!ola_client.SendDmx(universe, buffer)) {
cout << "Send DMX failed" << endl;
exit(1);
}
usleep(20000); // sleep for 25ms between frames.
}
return 0;
}
Inheritance diagram for ola::client::StreamingClient:
ola::client::StreamingClientInterface

Classes

class  Options

Public Member Functions

 StreamingClient (bool auto_start=true)
 StreamingClient (const Options &options)
 ~StreamingClient ()
bool Setup ()
void Stop ()
bool SendDmx (unsigned int universe, const DmxBuffer &data)
bool SendDMX (unsigned int universe, const DmxBuffer &data, const SendArgs &args)
 Send DMX data.
void ChannelClosed ()

Constructor & Destructor Documentation

ola::client::StreamingClient::StreamingClient ( bool  auto_start = true)
explicit

Create a new StreamingClient.

Parameters
auto_startif set to true, this will automatically start olad if it's not already running.
Deprecated:
Use the constructor that takes an Options struct instead.
ola::client::StreamingClient::StreamingClient ( const Options options)
explicit

Create a new StreamingClient.

Parameters
optionsan Options structure.
ola::client::StreamingClient::~StreamingClient ( )

Destructor. This closes the connection to the olad server if it's still open.

Member Function Documentation

bool ola::client::StreamingClient::SendDmx ( unsigned int  universe,
const DmxBuffer data 
)
virtual

Send a DmxBuffer to the olad server.

Parameters
universethe universe to send on.
datathe DMX512 data.
Returns
true if sent sucessfully, false if the connection to the server has been closed.

Implements ola::client::StreamingClientInterface.

bool ola::client::StreamingClient::SendDMX ( unsigned int  universe,
const DmxBuffer data,
const SendArgs args 
)
virtual

Send DMX data.

Parameters
universethe universe to send to.
datathe DmxBuffer with the data
argsthe SendDMXArgs to use for this call.

Implements ola::client::StreamingClientInterface.

bool ola::client::StreamingClient::Setup ( )
virtual

Initialize the client and connect to olad.

Returns
true if the initialization completed sucessfully, false if there was a failure.

Implements ola::client::StreamingClientInterface.

void ola::client::StreamingClient::Stop ( )
virtual

Close the connection to the olad server. This does not need to be called since ~StreamingClient() will close the connection if it's still open when the object is destroyed.

Implements ola::client::StreamingClientInterface.


The documentation for this class was generated from the following files: