Open Reality Reference Guide
 
Loading...
Searching...
No Matches
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
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
65enum FBParity {
69};
70
75};
81};
82
83
84FB_DEFINE_ENUM ( FBSDK_DLL, Parity );
85FB_DEFINE_ENUM ( FBSDK_DLL, RSType );
86FB_DEFINE_ENUM ( FBSDK_DLL, CommPortType );
87FB_DEFINE_COMPONENT ( FBSDK_DLL, CommPort );
88
90
94public:
95
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
139
144
145 FBPropertyParity Parity;
148 FBPropertyRSType RSType;
149 FBPropertyCommPortType CommPortType;
150
152};
153
155// Property list Comm Port
160
163{
164public:
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
202
204
208public:
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
Comm port class.
Definition fbio.h:92
FBPropertyInt ByteSize
Property: Byte size.
Definition fbio.h:146
bool WriteBlocking(void *lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesWritten=NULL, kULong pTimeOut=500)
Write data to comm port (blocking).
bool EmptyBuffer()
Empty comm port buffer.
bool ReadBlocking(void *lpBuffer, int nNumberOfBytesToRead, int *lpNumberOfBytesRead=NULL, kULong pTimeOut=500)
Read data from comm port (blocking).
bool Read(void *lpBuffer, int nNumberOfBytesToRead, int *lpNumberOfBytesRead=NULL)
Read data from comm port (non-blocking).
FBPropertyInt PortNumber
Property: Port number.
Definition fbio.h:140
FBPropertyParity Parity
Property: Parity.
Definition fbio.h:145
FBPropertyCommPortType CommPortType
Property: Comm type (physical, virtual or internal)?
Definition fbio.h:149
bool Write(void *lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesWritten=NULL)
Write data to comm port (non-blocking).
FBPropertyRSType RSType
Property: Communications protocol (RS232 or RS422)?
Definition fbio.h:148
FBPropertyInt StopBits
Property: Stop bits.
Definition fbio.h:147
FBCommPort()
Constructor.
FBPropertyString OwnerName
Property: Owner name.
Definition fbio.h:141
FBPropertyBool Active
Property: Is comm port active?
Definition fbio.h:151
FBPropertyBool UseHardwareFC
Property: Use hardware flow control?
Definition fbio.h:143
FBPropertyInt BaudRate
Property: Baud rate.
Definition fbio.h:142
MotionBuilder SDK base class.
PropertyList: CommPort.
Definition fbio.h:163
virtual void RemoveAt(int pIndex)
Remove the comm port at pIndex.
virtual int operator[](int pIndex)
Get the comm port at pIndex.
virtual int Add(int pItem)
Add a commport to the property list.
virtual int GetCount()
Get the number of comm ports recognized.
virtual int Remove(int pItem)
Remove Comm Port pItem from property list.
Property class: const char * (String).
TCP/IP class.
Definition fbio.h:206
int Select(int pSocket, bool pTestRead, bool pTestWrite, bool pTestError, kULong pTimeOutMilisecond=0)
Test socket status.
bool WriteBlocking(int pSocket, void *lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesToWrite=NULL, kULong pTimeOut=500)
Write data to a network socket (blocking)
FBTCPIP()
Constructor.
bool Bind(int &pSocket, kULong pAddr, int pPort=0)
Bind a socket to an address.
bool ReadDatagram(int pSocket, void *lpBuffer, int nNumberOfBytesToRead, int *lpNumberOfBytesRead=NULL, kULong *pAddr=NULL, unsigned short *pPort=NULL)
Read datagram from a network socket.
bool CreateSocket(int &pSocket, FBTCPIPSocketType pType, const char *pProtocol="ip", bool pNonBlocking=true)
Create a network socket.
bool WriteDatagram(int pSocket, void *lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesToWrite, kULong pAddr, unsigned short pPort)
Write a datagram to a network socket.
bool Read(int pSocket, void *lpBuffer, int nNumberOfBytesToRead, int *lpNumberOfBytesRead=NULL)
Read data from a network socket (non-blocking)
bool ReadBlocking(int pSocket, void *lpBuffer, int nNumberOfBytesToRead, int *lpNumberOfBytesRead=NULL, kULong pTimeOut=500)
Read data from a network socket (blocking).
int Accept(int pSocket, kULong *pOutAddr=NULL)
Accepts incoming port access.
bool Write(int pSocket, void *lpBuffer, int nNumberOfBytesToWrite, int *lpNumberOfBytesWritten=NULL)
Write data to a network socket (non-blocking)
bool CloseSocket(int &pSocket)
Close a network socket.
bool Connect(int &pSocket, char *pAddr, int pPort)
Connect to address pAddr, port pPort with socket pSocket.
int Listen(int pSocket, int pBackLog=1)
Place socket in mode to receive data.
Basic class definitions.
#define __FBClassDeclare(Name, Parent)
For internal use only.
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
FBParity
Parity modes.
Definition fbio.h:65
@ kFBParityOdd
Odd parity.
Definition fbio.h:67
@ kFBParityEven
Even parity.
Definition fbio.h:68
@ kFBParityNone
No parity.
Definition fbio.h:66
#define FBCOMMPORT_DEFAULT_BLOCKING_TIMEOUT
FBCOMMPORT_DEFAULT_BLOCKING_TIMEOUT.
Definition fbio.h:62
FBCommPortType
Communication port type.
Definition fbio.h:77
@ kFBPhysical
Physical.
Definition fbio.h:78
@ kFBInternal
Internal.
Definition fbio.h:80
@ kFBVirtual
Virtual.
Definition fbio.h:79
class K_DLLIMPORT FBPropertyBaseList< int > FBPropertyBaseListInt
typedef class FBSDK_DLL FBPropertyBaseList< int > FBPropertyBaseListInt
Definition fbio.h:159
FBRSType
RS type for serial port.
Definition fbio.h:72
@ kFBRS232
RS-232 serial protocol.
Definition fbio.h:73
@ kFBRS422
RS-422 serial protocol.
Definition fbio.h:74
#define FBTCPIP_DEFAULT_BLOCKING_TIMEOUT
FBTCPIP_DEFAULT_BLOCKING_TIMEOUT define.
Definition fbio.h:194
FBTCPIPSocketType
Types of TCP/IP Sockets.
Definition fbio.h:197
@ kFBTCPIP_RAW
Raw data (TCP).
Definition fbio.h:200
@ kFBTCPIP_DGRAM
Datagrams (UDP).
Definition fbio.h:199
@ kFBTCPIP_Stream
Streaming data (TCP).
Definition fbio.h:198
class K_DLLIMPORT FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
class K_DLLIMPORT FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
#define FB_DEFINE_COMPONENT(DllTag, Type)
Define a component and give it the ability to be a property.
#define FB_DEFINE_ENUM(DllTag, Type)
Define an enum and give it the ability to be a property.
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition fbtypes.h:68