diff --git a/include/thingset.h b/include/thingset.h index 2c74c7d..2824bd4 100644 --- a/include/thingset.h +++ b/include/thingset.h @@ -1775,6 +1775,17 @@ int thingset_export_subsets_progressively(struct thingset_context *ts, uint8_t * enum thingset_data_format format, unsigned int *index, size_t *len); +/** + * Aborts the export of data to the buffer passed to @ref + * thingset_export_subsets_progressively. Call this method if + * the export has failed outside ThingSet code. + * + * @param ts Pointer to ThingSet context. + * + * @returns 0 for success + */ +int thingset_export_subsets_progressively_abort(struct thingset_context *ts); + /** * Export id, value and/or name of a single data item. * diff --git a/src/thingset.c b/src/thingset.c index 508b8cf..dad32ce 100644 --- a/src/thingset.c +++ b/src/thingset.c @@ -163,6 +163,12 @@ int thingset_export_subsets_progressively(struct thingset_context *ts, uint8_t * return ret; } +int thingset_export_subsets_progressively_abort(struct thingset_context *ts) +{ + k_sem_give(&ts->lock); + return 0; +} + int thingset_export_subsets(struct thingset_context *ts, uint8_t *buf, size_t buf_size, uint16_t subsets, enum thingset_data_format format) {