Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_advdata_parser.c Source File

ble_advdata_parser.c

00001 #include "ble_advdata_parser.h"
00002 
00003 uint32_t ble_advdata_parser_field_find(uint8_t    type,
00004                                        uint8_t  * p_advdata,
00005                                        uint8_t  * len,
00006                                        uint8_t ** pp_field_data)
00007 {
00008     uint32_t index = 0;
00009 
00010     while (index < *len)
00011     {
00012         uint8_t field_length = p_advdata[index];
00013         uint8_t field_type   = p_advdata[index + 1];
00014 
00015         if (field_type == type)
00016         {
00017             *pp_field_data = &p_advdata[index + 2];
00018             *len           = field_length - 1;
00019             return NRF_SUCCESS;
00020         }
00021         index += field_length + 1;
00022     }
00023     return NRF_ERROR_NOT_FOUND;
00024 }