mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 00:00:02 +02:00
sorted the receiver client interface, more manageable
This commit is contained in:
parent
a4c07ba9a0
commit
f8c04a6a51
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsReceiverSoftware
|
Path: slsDetectorsPackage/slsReceiverSoftware
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
||||||
Repsitory UUID: edef347a62cd0239115c76101154d94814c6916b
|
Repsitory UUID: 670a57a1231e27ccdc01bcede88e3ae053b2a3f1
|
||||||
Revision: 597
|
Revision: 598
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 602
|
Last Changed Rev: 603
|
||||||
Last Changed Date: 2017-06-29 17:10:28 +0200
|
Last Changed Date: 2017-06-30 12:19:27 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "edef347a62cd0239115c76101154d94814c6916b"
|
#define SVNREPUUID "670a57a1231e27ccdc01bcede88e3ae053b2a3f1"
|
||||||
//#define SVNREV 0x602
|
//#define SVNREV 0x603
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x602
|
#define SVNREV 0x603
|
||||||
#define SVNDATE 0x20170629
|
#define SVNDATE 0x20170630
|
||||||
//
|
//
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/** Destructor */
|
||||||
|
virtual ~slsReceiverTCPIPInterface();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* reads config file, creates socket, assigns function table
|
* reads config file, creates socket, assigns function table
|
||||||
@ -46,8 +50,7 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
/** stop listening on the TCP & UDP port for client comminication */
|
/** stop listening on the TCP & UDP port for client comminication */
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
/** Destructor */
|
|
||||||
virtual ~slsReceiverTCPIPInterface();
|
|
||||||
|
|
||||||
/** Close all threaded Files and exit */
|
/** Close all threaded Files and exit */
|
||||||
void closeFile(int p);
|
void closeFile(int p);
|
||||||
@ -98,7 +101,8 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
*/
|
*/
|
||||||
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||||
char*, uint32_t, void*),void *arg);
|
char*, uint32_t, void*),void *arg);
|
||||||
private:
|
|
||||||
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static function - Thread started which is a TCP server
|
* Static function - Thread started which is a TCP server
|
||||||
@ -114,32 +118,82 @@ private:
|
|||||||
*/
|
*/
|
||||||
void startTCPServer();
|
void startTCPServer();
|
||||||
|
|
||||||
|
/** retuns function name with function index */
|
||||||
|
const char* getFunctionName(enum recFuncs func);
|
||||||
|
|
||||||
/** assigns functions to the fnum enum */
|
/** assigns functions to the fnum enum */
|
||||||
int function_table();
|
int function_table();
|
||||||
|
|
||||||
/** Decodes Function */
|
/** Decodes Function */
|
||||||
int decode_function();
|
int decode_function();
|
||||||
|
|
||||||
|
/** print socket read error */
|
||||||
|
int printSocketReadError();
|
||||||
|
|
||||||
|
/** receiver object is null */
|
||||||
|
void invalidReceiverObject();
|
||||||
|
|
||||||
|
/** receiver already locked */
|
||||||
|
void receiverlocked();
|
||||||
|
|
||||||
|
/** receiver not idle */
|
||||||
|
void receiverNotIdle();
|
||||||
|
|
||||||
|
/** function not implemented for specific detector */
|
||||||
|
void functionNotImplemented();
|
||||||
|
|
||||||
/** Unrecognized Function */
|
/** Unrecognized Function */
|
||||||
int M_nofunc();
|
int M_nofunc();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Execute command */
|
||||||
|
int exec_command();
|
||||||
|
|
||||||
|
/** Exit Receiver Server */
|
||||||
|
int exit_server();
|
||||||
|
|
||||||
|
/** Locks Receiver */
|
||||||
|
int lock_receiver();
|
||||||
|
|
||||||
|
/** Get Last Client IP*/
|
||||||
|
int get_last_client_ip();
|
||||||
|
|
||||||
|
/** Set port */
|
||||||
|
int set_port();
|
||||||
|
|
||||||
|
/** Updates Client if different clients connect */
|
||||||
|
int update_client();
|
||||||
|
|
||||||
|
/** Sends the updated parameters to client */
|
||||||
|
int send_update();
|
||||||
|
|
||||||
|
/** get version, calls get_version */
|
||||||
|
int get_id();
|
||||||
|
|
||||||
/** Set detector type */
|
/** Set detector type */
|
||||||
int set_detector_type();
|
int set_detector_type();
|
||||||
|
|
||||||
/** Set File name without frame index, file index and extension */
|
/** set detector hostname */
|
||||||
int set_file_name();
|
int set_detector_hostname();
|
||||||
|
|
||||||
/** Set File path */
|
/** set short frame */
|
||||||
int set_file_dir();
|
int set_short_frame();
|
||||||
|
|
||||||
/** Set up UDP Details */
|
/** Set up UDP Details */
|
||||||
int setup_udp();
|
int setup_udp();
|
||||||
|
|
||||||
/** Set File index */
|
/** set acquisition period, frame number etc */
|
||||||
int set_file_index();
|
int set_timer();
|
||||||
|
|
||||||
/** Set Frame index */
|
/** set dynamic range */
|
||||||
int set_frame_index();
|
int set_dynamic_range();
|
||||||
|
|
||||||
|
/** Sets the receiver to send every nth frame to gui, or only upon gui request */
|
||||||
|
int set_read_frequency();
|
||||||
|
|
||||||
|
/** Gets receiver status */
|
||||||
|
int get_status();
|
||||||
|
|
||||||
/** Start Receiver - starts listening to udp packets from detector */
|
/** Start Receiver - starts listening to udp packets from detector */
|
||||||
int start_receiver();
|
int start_receiver();
|
||||||
@ -147,70 +201,40 @@ private:
|
|||||||
/** Stop Receiver - stops listening to udp packets from detector*/
|
/** Stop Receiver - stops listening to udp packets from detector*/
|
||||||
int stop_receiver();
|
int stop_receiver();
|
||||||
|
|
||||||
/** Gets receiver status */
|
|
||||||
int get_status();
|
|
||||||
|
|
||||||
/** Gets Total Frames Caught */
|
|
||||||
int get_frames_caught();
|
|
||||||
|
|
||||||
/** Gets frame index for each acquisition */
|
|
||||||
int get_frame_index();
|
|
||||||
|
|
||||||
/** Resets Total Frames Caught */
|
|
||||||
int reset_frames_caught();
|
|
||||||
|
|
||||||
/** set short frame */
|
|
||||||
int set_short_frame();
|
|
||||||
|
|
||||||
/** Reads Frame/ buffer */
|
|
||||||
int read_frame();
|
|
||||||
|
|
||||||
/** gotthard specific read frame */
|
|
||||||
int gotthard_read_frame();
|
|
||||||
|
|
||||||
/** propix specific read frame */
|
|
||||||
int propix_read_frame();
|
|
||||||
|
|
||||||
/** moench specific read frame */
|
|
||||||
int moench_read_frame();
|
|
||||||
|
|
||||||
/** eiger specific read frame */
|
|
||||||
int eiger_read_frame();
|
|
||||||
|
|
||||||
/** jungfrau specific read frame */
|
|
||||||
int jungfrau_read_frame();
|
|
||||||
|
|
||||||
/** Sets the receiver to send every nth frame to gui, or only upon gui request */
|
|
||||||
int set_read_frequency();
|
|
||||||
|
|
||||||
/** Sets the timer between frames streamed by receiver when frequency is set to 0 */
|
|
||||||
int set_read_receiver_timer();
|
|
||||||
|
|
||||||
/* Set the data stream enable */
|
|
||||||
int set_data_stream_enable();
|
|
||||||
|
|
||||||
/** Enable File Write*/
|
|
||||||
int enable_file_write();
|
|
||||||
|
|
||||||
/** get version, calls get_version */
|
|
||||||
int get_id();
|
|
||||||
|
|
||||||
/** set status to transmitting and
|
/** set status to transmitting and
|
||||||
* when fifo is empty later, sets status to run_finished */
|
* when fifo is empty later, sets status to run_finished */
|
||||||
int start_readout();
|
int start_readout();
|
||||||
|
|
||||||
/** set acquisition period, frame number etc */
|
/** Reads Frame/ buffer */
|
||||||
int set_timer();
|
int read_frame();
|
||||||
|
|
||||||
|
/** Set File path */
|
||||||
|
int set_file_dir();
|
||||||
|
|
||||||
|
/** Set File name without frame index, file index and extension */
|
||||||
|
int set_file_name();
|
||||||
|
|
||||||
|
/** Set File index */
|
||||||
|
int set_file_index();
|
||||||
|
|
||||||
|
/** Set Frame index */
|
||||||
|
int set_frame_index();
|
||||||
|
|
||||||
|
/** Gets frame index for each acquisition */
|
||||||
|
int get_frame_index();
|
||||||
|
|
||||||
|
/** Gets Total Frames Caught */
|
||||||
|
int get_frames_caught();
|
||||||
|
|
||||||
|
/** Resets Total Frames Caught */
|
||||||
|
int reset_frames_caught();
|
||||||
|
|
||||||
|
/** Enable File Write*/
|
||||||
|
int enable_file_write();
|
||||||
|
|
||||||
/** enable compression */
|
/** enable compression */
|
||||||
int enable_compression();
|
int enable_compression();
|
||||||
|
|
||||||
/** set detector hostname */
|
|
||||||
int set_detector_hostname();
|
|
||||||
|
|
||||||
/** set dynamic range */
|
|
||||||
int set_dynamic_range();
|
|
||||||
|
|
||||||
/** enable overwrite */
|
/** enable overwrite */
|
||||||
int enable_overwrite();
|
int enable_overwrite();
|
||||||
|
|
||||||
@ -223,6 +247,12 @@ private:
|
|||||||
/** activate/ deactivate */
|
/** activate/ deactivate */
|
||||||
int set_activate();
|
int set_activate();
|
||||||
|
|
||||||
|
/* Set the data stream enable */
|
||||||
|
int set_data_stream_enable();
|
||||||
|
|
||||||
|
/** Sets the timer between frames streamed by receiver when frequency is set to 0 */
|
||||||
|
int set_read_receiver_timer();
|
||||||
|
|
||||||
/** enable flipped data */
|
/** enable flipped data */
|
||||||
int set_flipped_data();
|
int set_flipped_data();
|
||||||
|
|
||||||
@ -235,42 +265,16 @@ private:
|
|||||||
/** set multi detector size */
|
/** set multi detector size */
|
||||||
int set_multi_detector_size();
|
int set_multi_detector_size();
|
||||||
|
|
||||||
//General Functions
|
|
||||||
/** Locks Receiver */
|
|
||||||
int lock_receiver();
|
|
||||||
|
|
||||||
/** Set port */
|
|
||||||
int set_port();
|
|
||||||
|
|
||||||
/** Get Last Client IP*/
|
|
||||||
int get_last_client_ip();
|
|
||||||
|
|
||||||
/** Updates Client if different clients connect */
|
|
||||||
int update_client();
|
|
||||||
|
|
||||||
/** Sends the updated parameters to client */
|
|
||||||
int send_update();
|
|
||||||
|
|
||||||
/** Exit Receiver Server */
|
|
||||||
int exit_server();
|
|
||||||
|
|
||||||
/** Execute command */
|
|
||||||
int exec_command();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//private:
|
|
||||||
/** detector type */
|
/** detector type */
|
||||||
detectorType myDetectorType;
|
detectorType myDetectorType;
|
||||||
|
|
||||||
/** slsReceiverBase object */
|
/** slsReceiverBase object */
|
||||||
UDPInterface *receiverBase;
|
UDPInterface *receiverBase;
|
||||||
|
|
||||||
/** Number of functions */
|
|
||||||
static const int numberOfFunctions = 256;
|
|
||||||
|
|
||||||
/** Function List */
|
/** Function List */
|
||||||
int (slsReceiverTCPIPInterface::*flist[numberOfFunctions])();
|
int (slsReceiverTCPIPInterface::*flist[NUM_REC_FUNCTIONS])();
|
||||||
|
|
||||||
/** Message */
|
/** Message */
|
||||||
char mess[MAX_STR_LENGTH];
|
char mess[MAX_STR_LENGTH];
|
||||||
@ -278,6 +282,9 @@ private:
|
|||||||
/** success/failure */
|
/** success/failure */
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/** function index */
|
||||||
|
int fnum;
|
||||||
|
|
||||||
/** Lock Status if server locked to a client */
|
/** Lock Status if server locked to a client */
|
||||||
int lockStatus;
|
int lockStatus;
|
||||||
|
|
||||||
@ -293,9 +300,6 @@ private:
|
|||||||
/** port number */
|
/** port number */
|
||||||
int portNumber;
|
int portNumber;
|
||||||
|
|
||||||
/** Receiver not setup error message */
|
|
||||||
char SET_RECEIVER_ERR_MESSAGE[MAX_STR_LENGTH];
|
|
||||||
|
|
||||||
|
|
||||||
//***callback parameters***
|
//***callback parameters***
|
||||||
/**
|
/**
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
All set functions with argument -1 work as get, when possible
|
All set functions with argument -1 work as get, when possible
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define REC_FUNC_START_INDEX 128
|
||||||
|
|
||||||
enum {
|
enum recFuncs{
|
||||||
//General functions
|
//General functions
|
||||||
F_EXEC_RECEIVER_COMMAND=128, /**< command is executed */
|
F_EXEC_RECEIVER_COMMAND=REC_FUNC_START_INDEX, /**< command is executed */
|
||||||
F_EXIT_RECEIVER, /**< turn off receiver server */
|
F_EXIT_RECEIVER, /**< turn off receiver server */
|
||||||
F_LOCK_RECEIVER, /**< Locks/Unlocks server communication to the given client */
|
F_LOCK_RECEIVER, /**< Locks/Unlocks server communication to the given client */
|
||||||
F_GET_LAST_RECEIVER_CLIENT_IP, /**< returns the IP of the client last connected to the receiver */
|
F_GET_LAST_RECEIVER_CLIENT_IP, /**< returns the IP of the client last connected to the receiver */
|
||||||
@ -58,7 +59,11 @@ enum {
|
|||||||
F_SET_RECEIVER_FILE_FORMAT, /** < sets the receiver file format */
|
F_SET_RECEIVER_FILE_FORMAT, /** < sets the receiver file format */
|
||||||
|
|
||||||
F_SEND_RECEIVER_DETPOSID, /** < sets the detector position id in the reveiver */
|
F_SEND_RECEIVER_DETPOSID, /** < sets the detector position id in the reveiver */
|
||||||
F_SEND_RECEIVER_MULTIDETSIZE /** < sets the multi detector size to the receiver */
|
F_SEND_RECEIVER_MULTIDETSIZE, /** < sets the multi detector size to the receiver */
|
||||||
/* Always append functions hereafter!!! */
|
/* Always append functions hereafter!!! */
|
||||||
|
|
||||||
|
|
||||||
|
/* Always append functions before!!! */
|
||||||
|
NUM_REC_FUNCTIONS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,6 +50,10 @@ int main(int argc, char *argv[]) {
|
|||||||
//Catch signal SIGINT to close files properly
|
//Catch signal SIGINT to close files properly
|
||||||
signal(SIGINT,closeFile);
|
signal(SIGINT,closeFile);
|
||||||
|
|
||||||
|
// if socket crash, ignores SISPIPE, prevents global signal handler
|
||||||
|
// subsequent read/write to socket gives error - must handle locally
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
//system("setterm -linux term -background white -clear");
|
//system("setterm -linux term -background white -clear");
|
||||||
|
|
||||||
int ret = slsReceiverDefs::OK;
|
int ret = slsReceiverDefs::OK;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user