Defines sensor serializer.
Data Structures | |
struct | dwSerializerParams |
Holds the parameters for sensor serializer creation. More... | |
struct | dwSerializerStats |
Holds the available statistics for a serializer. More... | |
Typedefs | |
typedef struct dwSensorSerializerObject * | dwSensorSerializerHandle_t |
Handle representing a sensor serializer. More... | |
typedef void(* | dwSensorSerializerOnDataFunc_t) (const uint8_t *data, size_t size, void *userData) |
Callback type for getting data from sensor serializer. More... | |
Enumerations | |
enum | dwSerializerStatTimeDifference { DW_SERIALIZER_STAT_DISK_WRITE_TIME = 0 , DW_SERIALIZER_STAT_ENCODE_TIME = 1 , DW_SERIALIZER_STAT_STAGE1_TIME = 2 , DW_SERIALIZER_STAT_STAGE2_TIME = 3 , DW_SERIALIZER_STAT_STAGE3_TIME = 4 , DW_SERIALIZER_STAT_COUNT = 5 } |
Defines the various delta used in statistics. More... | |
struct dwSerializerParams |
Data Fields | ||
---|---|---|
dwSensorSerializerOnDataFunc_t | onData | Callback executed by the serializer on new data available. |
const char8_t * | parameters |
Array for additional parameters provided to sensor serializer creation. The parameters argument is an array in the form of key-value pairs separated by commas, i.e., key1=value1,key2=value2,key3=value3. Supported 'keys' are:
For a code snippet, see dwSensorSerializer_initialize(). |
void * | userData | User data to be passed to the callback. |
struct dwSerializerStats |
Data Fields | ||
---|---|---|
dwTime_t | currentDeltaUs[DW_SERIALIZER_STAT_COUNT] | Array of current latencies of all the time deltas between various stages of serialization as per the dwSerializerStatTimeDifference [us]. |
dwTime_t | maxDeltaUs[DW_SERIALIZER_STAT_COUNT] | Array of max latencies of all the time deltas between various stages of serialization as per the dwSerializerStatTimeDifference [us]. |
float64_t | meanDelta[DW_SERIALIZER_STAT_COUNT] | Array of Mean of all the time deltas between various stages of serialization as per the dwSerializerStatTimeDifference. |
dwTime_t | minDeltaUs[DW_SERIALIZER_STAT_COUNT] | Array of min latencies of all the time deltas between various stages of serialization as per the dwSerializerStatTimeDifference [us]. |
float64_t | standardDeviationDelta[DW_SERIALIZER_STAT_COUNT] | Array of Variance of all the time deltas between various stages of serialization as per the dwSerializerStatTimeDifference. |
typedef struct dwSensorSerializerObject* dwSensorSerializerHandle_t |
Handle representing a sensor serializer.
Definition at line 112 of file SensorSerializer.h.
typedef void(* dwSensorSerializerOnDataFunc_t) (const uint8_t *data, size_t size, void *userData) |
Callback type for getting data from sensor serializer.
[in] | data | A pointer to the byte array of serialized data. |
[in] | size | A pointer to the size of the byte array. |
[in] | userData | User Data |
Definition at line 109 of file SensorSerializer.h.
Defines the various delta used in statistics.
Definition at line 63 of file SensorSerializer.h.
DW_API_PUBLIC dwStatus dwSensorSerializer_attachTo | ( | dwSensorSerializerHandle_t const | serializer, |
dwSensorSerializerHandle_t const | masterSerializer | ||
) |
Starts and stops serialization of a sensor with a master serializer.
This method attaches the serializer to the same thread of the master serializer. The slave serializer handle is still used to call dwSensorSerializer_serializeDataAsync().
[in] | serializer | Specifies the sensor serializer handle. |
[in] | masterSerializer | Specifies the sensor serializer handle that is the main thread. |
DW_API_PUBLIC dwStatus dwSensorSerializer_detachFrom | ( | dwSensorSerializerHandle_t const | serializer, |
dwSensorSerializerHandle_t const | masterSerializer | ||
) |
This method detaches the serializer previously attached with dwSensorSerializer_attachTo().
Due to the asyncronous nature of this call, the serializer may still be attached to the serializing thread immediately following this call. dwSensorSerializer_isAttached() must be polled for status.
[in] | serializer | Specifies the sensor serializer handle. |
[in] | masterSerializer | Specifies the sensor serializer handle that takes ownership of the serializer. |
DW_API_PUBLIC dwStatus dwSensorSerializer_getStats | ( | dwSerializerStats *const | outStats, |
dwSensorSerializerHandle_t const | serializer | ||
) |
Gets serializer statistics (if available).
[out] | outStats | A pointer to a structure containing the statistics. |
[in] | serializer | Handle to the serializer |
DW_API_PUBLIC dwStatus dwSensorSerializer_initialize | ( | dwSensorSerializerHandle_t *const | serializer, |
dwSerializerParams const *const | params, | ||
dwSensorHandle_t const | sensor | ||
) |
Initializes a sensor serializer with the parameters provided.
[out] | serializer | A pointer to the sensor serializer handle. |
[in] | params | A pointer to the sensor serializer parameters. |
[in] | sensor | Specifies the sensor used to create the serializer. This is necessary because each sensor has its own unique serializer. For example, camera provides a serializer that can encode the data, while GPS serializes RAW data. |
DW_API_PUBLIC dwStatus dwSensorSerializer_isAttached | ( | bool *const | isAttached, |
dwSensorSerializerHandle_t const | serializer | ||
) |
Query method to check whether the serializer is attached to another.
[out] | isAttached | Specifies whether the sensor serializer handle is attached to another. |
[in] | serializer | The sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializer_release | ( | dwSensorSerializerHandle_t const | serializer | ) |
Releases a sensor serializer.
If the serializer has been attached to a master serializer via dwSensorSerializer_attachTo(), this method fails with DW_NOT_AVAILABLE. If this happens, dwSensorSerializer_detachFrom() must be called, and then this method succeeds. If the serializer is a master serializer that has other serializers attached, it releases as normal and the slave serializers are no longer be attached.
[in] | serializer | The sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializer_serializeCameraFrame | ( | dwCameraFrameHandle_t const | frame, |
dwSensorSerializerHandle_t const | serializer | ||
) |
Pushes a camera frame to the serializer.This method must only be used if 'dwSensorSerializer_start' is not called.
This pushes the serialized image directly to the sink.
[in] | frame | Handle to the camera frame. |
[in] | serializer | Specifies the sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializer_serializeCameraFrameAsync | ( | dwCameraFrameHandle_t const | frame, |
dwSensorSerializerHandle_t const | serializer | ||
) |
Pushes a camera frame to the serializer.
This method is thread-safe.
[in] | frame | Handle to the camera frame. |
[in] | serializer | Specifies the sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializer_serializeData | ( | uint8_t const *const | data, |
size_t const | size, | ||
dwSensorSerializerHandle_t const | serializer | ||
) |
Pushes data to the serializer.
This method is thread-safe and thus can be used on the capture thread (or any other thread).
[in] | data | A pointer to the byte array of data. |
[in] | size | Specifies the size of the byte array. |
[in] | serializer | Specifies the handle to the sensor serializer. |
DW_API_PUBLIC dwStatus dwSensorSerializer_serializeDataAsync | ( | uint8_t const *const | data, |
size_t const | size, | ||
dwSensorSerializerHandle_t const | serializer | ||
) |
Pushes data to the serializer.
This method is thread-safe and thus can be used on the capture thread (or any other thread). Use this method in conjunction with 'dwSensorSerializer_start'/'dwSensorSerializer_stop'.
[in] | data | A pointer to the byte array of data. |
[in] | size | Specifies the size of the byte array. |
[in] | serializer | Specifies the handle to the sensor serializer. |
DW_API_PUBLIC dwStatus dwSensorSerializer_start | ( | dwSensorSerializerHandle_t const | serializer | ) |
Starts serialization of sensor.
This method creates a new thread and begins the serialization loop.
[in] | serializer | Specifies the sensor serializer handle. |
DW_API_PUBLIC dwStatus dwSensorSerializer_stop | ( | dwSensorSerializerHandle_t const | serializer | ) |
Starts serialization of sensor.
This method stops the thread and the serialization loop.
[in] | serializer | Specifies the sensor serializer handle. |