-
Notifications
You must be signed in to change notification settings - Fork 0
/
RAMS7200HWService.hxx
67 lines (54 loc) · 1.64 KB
/
RAMS7200HWService.hxx
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
/** © Copyright 2022 CERN
*
* This software is distributed under the terms of the
* GNU Lesser General Public Licence version 3 (LGPL Version 3),
* copied verbatim in the file “LICENSE”
*
* In applying this licence, CERN does not waive the privileges
* and immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*
* Author: Adrien Ledeul (HSE)
*
**/
#ifndef RAMS7200HWSERVICE_H_
#define RAMS7200HWSERVICE_H_
#include <HWService.hxx>
#include "RAMS7200MS.hxx"
#include "RAMS7200LibFacade.hxx"
#include "Common/Logger.hxx"
#include <memory>
#include <queue>
#include <chrono>
#include <thread>
#include <unordered_map>
#include <tuple>
class RAMS7200HWService : public HWService
{
public:
RAMS7200HWService();
virtual PVSSboolean initialize(int argc, char *argv[]);
virtual PVSSboolean start();
virtual void stop();
virtual void workProc();
virtual PVSSboolean writeData(HWObject *objPtr);
int CheckIP(std::string);
private:
void queueToDP(std::vector<toDPTriple>&&);
void handleNewMS(RAMS7200MS&);
queueToDPCallback _queueToDPCB{[this](std::vector<toDPTriple>&& payload){this->queueToDP(std::move(payload));}};
std::function<void(RAMS7200MS&)> _newMSCB{[this](RAMS7200MS& ms){this->handleNewMS(ms);}};
//Common
std::mutex _toDPmutex;
std::queue<toDPTriple> _toDPqueue;
enum
{
ADDRESS_OPTIONS_IP = 0,
ADDRESS_OPTIONS_VAR,
ADDRESS_OPTIONS_POLLTIME,
ADDRESS_OPTIONS_SIZE
} ADDRESS_OPTIONS;
std::vector<std::thread> _plcThreads;
};
void handleSegfault(int signal_code);
#endif