テスト用
Fork of nRF51822 by
nordic/ble/ble_advdata_parser.cpp@69:936d81c963fe, 2014-09-26 (annotated)
- Committer:
- Rohit Grover
- Date:
- Fri Sep 26 14:46:19 2014 +0100
- Revision:
- 69:936d81c963fe
- Parent:
- 0:eff01767de02
Release 0.2.1
=============
Features
~~~~~~~~
- Turn on the service-changed characteristic by default.
Bugfixes
~~~~~~~~
- Raised the maximum number of supported characteristics/descriptors to 24
(was 10 previously). We're beginning to find services like Device-
Information with several characteristics populated.
Compatibility
~~~~~~~~~~~~~
Works with 0.2.0 of BLE_API.
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 | } |