LAPTOP-SNT8I5JK\Boounion
2025-09-09 4d64ab743909caa1860253e6054da8d249aad814
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
#pragma once
#include "CReadStep.h"
#include <functional>
 
 
#define READ_BUFFER_MAX        2048
 
#define ROK                0                    /* ¶ÁÊý¾ÝOK */
#define RTIMEOUT        -1                    /* ¶ÁÊý¾Ý³¬Ê± */
#define RERROR            -2                    /* ¶ÁÊý¾Ý³ö´í */
#define RCOMPLETE        1                    /* ¶ÁÊý¾ÝÁ÷³ÌÍê³É */
 
namespace SERVO {
    typedef std::function<int(void* pFrom, int code, const char* pszData, size_t size)> ONREAD;
 
    class CEqReadStep : public CReadStep
    {
    public:
        CEqReadStep();
        CEqReadStep(int dev, size_t readSize, ONREAD onReadBlock);
        virtual ~CEqReadStep();
 
    public:
        virtual void getAttributeVector(CAttributeVector& attrubutes);
        virtual int onReadData();
        virtual int onComplete();
        virtual int onTimeout();
 
    private:
        ONREAD m_onReadBlock;
        int m_nDataDev;
        size_t m_nReadSize;
    };
}