Help with "parsing" ANCS Data Source response

I'm not sure you give us enough code to make sense of what you do

One question and one suggestion:

Question:
what does characteristic.value() returns - is that a pointer to a AncsAttributes struct?

  memcpy(&attributeList, [color=blue]characteristic.value()[/color], sizeof(attributeList));

Suggestion:
Not sure if this is what bites you but when dealing with structures, the standard does not guarantee the compiler won't move attributes around to gain better byte boundary alignement (architecture dependent) to optimize data access for example.

So when you use memcpy() with data organized the way you think it is (maybe coming from somewhere else through BT) and force fill in the data, if the compiler played tricks on you, you are toast!

Luckily C++ offers an option to inform the compiler to not mess around with what you have done.

Sometimes you can coerce your compiler into not using the processor’s normal alignment rules by using a pragma, usually #pragma pack. GCC and clang have an attributepacked you can attach to individual structure declarations; GCC has an -fpack-struct option for entire compilations.

Do not do this casually, as it forces the generation of more expensive and slower code.

(source structure alignment and padding)

In your case you could try to enforce the structure

//for the Data Source response
struct __attribute__ ((packed)) AncsAttributes { // see http://www.catb.org/esr/structure-packing/#_structure_alignment_and_padding
  unsigned char commandId;
  unsigned long notificationUid;
  unsigned char attributeId;
  unsigned short attributeLen;
  char attributeValue[20];
};

just an idea....