mediCAL's first BLE project

Dependents:   BLE_mediCAL

Fork of nRF51822 by Nordic Semiconductor

Committer:
bogdanm
Date:
Wed Mar 26 14:38:17 2014 +0000
Revision:
0:eff01767de02
Initial import of the nRF51822 code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:eff01767de02 1 #include "ble_advdata_parser.h"
bogdanm 0:eff01767de02 2
bogdanm 0:eff01767de02 3 uint32_t ble_advdata_parser_field_find(uint8_t type, uint8_t * p_advdata, uint8_t * len, uint8_t ** pp_field_data)
bogdanm 0:eff01767de02 4 {
bogdanm 0:eff01767de02 5 uint32_t index = 0;
bogdanm 0:eff01767de02 6
bogdanm 0:eff01767de02 7 while (index < *len)
bogdanm 0:eff01767de02 8 {
bogdanm 0:eff01767de02 9 uint8_t field_length = p_advdata[index];
bogdanm 0:eff01767de02 10 uint8_t field_type = p_advdata[index+1];
bogdanm 0:eff01767de02 11
bogdanm 0:eff01767de02 12 if (field_type == type)
bogdanm 0:eff01767de02 13 {
bogdanm 0:eff01767de02 14 *pp_field_data = &p_advdata[index+2];
bogdanm 0:eff01767de02 15 *len = field_length-1;
bogdanm 0:eff01767de02 16 return NRF_SUCCESS;
bogdanm 0:eff01767de02 17 }
bogdanm 0:eff01767de02 18 index += field_length+1;
bogdanm 0:eff01767de02 19 }
bogdanm 0:eff01767de02 20 return NRF_ERROR_NOT_FOUND;
bogdanm 0:eff01767de02 21 }