mediCAL's first BLE project
Fork of nRF51822 by
nordic/ble/ble_advdata_parser.cpp@69:d9f51b65a3c8, 2014-11-02 (annotated)
- Committer:
- antoniorohit
- Date:
- Sun Nov 02 20:43:14 2014 +0000
- Revision:
- 69:d9f51b65a3c8
- Parent:
- 0:eff01767de02
First rev of BLE program for nRF51822 which provides BLE connectivity for team mediCAL's PILLar;
Who changed what in which revision?
User | Revision | Line number | New 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 | } |