本文整理汇总了C++中DmxBuffer::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ DmxBuffer::ToString方法的具体用法?C++ DmxBuffer::ToString怎么用?C++ DmxBuffer::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DmxBuffer
的用法示例。
在下文中一共展示了DmxBuffer::ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testToString
/*
* Test ToString()
*/
void DmxBufferTest::testToString() {
DmxBuffer buffer;
OLA_ASSERT_EQ(string(""), buffer.ToString());
buffer.SetFromString("1,2,3,4");
OLA_ASSERT_EQ(string("1,2,3,4"), buffer.ToString());
buffer.SetRangeToValue(0, 255, 5);
OLA_ASSERT_EQ(string("255,255,255,255,255"), buffer.ToString());
}
示例2: SendNextFrame
void ShowPlayer::SendNextFrame() {
DmxBuffer buffer;
unsigned int universe;
ShowLoader::State state = m_loader.NextFrame(&universe, &buffer);
switch (state) {
case ShowLoader::END_OF_FILE:
HandleEndOfFile();
return;
case ShowLoader::INVALID_LINE:
m_client.GetSelectServer()->Terminate();
return;
default:
{}
}
state = RegisterNextTimeout();
OLA_INFO << "Universe: " << universe << ": " << buffer.ToString();
m_client.GetClient()->SendDmx(universe, buffer);
switch (state) {
case ShowLoader::END_OF_FILE:
HandleEndOfFile();
return;
case ShowLoader::INVALID_LINE:
m_client.GetSelectServer()->Terminate();
return;
default:
{}
}
}
示例3: HandleGetDmx
/*
* Callback for m_client.FetchDmx called by GetDmx
* @param response the HTTPResponse
* @param buffer the DmxBuffer
* @param error Error message
*/
void OladHTTPServer::HandleGetDmx(HTTPResponse *response,
const DmxBuffer &buffer,
const string &error) {
// rather than adding 512 JsonValue we cheat and use raw here
stringstream str;
str << "[" << buffer.ToString() << "]";
JsonObject json;
json.AddRaw("dmx", str.str());
json.Add("error", error);
response->SetNoCache();
response->SetContentType(HTTPServer::CONTENT_TYPE_PLAIN);
response->SendJson(json);
delete response;
}
示例4: HandleGetDmx
/*
* Callback for m_client.FetchDmx called by GetDmx
* @param response the HttpResponse
* @param buffer the DmxBuffer
* @param error Error message
*/
void OlaHttpServer::HandleGetDmx(HttpResponse *response,
const DmxBuffer &buffer,
const string &error) {
stringstream str;
str << "{" << endl;
str << " \"dmx\": [" << buffer.ToString() << "]," << endl;
str << " \"error\": \"" << error << "\"" << endl;
str << "}";
response->SetHeader("Cache-Control", "no-cache, must-revalidate");
response->SetContentType(HttpServer::CONTENT_TYPE_PLAIN);
response->Append(str.str());
response->Send();
delete response;
}
示例5: HandleGetIntensity
void OladHTTPServer::HandleGetIntensity(HTTPResponse *response,
const client::Result &result,
const client::DMXMetadata &,
const DmxBuffer &buffer) {
// rather than adding 512 JsonValue we cheat and use raw here
ostringstream str;
str << "[" << buffer.ToString() << "]";
JsonObject json;
json.AddRaw("intensity", "50");
json.Add("error", result.Error());
response->SetNoCache();
response->SetContentType(HTTPServer::CONTENT_TYPE_PLAIN);
response->SendJson(json);
delete response;
}