-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSerialDevice.h
More file actions
79 lines (58 loc) · 1.75 KB
/
Copy pathSerialDevice.h
File metadata and controls
79 lines (58 loc) · 1.75 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/***************************************************************
* Name: SerialDevice.h
* Purpose: Defines Serial Access Class using serial.lib
* Author: Helge ()
* Created: 2020-11-17
* Copyright: Helge ()
* License:
**************************************************************/
#pragma once
#include <string.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#if defined(__linux__)
#include <unistd.h>
#elif defined(_WINDOWS)
#include <windows.h>
#endif
#include "serial/serial.h"
#include "s/SimpleSerial.h"
#include "protocol.h"
using namespace std;
using namespace serial;
//#define CDC_VENDOR_ID "1A86";
//#define CDC_PRODUCT_ID "7523";
#define CDC_VENDOR_ID "10C4";
#define CDC_PRODUCT_ID "EA60";
///////////////////////////////////////////////////////////////////////////////
/// Class Serial Connection via CDC USB serial port
///////////////////////////////////////////////////////////////////////////////
class SerialDevice : public Serial
{
private:
string vendor_id;
string product_id;
int receiveLoop(uint8_t& cmd, uint8_t& sz, uint8_t* data);
int GetValue(uint8_t cmd, uint32_t& val); // get data FROM ignition module
protected:
public:
SerialDevice(uint16_t _vendor_id, uint16_t _product_id);
SerialDevice(void);
string print_deviceList(void);
void connect_device();
~SerialDevice();
bool isConnected();
bool get_OPcounter(uint32_t& val);
};
/*
typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
Wert = ( int ) ( ( ( unsigned int )( Byte1 << 8 ) ) | Byte2 );
*/