From 04634af6fea838fdb3c841684b91f41a3b18d0ab Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 20 Sep 2010 16:44:13 -0500 Subject: [PATCH] common: Implement ofono_uuid_to_str --- include/types.h | 6 +++++- src/common.c | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/types.h b/include/types.h index 460a73e4..ba2481f7 100644 --- a/include/types.h +++ b/include/types.h @@ -104,10 +104,14 @@ struct ofono_network_time { int utcoff; /* Offset from UTC in seconds */ }; +#define OFONO_SHA1_UUID_LEN 20 + 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 } #endif diff --git a/src/common.c b/src/common.c index 4eaff5e9..8243f214 100644 --- a/src/common.c +++ b/src/common.c @@ -31,6 +31,7 @@ #include #include "common.h" +#include "util.h" struct error_entry { int error; @@ -686,3 +687,10 @@ gboolean is_valid_apn(const char *apn) 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); +}