added debugging

Fork of BLE_nRF8001 by RedBearLab

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BLEUuid.cpp Source File

BLEUuid.cpp

00001 #include "Arduino.h"
00002 
00003 #include "BLEUuid.h"
00004 
00005 BLEUuid::BLEUuid(const char * str)
00006 {
00007   char temp[] = {0, 0, 0};
00008 
00009   this->_length = 0;
00010   for (int i = strlen(str) - 1; i >= 0 && this->_length < MAX_UUID_LENGTH; i -= 2) {
00011     if (str[i] == '-') {
00012       i++;
00013       continue;
00014     }
00015 
00016     temp[0] = str[i - 1];
00017     temp[1] = str[i];
00018 
00019     this->_data[this->_length] = strtoul(temp, NULL, 16);
00020 
00021     this->_length++;
00022   }
00023 }
00024 
00025 const char* BLEUuid::str() {
00026   return this->_str;
00027 }
00028 
00029 const unsigned char* BLEUuid::data() {
00030   return this->_data;
00031 }
00032 
00033 unsigned char BLEUuid::length() {
00034   return this->_length;
00035 }