Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.

Dependents:   nRF51822 nRF51822

Committer:
vcoubard
Date:
Thu Apr 07 17:37:40 2016 +0100
Revision:
19:47192cb9def7
Parent:
10:233fefd8162b
Child:
20:a90c48eb1d30
Synchronized with git rev 9251259f
Author: Liyou Zhou
Copy over coresponding files from nordic-sdk 9.0.0

Who changed what in which revision?

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