Newer
Older
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
#include "GeoNetworkingLayer.hh"
#include "GeoNetworkingTypes.hh"
#include "loggers.hh"
void GeoNetworkingLayer::sendMsg(const LibItsGeoNetworking__TestSystem::GeoNetworkingReq& p, const Params& params) {
loggers::loggers::log(">>> GeoNetworkingLayer::sendMsg");
const LibItsGeoNetworking__TypesAndValues::GeoNetworkingPdu & pdu = p.msgOut();
OCTETSTRING data;
_codec.encode(pdu, data);
const unsigned char mac_address[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
data += OCTETSTRING(sizeof(mac_address), static_cast<const unsigned char *>(mac_address));
sendData(data, params);
}
void GeoNetworkingLayer::sendData(const OCTETSTRING& data, const Params& params) {
sendToAllLayers(data, params);
}
void GeoNetworkingLayer::receiveData(const OCTETSTRING& data, const Params& info) {
LibItsGeoNetworking__TestSystem::GeoNetworkingInd p;
// _codec.decode(data, p);
toAllUpperPorts(p, info);
// if (p.payload().is_present()) {
// toAllUpperLayers(p.payload()().rawPayload(), info);
// }
}
class GeoNetworkingFactory: public LayerFactory {
static GeoNetworkingFactory _f;
public:
GeoNetworkingFactory();
virtual Layer * createLayer(const std::string & type,
const std::string & param);
};
GeoNetworkingFactory::GeoNetworkingFactory() {
// register factory
LayerStackBuilder::RegisterLayerFactory("GeoNetworking", this);
}
Layer * GeoNetworkingFactory::createLayer(const std::string & type, const std::string & param) {
return new GeoNetworkingLayer();
}
GeoNetworkingFactory GeoNetworkingFactory::_f;