core: add port type -> string conversion helper for debuggin messages

This commit is contained in:
Dan Williams
2010-05-04 16:58:18 -07:00
parent f0e0861aa4
commit 0c3961441b
2 changed files with 22 additions and 0 deletions

View File

@@ -46,6 +46,26 @@ typedef struct {
/*****************************************************************************/
const char *
mm_port_type_to_name (MMPortType ptype)
{
switch (ptype) {
case MM_PORT_TYPE_PRIMARY:
return "primary";
case MM_PORT_TYPE_SECONDARY:
return "secondary";
case MM_PORT_TYPE_IGNORED:
return "ignored";
case MM_PORT_TYPE_QCDM:
return "QCDM";
default:
break;
}
return "(unknown)";
}
/*****************************************************************************/
static GObject*
constructor (GType type,
guint n_construct_params,

View File

@@ -76,5 +76,7 @@ gboolean mm_port_get_connected (MMPort *self);
void mm_port_set_connected (MMPort *self, gboolean connected);
const char * mm_port_type_to_name (MMPortType ptype);
#endif /* MM_PORT_H */