You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.9 KiB
96 lines
3.9 KiB
#ifndef __LRF_SCANNER_4TECHNION_HEADER__
|
|
#define __LRF_SCANNER_4TECHNION_HEADER__
|
|
|
|
#include "../../../components/base/basicSettingsProvider.h"
|
|
#include "../../../components/base/basicDualThread.h"
|
|
#include "../../../components/base/basicMutex.h"
|
|
#include "../../../pathfinder/pathfinderDBConnector.h"
|
|
#include "../../../components/object/objectPathfinderBinaryLog.h"
|
|
//#include "../../../data/protocol/protocol.h"
|
|
//#include "../../uart/serialPort.h"
|
|
|
|
#include <stdio.h> // standard input / output functions
|
|
#include <stdlib.h>
|
|
#include <string.h> // string function definitions
|
|
#include <fcntl.h> // File control definitions
|
|
#include <errno.h> // Error number definitions
|
|
#include <unistd.h> // UNIX standard function definitions
|
|
#include <termios.h> // POSIX terminal control definitions
|
|
|
|
//#define DEBUG_LRF_DATA
|
|
|
|
typedef enum E_LRFT_CMD{
|
|
CMD_GET_MODE = 0x00,
|
|
CMD_GET_PARAM = 0x01,
|
|
CMD_SET_PARAM = 0x02,
|
|
CMD_START = 0x03,
|
|
CMD_STOP = 0x04,
|
|
CMD_RESET = 0x05,
|
|
CMD_RAW_DATA = 0x06
|
|
} LRFT_CMD;
|
|
#define CMD_IDX 3
|
|
|
|
#define LRF_WM_INIT 0
|
|
#define LRF_WM_COMMAND 1
|
|
#define LRF_WM_DATA 2
|
|
#define LRF_WM_STOPING 3
|
|
|
|
class LRF_techScanner: public basicDualThread {
|
|
private:
|
|
basicLogCollection * m_pLog;
|
|
config_setting_t * m_pSettings;
|
|
uint8_t m_bSpeedSPS;
|
|
uint16_t m_nPulseCount;
|
|
uint16_t m_nByteCount;
|
|
uint8_t inBuffer[2][6700];
|
|
uint8_t m_bActiveBuffer;
|
|
//uint8_t m_bUpdateBuffer;
|
|
bool cDATA;
|
|
LRF_EVTREC m_sEvent;
|
|
|
|
// serialPort * m_pPort;
|
|
uint8_t m_bWMODE;
|
|
PATHFINDER_DBC * m_pDBC;
|
|
|
|
objectPathfinderBinaryLog * m_pBLOG;
|
|
|
|
bool m_bDataReady;
|
|
basicMutex m_oMutex;
|
|
struct termios m_sTTY;
|
|
int m_iInFID;
|
|
int m_iOutFID;
|
|
|
|
uint16_t m_pScanData[3329];
|
|
PF_TIMESTAMP m_sScanSTS;
|
|
PF_TIMESTAMP m_sScanFTS;
|
|
uint16_t m_nSampleID;
|
|
bool setParams();
|
|
bool reqParams();
|
|
bool reqMode();
|
|
|
|
char m_sDevicePath[512];
|
|
int m_iLineSpeed;
|
|
bool m_bInitComplete;
|
|
bool HW_init( CSTR DevicePath, int Speed );
|
|
int sendBlock( unsigned char *Data, int DataSize );
|
|
int recptBlock( unsigned char *Buffer, int BufferLength );
|
|
pthread_t m_sUpdateThreadHandler;
|
|
static void * m_fUpdateShutNForget(void *);
|
|
protected:
|
|
virtual void m_fThreadAProc( void );
|
|
virtual void m_fThreadBProc( void );
|
|
// virtual int packetChecker(U8 *Buffer, size_t BufferSize);
|
|
// virtual protocolPackage * packetExtractor(U8 *Buffer, size_t BufferSize);
|
|
// virtual bool packetHandler( protocolPackage *Package );
|
|
// virtual void dataEraser(U8*& tPtr);
|
|
public:
|
|
explicit LRF_techScanner( config_setting_t * Settings = NULL, PATHFINDER_DBC * DBC = NULL );
|
|
virtual ~LRF_techScanner();
|
|
virtual bool create();
|
|
bool setDeviceSPS( uint8_t S );
|
|
bool startScan();
|
|
bool stopScan();
|
|
bool resetDevice();
|
|
bool isDead();
|
|
};
|
|
#endif
|