title: Parse BLE Manufacturer data - Objective-C
body: <p>I'm working on a custom bluetooth product, the manufacturer has embeded data in the advertisement packet. How do I effectively parse this data so it's usable within an iOS app?</p>
  
  <p>I'm currently grabbing the data from the NSDictionary as follows:</p>
  
  <pre><code>NSData *rawData = [advertisement objectForKey:@"kCBAdvDataManufacturerData"];
  </code></pre>
  
  <p>The data in the packet is structured like so:</p>
  
  <pre><code>    uint8_t compId[2];
      uint8_t empty[6];
      uint8_t temperature[2];
      uint8_t rampRate[2];
      uint8_t dutyFactor[2];
      uint8_t alarms[2];
      uint8_t statusFlag;
      uint8_t speedRpm[2];
      uint8_t vib[2];
      uint8_t deviceTypeId;
      uint8_t radioStatus;
      uint8_t cycleTimer[2];
      uint8_t batteryLevel;
  </code></pre>
  
  <p>My first thought was to convert it to a string and parse out the data that I need, but this seems slow and really inefficient. There has to be a standard way developers deal with this. I'm still pretty green when it comes to bitwise operators. All the data is formatted in little endian.</p>