~jil26/fabathome-model1/FabInterpreter

« back to all changes in this revision

Viewing changes to software/projects/FabStudio v0/Fab@Home Studio/SegmentPacket.h

  • Committer: jil26
  • Date: 2010-03-17 09:27:31 UTC
  • Revision ID: svn-v4:02918aed-e80b-b844-b231-15c4a9332dc2:trunk:7
Added FabStudio v0 to the repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*License Notification
 
2
Fab@Home operates under the BSD Open Source License
 
3
 
 
4
Copyright (c) 2006, Hod Lipson and Evan Malone (evan.malone@cornell.edu) All rights reserved. 
 
5
 
 
6
Redistribution and use in source and binary forms, with or without modification, 
 
7
are permitted provided that the following conditions are met: 
 
8
 
 
9
Redistributions of source code must retain the above copyright notice, 
 
10
this list of conditions and the following disclaimer. 
 
11
Redistributions in binary form must reproduce the above copyright notice, 
 
12
this list of conditions and the following disclaimer in the documentation and/or 
 
13
other materials provided with the distribution. 
 
14
Neither the name of the Fab@Home Project nor the names of its contributors may be 
 
15
used to endorse or promote products derived from this software without specific 
 
16
prior written permission. 
 
17
 
 
18
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 
19
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
20
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 
21
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 
22
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
 
23
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 
24
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
25
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 
26
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 
27
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
28
*/
 
29
 
 
30
#pragma once
 
31
#include "afx.h"
 
32
#include "segment.h"
 
33
 
 
34
struct SEGMENT_TX_DATA
 
35
{
 
36
  BYTE_LONG d[AXES_CNT];  //proportional to directional cosines; signed
 
37
  BYTE_DWORD s;    // inversely proportional to speed, unsigned  
 
38
  BYTE_DWORD L;    // length (~ dist/s), unsigned
 
39
};
 
40
 
 
41
class CSegmentPacket :
 
42
        public CPacket
 
43
{
 
44
        DECLARE_DYNAMIC(CSegmentPacket)
 
45
public:
 
46
        CSegmentPacket(void);
 
47
        ~CSegmentPacket(void);
 
48
 
 
49
public:
 
50
        bool InitPacket(CSegment &seg);
 
51
protected:
 
52
        bool PacketToStream(BYTE *buf, unsigned int *size); //convert the packet into a stream of bytes
 
53
        bool StreamToPacket(BYTE *buf, unsigned int *size);     //convert a stream of bytes into a packet
 
54
protected:
 
55
        SEGMENT_TX_DATA m_segment;
 
56
};