Skip to content

Commit 5a8bc43

Browse files
committed
Initial commit of WinLNP-USB
1 parent 65132e0 commit 5a8bc43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+9133
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# WinLNP-USB
22
LNP over USB for Windows devices
3+
4+
[Original Website](http://math.haifa.ac.il/robotics/student_projects.html)
5+
* [Archived Webste](https://web.archive.org/web/20140828165525/http://math.haifa.ac.il/robotics/student_projects.html)

SRC/ILGXHndl.h

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
//## begin module%3902D5B8017D.cm preserve=no
2+
// %X% %Q% %Z% %W%
3+
//## end module%3902D5B8017D.cm
4+
5+
//## begin module%3902D5B8017D.cp preserve=no
6+
//## end module%3902D5B8017D.cp
7+
8+
//## Module: ILGXHandler%3902D5B8017D; Package specification
9+
//## Subsystem: Host%3902D5720367
10+
//## Source file: c:\projects\legos\legos-0.2.3\winlnp\src\ILGXHndl.h
11+
12+
#ifndef ILGXHndl_h
13+
#define ILGXHndl_h 1
14+
15+
//## begin module%3902D5B8017D.additionalIncludes preserve=no
16+
//## end module%3902D5B8017D.additionalIncludes
17+
18+
//## begin module%3902D5B8017D.includes preserve=yes
19+
//## end module%3902D5B8017D.includes
20+
21+
// LGXDefs
22+
#include "LGXDefs.h"
23+
// LGXLNPHelper
24+
#include "LGXLNPHl.h"
25+
//## begin module%3902D5B8017D.declarations preserve=no
26+
//## end module%3902D5B8017D.declarations
27+
28+
//## begin module%3902D5B8017D.additionalDeclarations preserve=yes
29+
//## end module%3902D5B8017D.additionalDeclarations
30+
31+
32+
//## Class: ILGXHandler%3902D01003A1; Abstract
33+
//## Category: LGX Port%3902D1FE0103
34+
//## Subsystem: Host%3902D5720367
35+
//## Persistence: Transient
36+
//## Cardinality/Multiplicity: n
37+
38+
//## Uses: <unnamed>%39047816011D;CLGXLNPFrame { -> }
39+
40+
class ILGXHandler
41+
{
42+
//## begin ILGXHandler%3902D01003A1.initialDeclarations preserve=yes
43+
//## end ILGXHandler%3902D01003A1.initialDeclarations
44+
45+
public:
46+
//## Destructor (generated)
47+
virtual ~ILGXHandler();
48+
49+
50+
//## Other Operations (specified)
51+
//## Operation: TreatData%956487425
52+
virtual bool TreatData (CLGXLNPFrame *pFrame) = 0;
53+
54+
//## Operation: GetSessionID%958821002
55+
virtual TPORTID GetSessionID () = 0;
56+
57+
// Additional Public Declarations
58+
//## begin ILGXHandler%3902D01003A1.public preserve=yes
59+
//## end ILGXHandler%3902D01003A1.public
60+
61+
protected:
62+
// Additional Protected Declarations
63+
//## begin ILGXHandler%3902D01003A1.protected preserve=yes
64+
//## end ILGXHandler%3902D01003A1.protected
65+
66+
private:
67+
// Additional Private Declarations
68+
//## begin ILGXHandler%3902D01003A1.private preserve=yes
69+
//## end ILGXHandler%3902D01003A1.private
70+
71+
private: //## implementation
72+
// Additional Implementation Declarations
73+
//## begin ILGXHandler%3902D01003A1.implementation preserve=yes
74+
//## end ILGXHandler%3902D01003A1.implementation
75+
76+
};
77+
78+
//## begin ILGXHandler%3902D01003A1.postscript preserve=yes
79+
//## end ILGXHandler%3902D01003A1.postscript
80+
81+
// Class ILGXHandler
82+
83+
//## begin module%3902D5B8017D.epilog preserve=yes
84+
//## end module%3902D5B8017D.epilog
85+
86+
87+
#endif

SRC/LGXDefs.h

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//## begin module%3902EFB90283.cm preserve=no
2+
// %X% %Q% %Z% %W%
3+
//## end module%3902EFB90283.cm
4+
5+
//## begin module%3902EFB90283.cp preserve=no
6+
//## end module%3902EFB90283.cp
7+
8+
//## Module: LGXDefs%3902EFB90283; Package specification
9+
//## Subsystem: Definitions%3902EF95039A
10+
//## Source file: c:\projects\legos\legos-0.2.3\legox\src\LGXDefs.h
11+
12+
#ifndef LGXDefs_h
13+
#define LGXDefs_h 1
14+
15+
//## begin module%3902EFB90283.additionalIncludes preserve=no
16+
//## end module%3902EFB90283.additionalIncludes
17+
18+
//## begin module%3902EFB90283.includes preserve=yes
19+
//## end module%3902EFB90283.includes
20+
21+
//## begin module%3902EFB90283.declarations preserve=no
22+
//## end module%3902EFB90283.declarations
23+
24+
//## begin module%3902EFB90283.additionalDeclarations preserve=yes
25+
//## end module%3902EFB90283.additionalDeclarations
26+
27+
28+
//## Class: THOSTID%3902D80001D7
29+
//## Category: Definitions%3902D7A30309
30+
//## Subsystem: Definitions%3902EF95039A
31+
//## Persistence: Transient
32+
//## Cardinality/Multiplicity: n
33+
34+
typedef unsigned char THOSTID;
35+
36+
//## begin THOSTID%3902D80001D7.postscript preserve=yes
37+
//## end THOSTID%3902D80001D7.postscript
38+
39+
//## Class: TPORTID%3902D8120237
40+
//## Category: Definitions%3902D7A30309
41+
//## Subsystem: Definitions%3902EF95039A
42+
//## Persistence: Transient
43+
//## Cardinality/Multiplicity: n
44+
45+
typedef unsigned char TPORTID;
46+
47+
//## begin TPORTID%3902D8120237.postscript preserve=yes
48+
//## end TPORTID%3902D8120237.postscript
49+
50+
//## Class: TPROGRAMID%3902EF7C0394
51+
//## Category: Definitions%3902D7A30309
52+
//## Subsystem: Definitions%3902EF95039A
53+
//## Persistence: Transient
54+
//## Cardinality/Multiplicity: n
55+
56+
typedef unsigned char TPROGRAMID;
57+
58+
//## begin TPROGRAMID%3902EF7C0394.postscript preserve=yes
59+
//## end TPROGRAMID%3902EF7C0394.postscript
60+
61+
//## begin module%3902EFB90283.epilog preserve=yes
62+
//## end module%3902EFB90283.epilog
63+
64+
65+
#endif

SRC/LGXHost.cpp

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
//## begin module%3902D5C401FC.cm preserve=no
2+
// %X% %Q% %Z% %W%
3+
//## end module%3902D5C401FC.cm
4+
5+
//## begin module%3902D5C401FC.cp preserve=no
6+
//## end module%3902D5C401FC.cp
7+
8+
//## Module: LGXHost%3902D5C401FC; Package body
9+
//## Subsystem: Host%3902D5720367
10+
//## Source file: c:\projects\legos\legos-0.2.3\winlnp\src\LGXHost.cpp
11+
12+
//## begin module%3902D5C401FC.additionalIncludes preserve=no
13+
#include "stdafx.h"
14+
//## end module%3902D5C401FC.additionalIncludes
15+
16+
//## begin module%3902D5C401FC.includes preserve=yes
17+
//## end module%3902D5C401FC.includes
18+
19+
// LGXPort
20+
#include "LGXPort.h"
21+
// LGXHost
22+
#include "LGXHost.h"
23+
24+
25+
//## begin module%3902D5C401FC.declarations preserve=no
26+
//## end module%3902D5C401FC.declarations
27+
28+
//## begin module%3902D5C401FC.additionalDeclarations preserve=yes
29+
#define NB_PROGRAMS 8
30+
//## end module%3902D5C401FC.additionalDeclarations
31+
32+
33+
// Class CLGXHost
34+
35+
36+
37+
38+
39+
CLGXHost::CLGXHost()
40+
//## begin CLGXHost::CLGXHost%.hasinit preserve=no
41+
: m_nPCHostID(-1), m_nHostID(-1)
42+
//## end CLGXHost::CLGXHost%.hasinit
43+
//## begin CLGXHost::CLGXHost%.initialization preserve=yes
44+
//## end CLGXHost::CLGXHost%.initialization
45+
{
46+
//## begin CLGXHost::CLGXHost%.body preserve=yes
47+
//## end CLGXHost::CLGXHost%.body
48+
}
49+
50+
51+
CLGXHost::~CLGXHost()
52+
{
53+
//## begin CLGXHost::~CLGXHost%.body preserve=yes
54+
TPortsMap::iterator iter = m_PortsMap.begin();
55+
56+
for (; iter != m_PortsMap.end(); iter++)
57+
{
58+
CLGXPort *pPort = (*iter).second;
59+
delete pPort;
60+
}
61+
62+
m_PortsMap.clear();
63+
//## end CLGXHost::~CLGXHost%.body
64+
}
65+
66+
67+
68+
//## Other Operations (implementation)
69+
bool CLGXHost::Init (THOSTID nPCHostID, THOSTID nHostID, CLGXTowerMgr *pTowerMgr)
70+
{
71+
//## begin CLGXHost::Init%956487414.body preserve=yes
72+
m_nPCHostID = nPCHostID;
73+
m_nHostID = nHostID;
74+
m_pTowerMgr = pTowerMgr;
75+
return true;
76+
//## end CLGXHost::Init%956487414.body
77+
}
78+
79+
CLGXPort * CLGXHost::GetPort (TPORTID nPortID)
80+
{
81+
//## begin CLGXHost::GetPort%956487415.body preserve=yes
82+
CLGXPort *pPort = NULL;
83+
84+
TPortsMap::iterator iter = m_PortsMap.find(nPortID);
85+
86+
if (iter != m_PortsMap.end())
87+
{
88+
pPort = (*iter).second;
89+
}
90+
else
91+
{
92+
pPort = new CLGXPort;
93+
if (pPort != NULL)
94+
{
95+
pPort->Init(m_nPCHostID, m_nHostID, nPortID, m_pTowerMgr);
96+
m_PortsMap.insert(TPortsMap::value_type(nPortID, pPort));
97+
}
98+
}
99+
100+
return pPort;
101+
//## end CLGXHost::GetPort%956487415.body
102+
}
103+
104+
bool CLGXHost::Dispatch (CLGXLNPAddressedFrame *pFrame)
105+
{
106+
//## begin CLGXHost::Dispatch%956487418.body preserve=yes
107+
bool bResult = true;
108+
109+
TPORTID nPortID = pFrame->GetDestPortID();
110+
111+
TPortsMap::iterator iter = m_PortsMap.find(nPortID);
112+
113+
if (iter != m_PortsMap.end())
114+
{
115+
CLGXPort *pPort = (*iter).second;
116+
if (pPort != NULL)
117+
{
118+
bResult = pPort->Dispatch(pFrame);
119+
}
120+
}
121+
return bResult;
122+
//## end CLGXHost::Dispatch%956487418.body
123+
}
124+
125+
THOSTID CLGXHost::GetHostID ()
126+
{
127+
//## begin CLGXHost::GetHostID%956487419.body preserve=yes
128+
return m_nHostID;
129+
//## end CLGXHost::GetHostID%956487419.body
130+
}
131+
132+
// Additional Declarations
133+
//## begin CLGXHost%3902C57E00D9.declarations preserve=yes
134+
//## end CLGXHost%3902C57E00D9.declarations
135+
136+
//## begin module%3902D5C401FC.epilog preserve=yes
137+
//## end module%3902D5C401FC.epilog
138+
139+
140+
// Detached code regions:
141+
// WARNING: this code will be lost if code is regenerated.
142+
#if 0
143+
//## begin CLGXHost::GetProgram%956487417.body preserve=no
144+
if (nProgramID >= NB_PROGRAMS)
145+
{
146+
return NULL;
147+
}
148+
149+
return &m_aPrograms[nProgramID];
150+
//## end CLGXHost::GetProgram%956487417.body
151+
152+
#endif

0 commit comments

Comments
 (0)