client
src
hardware.h
Go to the documentation of this file.
1
/*
2
* Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
18
#ifndef HAND_BRIDGE_HARDWARE_H_
19
#define HAND_BRIDGE_HARDWARE_H_
20
21
#include <boost/chrono.hpp>
22
#include "
serial_port.h
"
23
24
class
HandBridgeHardware
{
25
boost::chrono::steady_clock::time_point
start
;
26
SerialPort
serial
;
27
28
public
:
29
void
init
(
char
* param)
30
{
31
if
(!
serial
.
init
(
param
)) exit(1);
32
}
33
unsigned
long
time
()
34
{
35
return
boost::chrono::duration_cast<boost::chrono::milliseconds>(boost::chrono::steady_clock::now() -
start
).count();
36
}
37
int
read
(){
38
return
serial
.
readByte
();
39
}
40
void
write
(uint8_t* data,
int
length)
41
{
42
serial
.
write
(
data
, length);
43
}
44
};
45
46
#endif // HAND_BRIDGE_HARDWARE_H_
serial_port.h
HandBridgeHardware::time
unsigned long time()
Definition:
hardware.h:33
HandBridgeHardware::read
int read()
Definition:
hardware.h:37
HandBridgeHardware::start
boost::chrono::steady_clock::time_point start
Definition:
hardware.h:25
SerialPort::write
bool write(uint8_t *data, int length)
Definition:
serial_port.h:59
HandBridgeHardware::init
void init(char *param)
Definition:
hardware.h:29
HandBridgeHardware::write
void write(uint8_t *data, int length)
Definition:
hardware.h:40
data
data
HandBridgeHardware
Definition:
hardware.h:24
SerialPort
Definition:
serial_port.h:27
param
T param(const std::string ¶m_name, const T &default_val)
HandBridgeHardware::serial
SerialPort serial
Definition:
hardware.h:26
SerialPort::init
bool init(char *param)
Definition:
serial_port.h:33
SerialPort::readByte
int readByte()
Definition:
serial_port.h:53
cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Fri Aug 2 2024 09:40:56