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