ISSerialPort.h
Go to the documentation of this file.
1 /*
2 MIT LICENSE
3 
4 Copyright (c) 2014-2021 Inertial Sense, Inc. - http://inertialsense.com
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
7 
8 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 */
12 
13 #ifndef __ISSERIALPORT_H__
14 #define __ISSERIALPORT_H__
15 
16 #include <inttypes.h>
17 #include <string>
18 #include <vector>
19 
20 #include "ISStream.h"
21 #include "serialPortPlatform.h"
22 
23 using namespace std;
24 
25 class cISSerialPort : public cISStream
26 {
27 private:
28  cISSerialPort(const cISSerialPort& copy); // disable copy constructor
29 
31  int m_timeout;
32  bool m_blocking;
33 
34 public:
39  cISSerialPort(serial_port_t* serial = NULL);
40 
44  virtual ~cISSerialPort();
45 
54  bool Open(const std::string& portName, int baudRate = BAUDRATE_921600, int timeout = 0, bool blocking = false);
55 
60  bool IsOpen() { return (serialPortIsOpen(&m_serial) != 0); }
61 
66  int Close() OVERRIDE;
67 
74  int Read(void* data, int dataLength) OVERRIDE;
75 
82  int Write(const void* data, int dataLength) OVERRIDE;
83 
88  static void GetComPorts(vector<string>& ports);
89 };
90 
91 #endif // __ISSERIALPORT_H__
Write
#define OVERRIDE
Definition: ISConstants.h:423
#define NULL
Definition: nm_bsp.h:52
serial_port_t m_serial
Definition: ISSerialPort.h:30
USBInterfaceDescriptor data
Read
#define BAUDRATE_921600
Definition: serialPort.h:41
int serialPortIsOpen(serial_port_t *serialPort)
Definition: serialPort.c:57


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57