title: Parsing buffer data in C++
body: <p>My C++ project has a buffer which could be any size and is filled by Bluetooth. The format of the incoming messages is like 0x43  0x0B  0x00  0x06  0xA2  0x03  0x03  0x00  0x01  0x01  0x0A  0x0B  0x0B  0xE6 0x0D in which starts with 0x43 and ends with 0x0D. So, it means that each time when buffer is filled, it can have different order of contents according to the above message format.</p>
  
  <pre><code>static const int BufferSize = 1024;
  byte buffer[BufferSize];
  </code></pre>
  
  <ol>
  <li>What is the best way to parse the incoming messages in this buffer?</li>
  <li>Since I have come from Java and .NET, What is the best way to make each extracted message as an object? Class could be solution?</li>
  <li>I have created a separate class for parsing the buffer like bellow, am I in a right direction?</li>
  </ol>
  
  <hr>
  
  <pre><code>#include&lt;parsingClass.h&gt;
  class A
  {
     parsingClass ps;
  public:
     parsingClass.parse(buffer, BufferSize);
  }
  </code></pre>