iointerface.cpp
Go to the documentation of this file.
1 
2 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions, and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions, and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the names of the copyright holders nor the names of their contributors
16 // may be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
26 // TORT (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.THE LAWS OF THE NETHERLANDS
28 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
29 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
30 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
31 //
32 
33 
34 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
35 // All rights reserved.
36 //
37 // Redistribution and use in source and binary forms, with or without modification,
38 // are permitted provided that the following conditions are met:
39 //
40 // 1. Redistributions of source code must retain the above copyright notice,
41 // this list of conditions, and the following disclaimer.
42 //
43 // 2. Redistributions in binary form must reproduce the above copyright notice,
44 // this list of conditions, and the following disclaimer in the documentation
45 // and/or other materials provided with the distribution.
46 //
47 // 3. Neither the names of the copyright holders nor the names of their contributors
48 // may be used to endorse or promote products derived from this software without
49 // specific prior written permission.
50 //
51 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
52 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
53 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
54 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
56 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
58 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
60 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
61 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
62 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
63 //
64 
65 #include <xstypes/xsthread.h>
66 #include "iointerface.h"
67 #include <errno.h>
68 #ifndef _WIN32
69  #include <unistd.h> // close
70  #include <sys/ioctl.h> // ioctl
71  #include <fcntl.h> // open, O_RDWR
72  #include <string.h> // strcpy
73  #include <sys/param.h>
74  #include <stdarg.h>
75 #else
76  #include <winbase.h>
77  #include <io.h>
78 #endif
79 
80 #ifndef _CRT_SECURE_NO_DEPRECATE
81  #define _CRT_SECURE_NO_DEPRECATE
82  #ifdef _WIN32
83  #pragma warning(disable:4996)
84  #endif
85 #endif
86 
94 // IOInterface functions
97 {
98  return XRV_INVALIDOPERATION;
99 }
102 {
103  (void) ms;
104  return XRV_INVALIDOPERATION;
105 }
108 {
109  (void) maxLength;
110  (void) data;
111  return XRV_INVALIDOPERATION;
112 }
114 void IoInterface::cancelIo(void) const
115 {
116 
117 }
118 
119 // IOInterfaceFile functions
122 {
123  (void) bdata;
124  return XRV_INVALIDOPERATION;
125 }
128 {
129  return XRV_INVALIDOPERATION;
130 }
133 {
134  (void) filename;
135  return XRV_INVALIDOPERATION;
136 }
139 {
140  (void) start;
141  (void) length;
142  return XRV_INVALIDOPERATION;
143 }
146 {
147  (void) needleV;
148  (void) pos;
149  return XRV_INVALIDOPERATION;
150 }
153 {
154  return 0;
155 }
158 {
159  (void) filename;
160  return XRV_INVALIDOPERATION;
161 }
164 {
165  return 0;
166 }
169 {
170  return 0;
171 }
174 {
175  (void) start;
176  (void) data;
177  return XRV_INVALIDOPERATION;
178 }
180 bool IoInterface::isReadOnly(void) const
181 {
182  return true;
183 }
185 XsResultValue IoInterface::open(const XsString& filename, bool createNew, bool readOnly)
186 {
187  (void) filename;
188  (void) createNew;
189  (void) readOnly;
190  return XRV_INVALIDOPERATION;
191 }
194 {
195  (void) pos;
196  return XRV_INVALIDOPERATION;
197 }
200 {
201  (void) pos;
202  return XRV_INVALIDOPERATION;
203 }
IoInterface::getName
virtual XsResultValue getName(XsString &filename) const
Retrieve the filename that was last successfully opened.
Definition: iointerface.cpp:157
IoInterface::closeAndDelete
virtual XsResultValue closeAndDelete(void)
Close the file and delete it.
Definition: iointerface.cpp:127
IoInterface::setReadPosition
virtual XsResultValue setReadPosition(XsFilePos pos)
Set the new absolute read position.
Definition: iointerface.cpp:193
XsByteArray
A list of uint8_t values.
io.h
xsthread.h
iointerface.h
data
data
IoInterface::PortOptions
PortOptions
Options for flow control and stopbits which must be used when opening a port.
Definition: iointerface.h:130
XsResultValue
XsResultValue
Xsens result values.
Definition: xsresultvalue.h:82
IoInterface::getFileSize
virtual XsFilePos getFileSize(void) const
Return the size of the file.
Definition: iointerface.cpp:152
uint32_t
unsigned int uint32_t
Definition: pstdint.h:485
XsPortInfo
Contains a descriptor for opening a communication port to an Xsens device.
Definition: xsportinfo.h:128
IoInterface::create
virtual XsResultValue create(const XsString &filename)
Create an empty file.
Definition: iointerface.cpp:132
IoInterface::getWritePosition
virtual XsFilePos getWritePosition(void) const
Return the current write position.
Definition: iointerface.cpp:168
IoInterface::setTimeout
virtual XsResultValue setTimeout(uint32_t ms)
Set the default timeout value to use in blocking operations.
Definition: iointerface.cpp:101
start
ROSCPP_DECL void start()
IoInterface::find
virtual XsResultValue find(const XsByteArray &needleV, XsFilePos &pos)
Find a string of bytes in the file.
Definition: iointerface.cpp:145
IoInterface::deleteData
virtual XsResultValue deleteData(XsFilePos start, XsFilePos length)
Delete the given data from the file.
Definition: iointerface.cpp:138
IoInterface::setWritePosition
virtual XsResultValue setWritePosition(XsFilePos pos=-1)
Set the new absolute write position.
Definition: iointerface.cpp:199
IoInterface::cancelIo
virtual void cancelIo(void) const
Cancel any pending io requests.
Definition: iointerface.cpp:114
IoInterface::waitForData
virtual XsResultValue waitForData(XsFilePos maxLength, XsByteArray &data)
Wait for data to arrive or a timeout to occur.
Definition: iointerface.cpp:107
length
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
IoInterface::insertData
virtual XsResultValue insertData(XsFilePos start, const XsByteArray &data)
Insert the given data into the file.
Definition: iointerface.cpp:173
XRV_INVALIDOPERATION
@ XRV_INVALIDOPERATION
265: Operation is invalid at this point
Definition: xsresultvalue.h:135
IoInterface::open
virtual XsResultValue open(const XsPortInfo &portInfo, XsFilePos readBufSize=XS_DEFAULT_READ_BUFFER_SIZE, XsFilePos writeBufSize=XS_DEFAULT_WRITE_BUFFER_SIZE, PortOptions options=PO_XsensDefaults)
Open a communication channel to the given port info.
Definition: iointerface.cpp:96
XsFilePos
int64_t XsFilePos
The type that is used for positioning inside a file.
Definition: xsfilepos.h:102
XsString
A 0-terminated managed string of characters.
IoInterface::appendData
virtual XsResultValue appendData(const XsByteArray &bdata)
Write data to the end of the file.
Definition: iointerface.cpp:121
IoInterface::getReadPosition
virtual XsFilePos getReadPosition(void) const
Return the current read position.
Definition: iointerface.cpp:163
IoInterface::isReadOnly
virtual bool isReadOnly(void) const
Return whether the file is read-only or not.
Definition: iointerface.cpp:180


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:20