mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
bit field for missing packets, added commands r_padding and r_discardpolicy, hdf5 bitfield metadata left to do
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#ifdef __cplusplus
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#endif
|
||||
#include "ansi.h"
|
||||
@ -131,6 +132,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@short structure for a Detector Packet or Image Header
|
||||
@li frameNumber is the frame number
|
||||
@ -147,22 +149,44 @@ public:
|
||||
@li detType is the detector type see :: detectorType
|
||||
@li version is the version number of this structure format
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint64_t frameNumber; /**< is the frame number */
|
||||
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
|
||||
uint32_t packetNumber; /**< is the packet number */
|
||||
uint64_t bunchId; /**< is the bunch id from beamline */
|
||||
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
||||
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
|
||||
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
||||
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
||||
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
||||
uint32_t debug; /**< is for debugging purposes */
|
||||
uint16_t roundRNumber; /**< is the round robin set number */
|
||||
uint8_t detType; /**< is the detector type see :: detectorType */
|
||||
uint8_t version; /**< is the version number of this structure format */
|
||||
uint64_t frameNumber; /**< is the frame number */
|
||||
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
|
||||
uint32_t packetNumber; /**< is the packet number */
|
||||
uint64_t bunchId; /**< is the bunch id from beamline */
|
||||
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
||||
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
|
||||
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
||||
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
||||
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
||||
uint32_t debug; /**< is for debugging purposes */
|
||||
uint16_t roundRNumber; /**< is the round robin set number */
|
||||
uint8_t detType; /**< is the detector type see :: detectorType */
|
||||
uint8_t version; /**< is the version number of this structure format */
|
||||
} sls_detector_header;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define MAX_NUM_PACKETS 512
|
||||
|
||||
typedef struct {
|
||||
sls_detector_header detHeader; /**< is the detector header */
|
||||
std::bitset<MAX_NUM_PACKETS> packetsMask; /**< is the packets caught bit mask */
|
||||
} sls_receiver_header;
|
||||
|
||||
|
||||
#endif
|
||||
/**
|
||||
* frameDiscardPolicy
|
||||
*/
|
||||
enum frameDiscardPolicy {
|
||||
GET_FRAME_DISCARD_POLICY = -1, /**< to get the missing packet mode */
|
||||
NO_DISCARD, /**< pad incomplete packets with -1, default mode */
|
||||
DISCARD_EMPTY_FRAMES, /**< discard incomplete frames, fastest mode, save space, not suitable for multiple modules */
|
||||
DISCARD_PARTIAL_FRAMES, /**< ignore missing packets, must check with packetsMask for data integrity, fast mode and suitable for multiple modules */
|
||||
NUM_DISCARD_POLICIES
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
format
|
||||
@ -252,6 +276,19 @@ public:
|
||||
default: return std::string("unknown"); \
|
||||
}};
|
||||
|
||||
/**
|
||||
* Returns string of frame discard policy index
|
||||
* @param f can be NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
|
||||
* @returns No Discard, Discard Empty Frames, Discard Partial Frames, unknown
|
||||
*/
|
||||
static std::string getFrameDiscardPolicyType(frameDiscardPolicy f) { \
|
||||
switch (f) { \
|
||||
case NO_DISCARD: return std::string("No Discard"); \
|
||||
case DISCARD_EMPTY_FRAMES: return std::string("Discard Empty Frames"); \
|
||||
case DISCARD_PARTIAL_FRAMES: return std::string("Discard Partial Frames"); \
|
||||
default: return std::string("unknown"); \
|
||||
}}; \
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user