This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Fork of libMiMic by
Diff: core/utils/NyLPC_cUuid.c
- Revision:
- 48:00d211aac2ec
- Child:
- 49:d4334acc3ec3
diff -r d27b9b2dcac6 -r 00d211aac2ec core/utils/NyLPC_cUuid.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/utils/NyLPC_cUuid.c Wed Aug 07 13:53:02 2013 +0000 @@ -0,0 +1,37 @@ +#include <stdlib.h> +#include "NyLPC_cUuid.h" + +void NyLPC_cUuid_initialize(NyLPC_TcUuid_t* i_inst) +{ +} +#define NyLPC_cUuid_finalize(i_inst) + +void NyLPC_cUuid_setTimeBase(NyLPC_TcUuid_t* i_inst,NyLPC_TUInt32 i_time_l,NyLPC_TUInt32 i_time_h,NyLPC_TUInt16 i_seq,struct NyLPC_TEthAddr* eth_mac) +{ + i_inst->f1=i_time_l; + i_inst->f2=(NyLPC_TUInt16)(i_time_h & 0x0000ffff); + i_inst->f3=(NyLPC_TUInt16)(((i_time_h & 0x0fff0000)>>16)|0x1000); + i_inst->f4=(NyLPC_TUInt8)((0x3f&(i_seq>>8))|0x80); + i_inst->f5=(NyLPC_TUInt8)(0xff&(i_seq>>0)); + memcpy(i_inst->f6,eth_mac->addr,8); +} + + +void NyLPC_cUuid_toString(NyLPC_TcUuid_t* i_inst,NyLPC_TChar* i_buf) +{ + NyLPC_TChar* p=i_buf; + NyLPC_TInt16 i; + NyLPC_uitoa2(i_inst->f1,p,16,8);p+=8; + *p='-';p++; + NyLPC_uitoa2(i_inst->f2,p,16,4);p+=4; + *p='-';p++; + NyLPC_uitoa2(i_inst->f3,p,16,4);p+=4; + *p='-';p++; + NyLPC_uitoa2(i_inst->f4,p,16,2);p+=4; + NyLPC_uitoa2(i_inst->f5,p,16,2);p+=4; + *p='-';p++; + for(i=0;i<6;i++){ + NyLPC_uitoa2(i_inst->f6[i],p,16,2);p+=2; + } + *p='\0'; +}