Newer
Older
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
#include "UpperTesterTypes.hh"
#include "loggers.hh"
UpperTesterCamLayer::UpperTesterCamLayer(const std::string & p_type, const std::string & param) : TLayer<LibItsCam__TestSystem::UpperTesterPort>(p_type), _params(), _codec() {
loggers::get_instance().log(">>> UpperTesterCamLayer::UpperTesterCamLayer: %s, %s", to_string().c_str(), param.c_str());
// Setup parameters
Params::convert(_params, param);
}
void UpperTesterCamLayer::sendMsg(const LibItsCam__TypesAndValues::UtCamInitialize& send_par, Params& params){
loggers::get_instance().log_msg(">>> UpperTesterCamLayer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
sendData(data, params);
}
void UpperTesterCamLayer::sendMsg(const LibItsCam__TypesAndValues::UtCamChangePosition& send_par, Params& params)
{
loggers::get_instance().log_msg(">>> UpperTesterCamLayer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode((const Record_Type &)send_par, data);
// Update parameters
sendData(data, params);
}
void UpperTesterCamLayer::sendMsg(const LibItsCam__TypesAndValues::UtCamTrigger& send_par, Params& params)
{
loggers::get_instance().log_msg(">>> UpperTesterCamLayer::sendMsg", send_par);
// Encode UpperTester PDU
OCTETSTRING data;
_codec.encode(send_par, data);
// Update parameters
sendData(data, params);
}
void UpperTesterCamLayer::sendData(OCTETSTRING& data, Params& params) {
loggers::get_instance().log_msg(">>> UpperTesterCamLayer::sendData: ", data);
//params.log();
sendToAllLayers(data, params);
}
void UpperTesterCamLayer::receiveData(OCTETSTRING& data, Params& params)
{
loggers::get_instance().log_msg(">>> UpperTesterCamLayer::receiveData: ", data);
std::unique_ptr<Base_Type> r = _codec.decode(data);
if (r.get() != nullptr) {
// Pass it to the ports if amy
toAllUpperPorts(*r, params);
}
}
UpperTesterCamFactory UpperTesterCamFactory::_f;