| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <mutex> |
| 24 |
#include <string> |
| 25 |
|
| 26 |
#include "HardwareInterface.h" |
| 27 |
#include "HardwareParams.h" |
| 28 |
#include "Logger/Logger.h" |
| 29 |
#include "Network/Serial.h" |
| 30 |
|
| 31 |
namespace Hardware |
| 32 |
{ |
| 33 |
class Hsi88 : HardwareInterface |
| 34 |
{ |
| 35 |
public: |
| 36 |
Hsi88() = delete; |
| 37 |
Hsi88(const Hsi88&) = delete; |
| 38 |
Hsi88& operator=(const Hsi88&) = delete; |
| 39 |
|
| 40 |
Hsi88(const HardwareParams* params); |
| 41 |
~Hsi88(); |
| 42 |
|
| 43 |
inline Hardware::Capabilities GetCapabilities() const override |
| 44 |
{ |
| 45 |
return Hardware::CapabilityFeedback; |
| 46 |
} |
| 47 |
|
| 48 |
static void GetArgumentTypesAndHint(std::map<unsigned char,ArgumentType>& argumentTypes, std::string& hint) |
| 49 |
{ |
| 50 |
argumentTypes[1] = ArgumentTypeSerialPort; |
| 51 |
argumentTypes[2] = ArgumentTypeS88Modules; |
| 52 |
argumentTypes[3] = ArgumentTypeS88Modules; |
| 53 |
argumentTypes[4] = ArgumentTypeS88Modules; |
| 54 |
hint = Languages::GetText(Languages::TextHintHsi88); |
| 55 |
} |
| 56 |
|
| 57 |
private: |
| 58 |
static const unsigned char MaxS88Modules = 62; |
| 59 |
|
| 60 |
Network::Serial serialLine; |
| 61 |
volatile bool run; |
| 62 |
unsigned char s88Modules1; |
| 63 |
unsigned char s88Modules2; |
| 64 |
unsigned char s88Modules3; |
| 65 |
unsigned short s88Modules; |
| 66 |
|
| 67 |
std::thread checkEventsThread; |
| 68 |
unsigned char s88Init[MaxS88Modules]; |
| 69 |
unsigned char s88Memory[MaxS88Modules]; |
| 70 |
|
| 71 |
std::string ReadUntilCR(); |
| 72 |
std::string GetVersion(); |
| 73 |
unsigned char ConfigureS88(); |
| 74 |
void ReadData(); |
| 75 |
|
| 76 |
inline ssize_t SendData(const unsigned char* data, const size_t size) |
| 77 |
{ |
| 78 |
logger->HexOut(data, size); |
| 79 |
return serialLine.Send(data, size); |
| 80 |
} |
| 81 |
|
| 82 |
void CheckFeedbackByte(const unsigned char dataByte, const unsigned char module); |
| 83 |
|
| 84 |
void CheckEventsWorker(); |
| 85 |
}; |
| 86 |
} |
| 87 |
|