diff --git a/ts2phc_pps_source.c b/ts2phc_pps_source.c index c333f652..ae2ad46b 100644 --- a/ts2phc_pps_source.c +++ b/ts2phc_pps_source.c @@ -26,6 +26,8 @@ struct ts2phc_pps_source *ts2phc_pps_source_create(struct ts2phc_private *priv, src = ts2phc_phc_pps_source_create(priv, dev); break; } + if (src) + src->type = type; return src; } @@ -46,3 +48,8 @@ struct ts2phc_clock *ts2phc_pps_source_get_clock(struct ts2phc_pps_source *src) return NULL; } + +enum ts2phc_pps_source_type ts2phc_pps_source_get_type(struct ts2phc_pps_source *src) +{ + return src->type; +} diff --git a/ts2phc_pps_source.h b/ts2phc_pps_source.h index 293c6933..c87e3af1 100644 --- a/ts2phc_pps_source.h +++ b/ts2phc_pps_source.h @@ -53,4 +53,11 @@ int ts2phc_pps_source_getppstime(struct ts2phc_pps_source *src, struct timespec struct ts2phc_clock *ts2phc_pps_source_get_clock(struct ts2phc_pps_source *src); +/** + * Returns the type of the PPS source + * @param src Pointer to a source obtained via @ref ts2phc_pps_source_create(). + * @return The type of the clock. + */ +enum ts2phc_pps_source_type ts2phc_pps_source_get_type(struct ts2phc_pps_source *src); + #endif diff --git a/ts2phc_pps_source_private.h b/ts2phc_pps_source_private.h index 99e6a78d..ea6a8ad1 100644 --- a/ts2phc_pps_source_private.h +++ b/ts2phc_pps_source_private.h @@ -13,6 +13,7 @@ #include "ts2phc_pps_source.h" struct ts2phc_pps_source { + enum ts2phc_pps_source_type type; void (*destroy)(struct ts2phc_pps_source *src); int (*getppstime)(struct ts2phc_pps_source *src, struct timespec *ts); struct ts2phc_clock *(*get_clock)(struct ts2phc_pps_source *src);