#pragma once
|
#include "ImgUtil.h"
|
#include "RecognitionManager.h"
|
#include <map>
|
#include "OpenCLExcuter.h"
|
#include "CaptureUtil.h"
|
#include "TradeQueueCapture.h"
|
#include "BaseCapture.h"
|
#define THS_FRAME_COUNT 8
|
|
struct L2TradeQueue
|
{
|
string sellTime;
|
string sellOnePrice;
|
string sellOneVolumn;
|
string buyTime;
|
string buyOnePrice;
|
string buyOneVolumn;
|
//³É½»¶ÓÁÐ
|
list<string> buyQueue;
|
};
|
|
typedef void (*CallbackFun)(int index, string code,long captureTime,long processTime, list<TradeData*> dataList, void* contex);
|
typedef void (*CallbackFun_Trade_Queue)(int index, string code, L2TradeQueue info, void* contex);
|
|
|
class L2DataCapture: public BaseCapture
|
{
|
private:
|
static OpenCLExcuter* openCLExcuter[THS_FRAME_COUNT];
|
static OpenCLExcuter* openCLExcuterQueue[THS_FRAME_COUNT];
|
static TradeQueueCapture* tradeQueueCapture[THS_FRAME_COUNT];
|
|
//ÊÇ·ñÔÚ½»Ò×ʱ¼ä²Å½ØÍ¼
|
static bool tradeTimeCapture;
|
|
static bool inited;
|
//ÊÇ·ñÕýÔÚÖ´ÐÐ
|
static bool running;
|
static bool runnings[THS_FRAME_COUNT];
|
static bool killRunnings[THS_FRAME_COUNT];
|
static clock_t latest_running_times[THS_FRAME_COUNT];
|
|
static string gpCodes[THS_FRAME_COUNT];
|
|
static CallbackFun data_callback;
|
|
static CallbackFun_Trade_Queue trade_queue_data_callback;
|
|
static void* context;
|
|
static void _run(int index);
|
|
static void _run_trade_queue(int index);
|
|
//ʶ±ðÂòÈë¶ÓÁÐ
|
static std::list<string> captureLevel2TradeQueueBuyData(OpenCLExcuter* openCLExcuter, cv::Mat& grayImg,int identify);
|
|
//»Ò¶ÈͼÏñ
|
static cv::Mat grayImg(OpenCLExcuter* openCLExcuter, cv::Mat& oImg);
|
|
|
public:
|
L2DataCapture();
|
|
//ÉèÖý»Ò×ʱ¼ä½ØÍ¼ÉÏ´«Êý¾Ý
|
static void setTradeTimeCapture(bool enable) {
|
tradeTimeCapture = enable;
|
}
|
|
//³õʼ»¯
|
void init(CallbackFun callback, CallbackFun_Trade_Queue trade_queue_callback, void* context);
|
|
void reCreateChannelRunner(int index);
|
|
void refreshHWND();
|
|
bool isRunning();
|
|
//¿ªÊ¼
|
void start(int index);
|
//½áÊø
|
void stop(int index);
|
//È«²¿¿ªÊ¼
|
void start();
|
//È«²¿½áÊø
|
void stop();
|
//È«²¿¿ªÊ¼
|
void startAll();
|
//È«²¿½áÊø
|
void stopAll();
|
|
bool isInited();
|
|
//²¶»ñlevel2µÄÅÌ¿ÚÊý¾Ý
|
static list<TradeData*> captureLevel2TradeData(HWND hwnd,int index) throw(int);
|
static list<TradeData*> captureLevel2TradeData(cv::Mat& oimg, int identify);
|
static list<TradeData*> captureLevel2TradeData(OpenCLExcuter *openCLExcuter, cv::Mat& oimg, int identify);
|
|
|
static L2TradeQueue captureLevel2TradeQueueData(HWND hwnd, int index);
|
static L2TradeQueue captureLevel2TradeQueueData(cv::Mat& oimg, cv::Rect buyQueueArea, int identify);
|
static L2TradeQueue captureLevel2TradeQueueData(OpenCLExcuter* openCLExcuter, cv::Mat& oimg, cv::Rect buyQueueArea, int identify);
|
// ÂòÂô¶ÓÁиÅÒªÐÅϢʶ±ð
|
static L2TradeQueue captureLevel2TradeQueueViewData(OpenCLExcuter* openCLExcuter, cv::Mat& grayImg, int identify);
|
|
|
|
//ÉèÖôúÂë
|
static void setGPCode(int index, string code);
|
//»ñÈ¡´úÂë
|
static string getGPCode(int index);
|
|
|
|
};
|