当前位置: 首页>>代码示例>>C++>>正文


C++ DmxBuffer::ToString方法代码示例

本文整理汇总了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());
}
开发者ID:mlba-team,项目名称:open-lighting,代码行数:13,代码来源:DmxBufferTest.cpp

示例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:
      {}
  }
}
开发者ID:Tuckie,项目名称:ola,代码行数:31,代码来源:ShowPlayer.cpp

示例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;
}
开发者ID:mlba-team,项目名称:open-lighting,代码行数:21,代码来源:OladHTTPServer.cpp

示例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;
}
开发者ID:huyanming,项目名称:open-lighting,代码行数:21,代码来源:OlaHttpServer.cpp

示例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;
}
开发者ID:steczol,项目名称:ola,代码行数:16,代码来源:OladHTTPServer.cpp


注:本文中的DmxBuffer::ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。