forked from realsenseai/RealSenseID
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSerialConnection.h
More file actions
28 lines (22 loc) · 814 Bytes
/
SerialConnection.h
File metadata and controls
28 lines (22 loc) · 814 Bytes
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
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020-2021 Intel Corporation. All Rights Reserved.
#pragma once
#include "CommonTypes.h"
namespace RealSenseID
{
namespace PacketManager
{
// Represents an open serial connection (raii over the os serial connection).
// Should open new connection on construction and close it on destruction.
// Should throw if connection could not be established on construction.
class SerialConnection
{
public:
virtual ~SerialConnection() = default;
// send all bytes and return status
virtual SerialStatus SendBytes(const char* buffer, size_t n_bytes) = 0;
// receive all bytes and copy to the buffer
virtual SerialStatus RecvBytes(char* buffer, size_t n_bytes) = 0;
};
} // namespace PacketManager
} // namespace RealSenseID