forked from IntelRealSense/RealSenseID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLinuxSerial.h
32 lines (27 loc) · 894 Bytes
/
LinuxSerial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020-2021 Intel Corporation. All Rights Reserved.
#pragma once
#include "SerialConnection.h"
namespace RealSenseID
{
namespace PacketManager
{
class LinuxSerial : public SerialConnection
{
public:
explicit LinuxSerial(const SerialConfig& config);
~LinuxSerial() override;
// prevent copy or assignment
// only single connection is allowed to a serial port.
LinuxSerial(const LinuxSerial&) = delete;
LinuxSerial operator=(const LinuxSerial&) = delete;
// send all bytes and return status
SerialStatus SendBytes(const char* buffer, size_t n_bytes) final;
// receive all bytes and copy to the buffer
SerialStatus RecvBytes(char* buffer, size_t n_bytes) final;
private:
SerialConfig _config;
int _handle = -1;
};
} // namespace PacketManager
} // namespace RealSenseID