fbsdk/fbio.h Source File

fbio.h
Go to the documentation of this file.
1 #ifndef __FBIO_H__
2 #define __FBIO_H__
3 /**************************************************************************
4  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5  All Rights Reserved.
6 
7  The coded instructions, statements, computer programs, and/or related
8  material (collectively the "Data") in these files contain unpublished
9  information proprietary to Autodesk, Inc. and/or its licensors, which is
10  protected by Canada and United States of America federal copyright law
11  and by international treaties.
12 
13  The Data may not be disclosed or distributed to third parties, in whole
14  or in part, without the prior written consent of Autodesk, Inc.
15  ("Autodesk").
16 
17  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24  FREE.
25 
26  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
44 #include <kaydaradef.h>
45 #ifndef FBSDK_DLL
46 
49  #define FBSDK_DLL K_DLLIMPORT
50 #endif
51 
52 #include <fbsdk/fbcomponent.h>
53 
54 #ifdef FBSDKUseNamespace
55  namespace FBSDKNamespace {
56 #endif
57 
59 // FBCommPort
62 #define FBCOMMPORT_DEFAULT_BLOCKING_TIMEOUT 500 // Millisecs
63 
65 enum FBParity {
69 };
70 
72 enum FBRSType {
75 };
81 };
82 
83 
86 FB_DEFINE_ENUM ( FBSDK_DLL, CommPortType );
88 
90 
94 public:
95 
97  FBCommPort();
98 
105  bool Read( void* lpBuffer, int nNumberOfBytesToRead, int* lpNumberOfBytesRead=NULL );
106 
115  bool ReadBlocking( void* lpBuffer, int nNumberOfBytesToRead, int* lpNumberOfBytesRead=NULL, kULong pTimeOut = FBCOMMPORT_DEFAULT_BLOCKING_TIMEOUT);
116 
123  bool Write( void* lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesWritten=NULL );
124 
133  bool WriteBlocking( void* lpBuffer, int nNumberOfBytesToWrite, int* lpNumberOfBytesWritten=NULL, kULong pTimeOut = FBCOMMPORT_DEFAULT_BLOCKING_TIMEOUT);
134 
138  bool EmptyBuffer();
139 
144 
150 
152 };
153 
155 // Property list Comm Port
160 
163 {
164 public:
169  virtual int Add ( int pItem );
174  virtual int Remove ( int pItem );
178  virtual void RemoveAt( int pIndex );
183  virtual int operator[](int pIndex);
187  virtual int GetCount();
188 };
189 
191 // FBTCPIP
194 #define FBTCPIP_DEFAULT_BLOCKING_TIMEOUT 500 // Millisecs
195 
201 };
202 
203 __FB_FORWARD( FBTCPIP );
204 
206 class FBSDK_DLL FBTCPIP : public FBComponent {
208 public:
210  FBTCPIP();
211 
219  bool Read( int pSocket, void* lpBuffer, int nNumberOfBytesToRead, int* lpNumberOfBytesRead=NULL );
220 
230  bool ReadBlocking( int pSocket, void* lpBuffer, int nNumberOfBytesToRead, int* lpNumberOfBytesRead=NULL, kULong pTimeOut = FBTCPIP_DEFAULT_BLOCKING_TIMEOUT );
231 
241  bool ReadDatagram( int pSocket, void* lpBuffer, int nNumberOfBytesToRead, int* lpNumberOfBytesRead=NULL, kULong* pAddr=NULL, unsigned short *pPort=NULL );
242 
250  bool Write( int pSocket, void* lpBuffer, int nNumberOfBytesToWrite, int* lpNumberOfBytesWritten=NULL );
251 
261  bool WriteBlocking( int pSocket, void* lpBuffer, int nNumberOfBytesToWrite, int* lpNumberOfBytesToWrite=NULL, kULong pTimeOut = FBTCPIP_DEFAULT_BLOCKING_TIMEOUT );
262 
272  bool WriteDatagram( int pSocket, void* lpBuffer, int nNumberOfBytesToWrite, int* lpNumberOfBytesToWrite, kULong pAddr, unsigned short pPort );
273 
281  bool CreateSocket( int &pSocket, FBTCPIPSocketType pType, const char *pProtocol = "ip", bool pNonBlocking=true );
282 
289  bool Bind( int &pSocket, kULong pAddr /*=INADDR_ANY*/, int pPort=0 );
290 
297  bool Connect( int &pSocket, char *pAddr, int pPort );
298 
303  bool CloseSocket( int &pSocket );
304 
310  int Listen( int pSocket, int pBackLog=1 );
311 
317  int Accept( int pSocket, kULong *pOutAddr=NULL );
318 
327  int Select( int pSocket, bool pTestRead, bool pTestWrite, bool pTestError, kULong pTimeOutMilisecond=0 );
328 };
329 
330 #ifdef FBSDKUseNamespace
331  }
332 #endif
333 
334 
335 #endif
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:132
FBPropertyString OwnerName
Property: Owner name.
Definition: fbio.h:141
class FBPropertyBaseEnum< enum FBCommPortType > FBPropertyCommPortType
Definition: fbio.h:86
int
Definition: code.h:72
Comm port class.
Definition: fbio.h:92
#define FBCOMMPORT_DEFAULT_BLOCKING_TIMEOUT
FBCOMMPORT_DEFAULT_BLOCKING_TIMEOUT.
Definition: fbio.h:62
Physical.
Definition: fbio.h:78
#define FB_DEFINE_COMPONENT(DllTag, Type)
Define a component and give it the ability to be a property.
Definition: fbproperties.h:139
TCP/IP class.
Definition: fbio.h:206
class FBPropertyBaseList< int > FBPropertyBaseListInt
typedef class FBSDK_DLL FBPropertyBaseList< int="" /> FBPropertyBaseListInt
Definition: fbio.h:159
#define NULL
Definition: kaydara.h:169
Odd parity.
Definition: fbio.h:67
FBPropertyBool Active
Property: Is comm port active?
Definition: fbio.h:151
class FBPropertyBaseEnum< enum FBRSType > FBPropertyRSType
Definition: fbio.h:85
FBPropertyInt BaudRate
Property: Baud rate.
Definition: fbio.h:142
FBPropertyBool UseHardwareFC
Property: Use hardware flow control?
Definition: fbio.h:143
Property class: const char * (String).
#define FB_DEFINE_ENUM(DllTag, Type)
Define an enum and give it the ability to be a property.
Definition: fbproperties.h:148
MotionBuilder SDK base class.
Definition: fbcomponent.h:668
Virtual.
Definition: fbio.h:79
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbio.h:49
FBTCPIPSocketType
Types of TCP/IP Sockets.
Definition: fbio.h:197
class FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
RS-422 serial protocol.
Definition: fbio.h:74
class FBPropertyBaseEnum< enum FBParity > FBPropertyParity
Definition: fbio.h:84
FBPropertyInt PortNumber
Property: Port number.
Definition: fbio.h:140
Definition: Python-ast.h:18
PropertyList: CommPort.
Definition: fbio.h:162
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
Internal.
Definition: fbio.h:80
Streaming data (TCP).
Definition: fbio.h:198
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
Basic class definitions.
Datagrams (UDP).
Definition: fbio.h:199
FBPropertyRSType RSType
Property: Communications protocol (RS232 or RS422)?
Definition: fbio.h:148
FBRSType
RS type for serial port.
Definition: fbio.h:72
FBCommPortType
Communication port type.
Definition: fbio.h:77
class FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
FBPropertyCommPortType CommPortType
Property: Comm type (physical, virtual or internal)?
Definition: fbio.h:149
FBPropertyParity Parity
Property: Parity.
Definition: fbio.h:145
Raw data (TCP).
Definition: fbio.h:200
#define FBTCPIP_DEFAULT_BLOCKING_TIMEOUT
FBTCPIP_DEFAULT_BLOCKING_TIMEOUT define.
Definition: fbio.h:194
No parity.
Definition: fbio.h:66
FBPropertyInt ByteSize
Property: Byte size.
Definition: fbio.h:146
FBPropertyInt StopBits
Property: Stop bits.
Definition: fbio.h:147
RS-232 serial protocol.
Definition: fbio.h:73
FBParity
Parity modes.
Definition: fbio.h:65
Even parity.
Definition: fbio.h:68