BLE temperature profile using digital DS1820 or analog LM35 sensors

Dependencies:   DS1820

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_advdata_parser.cpp Source File

ble_advdata_parser.cpp

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