admin
2022-09-09 60feedf43a35a9ca69d05095a01c5d1797b1bdc3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#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
 
typedef void (*CallbackFun)(int index, string code, list<TradeData> dataList, void* contex);
typedef void (*CallbackFun_Trade_Queue)(int index, string code, list<int> numList, void* contex);
 
 
class L2DataCapture: public BaseCapture
{
private:
    static OpenCLExcuter* openCLExcuter[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);
 
 
 
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 void setGPCode(int index, string code);
    //»ñÈ¡´úÂë
    static string getGPCode(int index);
 
 
 
};