uuid: cache uuid to improve stability and performance
This commit is contained in:
parent
a25e3e00fd
commit
10f4015583
|
@ -6,6 +6,8 @@
|
|||
#include "core/iap/iap.h"
|
||||
|
||||
uint32_t GetUUID32(void){
|
||||
static uint32_t uuid = 0;
|
||||
if( uuid == 0){
|
||||
IAP_return_t iap_return;
|
||||
iap_return = iapReadSerialNumber();
|
||||
if (iap_return.ReturnCode == 0){
|
||||
|
@ -15,9 +17,10 @@ uint32_t GetUUID32(void){
|
|||
for(i=0; i<4; i++)
|
||||
block[i] = iap_return.Result[i];
|
||||
xxtea_encode_words(block, 4, k);
|
||||
return block[0];
|
||||
uuid = block[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return uuid;
|
||||
};
|
||||
|
||||
// What OpenBeacon used. Do we want this?
|
||||
|
|
Loading…
Reference in New Issue