common: Implement ofono_uuid_to_str

This commit is contained in:
Denis Kenzior 2010-09-20 16:44:13 -05:00
parent dbd7639d25
commit 04634af6fe
2 changed files with 13 additions and 1 deletions

View File

@ -104,10 +104,14 @@ struct ofono_network_time {
int utcoff; /* Offset from UTC in seconds */ int utcoff; /* Offset from UTC in seconds */
}; };
#define OFONO_SHA1_UUID_LEN 20
struct ofono_uuid { struct ofono_uuid {
unsigned char uuid[20]; unsigned char uuid[OFONO_SHA1_UUID_LEN];
}; };
const char *ofono_uuid_to_str(const struct ofono_uuid *uuid);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -31,6 +31,7 @@
#include <ofono/types.h> #include <ofono/types.h>
#include "common.h" #include "common.h"
#include "util.h"
struct error_entry { struct error_entry {
int error; int error;
@ -686,3 +687,10 @@ gboolean is_valid_apn(const char *apn)
return TRUE; return TRUE;
} }
const char *ofono_uuid_to_str(const struct ofono_uuid *uuid)
{
static char buf[OFONO_SHA1_UUID_LEN * 2 + 1];
return encode_hex_own_buf(uuid->uuid, OFONO_SHA1_UUID_LEN, 0, buf);
}