forked from IntelRealSense/RealSenseID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WindowsSerial.h
35 lines (28 loc) · 943 Bytes
/
WindowsSerial.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
33
34
35
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020-2021 Intel Corporation. All Rights Reserved.
#pragma once
#include "SerialConnection.h"
#include <windows.h>
namespace RealSenseID
{
namespace PacketManager
{
class WindowsSerial : public SerialConnection
{
public:
explicit WindowsSerial(const SerialConfig& config);
~WindowsSerial() override;
// prevent copy or assignment
// only single connection is allowed to a serial port.
WindowsSerial(const WindowsSerial&) = delete;
void operator=(const WindowsSerial&) = 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;
HANDLE _handle = INVALID_HANDLE_VALUE;
};
} // namespace PacketManager
} // namespace RealSenseID