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.
 
 
 
 
 
 

157 lines
5.1 KiB

/*******************************************************************
*
* DESCRIPTION: Pathfinder Kernel Header File
*
* AUTHOR: gagua
*
* HISTORY:
*
* DATE:1/20/2020
*
*******************************************************************/
#ifndef __ARGUS_KERNEL_HEADER__
#define __ARGUS_KERNEL_HEADER__
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <getopt.h> /* getopt_long() */
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <linux/types.h>
struct serial_struct {
int type;
int line;
unsigned int port;
int irq;
int flags;
int xmit_fifo_size;
int custom_divisor;
int baud_base;
unsigned short close_delay;
char io_type;
char reserved_char[1];
int hub6;
unsigned short closing_wait; /* time to wait before closing */
unsigned short closing_wait2; /* no longer used... */
unsigned char * iomem_base;
unsigned short iomem_reg_shift;
unsigned int port_high;
unsigned long iomap_base; /* cookie passed into ioremap */
};
#include "../../alg/generic/md5.h"
#include "../../components/base/basicThread.h"
#include "../../components/base/basicEngine.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/object/objectPathfinderBinaryLog.h"
#include "../../data/ponvif/ponvif.h"
#include "../../data/protocol/onvifMediaObserver.h"
#include "../../data/ssdp/ssdpAnnouncer.h"
#include "../../components/base/basicEventHeap.h"
#include "../../data/net/netServer.h"
#include "../../pathfinder/pathfinderDBConnector.h"
#include "../../hardware/sensors/9dof/BNO055.h"
#include "../../hardware/sensors/gps/XA1110_I2C.h"
#include "../../hardware/sensors/gphoto/gPhotoCamera.h"
#include "../../hardware/sensors/optic_flow/adns3080/opticFlowADNS.h"
#include "../../hardware/sensors/lrf/lrfScanner.h"
#include <wiringPi.h>
#define SLEEP_KERNEL_INTERVAL 10
#define ONVIF_DISCOVERY_INTERVAL 300 // 5 min
#define ONVIF_DISCOVERY_RESULT_TIME 5
typedef enum E_PF_COMMANDS{
PF_CMD_ARM_APPLICATION = 1,
PF_CMD_DISARM_APPLICATION = 2,
PF_CMD_OFSENSOR_SET_CAM = 3,
PF_CMD_OFSENSOR_SET_OF = 4,
PF_CMD_START_SCANER = 10,
PF_CMD_RESET_SCANER = 13,
PF_CMD_STOP_SCANER = 15,
PF_CMD_SHOT_CAMERA = 22,
PF_CMD_START_BURST_CAMERA = 23,
PF_CMD_STOP_BURST_CAMERA = 24,
PF_CMD_SWITCH_CAMERA = 25,
PF_CMD_SWITCH_STORAGE = 26,
PF_CMD_PREV_CAMERA = 27,
PF_CMD_UPDATE_IMU = 28,
PF_CMD_START_PROCESS = 29,
PF_CMD_STOP_PROCESS = 30,
PF_CMD_SET_CURRENT_ALT = 31,
PF_CMD_DELETE_CAM_PHOTOS = 32,
PF_CMD_DELETE_DATA_FILE = 33
} PF_COMMANDS;
#define PF_HW_NONE 0
#define PF_HW_GPS 1
#define PF_HW_BNO 2
#define PF_HW_OPF 4
#define PF_HW_LRF 8
#define PF_HW_PHO 16
#define PF_HW_ALL 31
class PF_Kernel: public basicThread {
private:
time_t m_tTimeTSeconds;
basicLogCollection * m_pLog;
config_setting_t * m_pSettings;
ssdpAnnouncer * m_pServiceAnnouncer;
uint8_t m_bExitCause;
bool m_bCreatedDBC;
uint8_t m_bStartMode;
uint8_t m_bHWFlags;
float m_fStartAlt;
float m_fGSAlt;
bool m_bGPSis3D;
PATHFINDER_DBC * m_pDBC;
objectPathfinderBinaryLog * m_pBLOG;
/* Sensors and Devices */
sensorBNO * m_pBNO;
sensorXA1110 * m_pGPS;
LRF_techScanner * m_pScanner;
gPhotoCamera * m_pCamera;
opticFlow * m_pFlow;
/* Flags */
bool m_bArmed;
bool m_bForced;
bool m_bActive;
protected:
void m_fThreadProc( void );
void startDataAsqusition( void );
void stopDataAsqusition( void );
public:
// Constructor
explicit PF_Kernel( config_setting_t *Settings = NULL );
// Destructor
virtual ~PF_Kernel();
bool create( void );
bool signalEvent( void );
void WaitFinish( bool Force = false );
bool setStatus( int );
uint8_t getExitCause( void ){ return m_bExitCause;};
void armStatusChanged(void);
};
#endif