admin
2023-03-07 8b06b1cbf112d55307ea8a6efe711db4e7506d89
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#pragma once
#include <string>
#include <iostream>
#include <list>
#include "ImgUtil.h"
#include "RecognitionManager.h"
#include "THSActionUtil.h"
#include "BaseCapture.h"
 
enum TradeType
{
    TRADE_TYPE_BUY,
    TRADE_TYPE_SELL,
};
 
 
struct TradeSuccessData
{
 
    string code;
    string time;
    string num;
    string money;
    string price;
    string trade_num;
    TradeType type;
    //¸¨Öú¹¦ÄÜ
    int index;
};
 
 
struct TradeDelegateData
{
    string code;
    string time;
    string apply_time;//É걨ʱ¼ä
    string num;
    string price;
    string trade_price;
    string trade_num;
    TradeType type;
    //¸¨Öú¹¦ÄÜ
    int index;
};
 
typedef void (*CallbackFun_Trade_Success)(list<TradeSuccessData> dataList, void* contex);
 
typedef void (*CallbackFun_Trade_Delegate)(list<TradeDelegateData> dataList,string avaiableMoney, void* contex);
 
 
class TradeListCapture
{
private:
    //½»Ò×ʱ¶Îʶ±ð
    static bool tradeTimeCapture_success;
    static bool tradeTimeCapture_delegate;
    static OpenCLExcuter* openCLExcuterDelegate;
    static OpenCLExcuter* openCLExcuterSuccess;
    static RecognitionManager* recognitionManager;
    static bool inited;
 
    //ÊÇ·ñÕýÔÚÖ´ÐÐ
    static bool running_s;
    static bool running_d;
    static bool kill_d;
    static bool kill_s;
    static CallbackFun_Trade_Success data_callback_success;
    static CallbackFun_Trade_Delegate data_callback_delegate;
    static void* context;
    static void _run_s();
    static void _run_d();
 
    //ίÍд°Ìå
    static HWND trade_delegate_win;
    //³É¹¦´°Ìå
    static HWND trade_success_win;
    //¾«¼ò°æÎ¯Íд°Ìå
    static HWND trade_simple_delegate_win;
 
    
 
 
public:
 
    static void setTradeTimeCapture_delegate(bool enable) {
        tradeTimeCapture_delegate = enable;
    }
 
    static void setTradeTimeCapture_success(bool enable) {
        tradeTimeCapture_success = enable;
    }
 
    void init(CallbackFun_Trade_Success callback_s, CallbackFun_Trade_Delegate callback_d, void* context);
 
    //Ñ¡Öо«¼ò°æ½»Ò×½çÃæÖеĵ±ÈÕίÍа´Å¥
    void selectTradeSimpleDelegate(MatOcrFun matMcrFun);
 
    //Ñ¡Öн»Ò×½çÃæÖеĵ±Èճɽ»°´Å¥
    void selectTradeSuccess(MatOcrFun matMcrFun);
 
    //ÖØÐ´´½¨Ïß³Ì
    void reCreateTradeSuccessRunning();
    void reCreateTradeDelegateRunning();
 
    void refreshTradeDelegateHWND();
    void refreshTradeSimpleDelegateHWND();
    void refreshTradeSuccessHWND();
    static cv::Mat grayImgs(cv::Mat img,OpenCLExcuter* openCLExcuter);
 
    //½»Ò׳ɹ¦
    static list<TradeSuccessData> captureTradeSuccessInfo(cv::Mat img);
 
    static list<TradeSuccessData> captureTradeSuccessInfo();
 
 
    //רҵ°æ½»Ò×ίÍÐ
    static list<TradeDelegateData> captureTradeDelegateInfo(cv::Mat img);
 
    static list<TradeDelegateData> captureTradeDelegateInfo();
 
    // »ñÈ¡½»Ò×Ò³ÃæµÄ×ó²à²Ëµ¥HWND
    static HWND getSimpleTradeLeftMenu(HWND tradeWin);
 
    //¾«¼ò°æ½»Ò×ίÍÐ
    static list<TradeDelegateData> captureSimpleTradeDelegateInfo(cv::Mat img);
 
    static list<TradeDelegateData> captureSimpleTradeDelegateInfo();
 
    //»ñÈ¡ÕË»§µÄÊ£Óà×ʽð
    static string getAvaiableMoney();
    // »ñÈ¡¾«¼ò°æµÄ¿ÉÓÃÓà¶î
    static string getSimpleAvaiableMoney();
    
 
    bool isInited();
 
    bool isRunningTradeSuccess();
 
    bool isRunningTradeDelegate();
    //¿ªÊ¼
    void startTradeSuccess();
    //½áÊø
    void stopTradeSuccess();
 
    //¿ªÊ¼
    void startTradeDelegate();
    //½áÊø
    void stopTradeDelegate();
};