LAPTOP-SNT8I5JK\Boounion
2025-03-19 f631abac11b6d7c8091ed28b838a5d1f50e24825
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
#include "stdafx.h"
#include "CLoadPort.h"
 
 
namespace SERVO {
    CLoadPort::CLoadPort() : CEquipment()
    {
 
    }
 
    CLoadPort::~CLoadPort()
    {
 
    }
 
    const char* CLoadPort::getClassName()
    {
        static char* pszName = "CLoadPort";
        return pszName;
    }
 
    void CLoadPort::init()
    {
        CEquipment::init();
    }
 
    void CLoadPort::term()
    {
        CEquipment::term();
    }
 
    // ±ØÐëҪʵÏÖµÄÐ麯Êý£¬Ôڴ˳õʼ»¯PinÁбí
    void CLoadPort::initPins()
    {
        // ¼ÓÈëPin³õʼ»¯´úÂë
        LOGI("<CLoadPort>initPins");
        addPin(SERVO::PinType::INPUT, _T("In"));
        addPin(SERVO::PinType::OUTPUT, _T("Out"));
    }
 
    void CLoadPort::onTimer(UINT nTimerid)
    {
        CEquipment::onTimer(nTimerid);
    }
 
    void CLoadPort::serialize(CArchive& ar)
    {
        CEquipment::serialize(ar);
    }
 
    void CLoadPort::getAttributeVector(CAttributeVector& attrubutes)
    {
        __super::getAttributeVector(attrubutes);
 
        for (auto item : m_inputPins) {
            attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
                std::to_string((int)item->getType()).c_str(), ""));
        }
 
        for (auto item : m_outputPins) {
            attrubutes.addAttribute(new CAttribute(item->getName().c_str(),
                std::to_string((int)item->getType()).c_str(), ""));
        }
    }
 
    void CLoadPort::outputPanel()
    {
        CPin* pOutPin = getPin("Out");
 
        CIntent intent;
        intent.setCode(1);
        intent.setMsg("Hello");
        pOutPin->sendIntent(&intent);
    }
}