Serialize NWM service

This commit is contained in:
Hamish Milne 2020-01-01 21:31:52 +00:00 committed by zhupengfei
parent 571b1062f0
commit f5e2f873b0
18 changed files with 82 additions and 8 deletions

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nwm/nwm_cec.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_CEC)
namespace Service::NWM {
NWM_CEC::NWM_CEC() : ServiceFramework("nwm::CEC") {

View file

@ -14,3 +14,5 @@ public:
};
} // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_CEC)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nwm/nwm_ext.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_EXT)
namespace Service::NWM {
NWM_EXT::NWM_EXT() : ServiceFramework("nwm::EXT") {

View file

@ -14,3 +14,5 @@ public:
};
} // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_EXT)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nwm/nwm_inf.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_INF)
namespace Service::NWM {
NWM_INF::NWM_INF() : ServiceFramework("nwm::INF") {

View file

@ -14,3 +14,5 @@ public:
};
} // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_INF)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nwm/nwm_sap.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_SAP)
namespace Service::NWM {
NWM_SAP::NWM_SAP() : ServiceFramework("nwm::SAP") {

View file

@ -14,3 +14,5 @@ public:
};
} // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_SAP)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nwm/nwm_soc.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_SOC)
namespace Service::NWM {
NWM_SOC::NWM_SOC() : ServiceFramework("nwm::SOC") {

View file

@ -14,3 +14,5 @@ public:
};
} // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_SOC)

View file

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nwm/nwm_tst.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_TST)
namespace Service::NWM {
NWM_TST::NWM_TST() : ServiceFramework("nwm::TST") {

View file

@ -14,3 +14,5 @@ public:
};
} // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_TST)

View file

@ -4,7 +4,10 @@
#include <algorithm>
#include <cstring>
#include <boost/serialization/list.hpp>
#include <boost/serialization/map.hpp>
#include <cryptopp/osrng.h>
#include "common/archives.h"
#include "common/common_types.h"
#include "common/logging/log.h"
#include "core/core.h"
@ -23,6 +26,15 @@
namespace Service::NWM {
template <class Archive>
void NWM_UDS::serialize(Archive& ar, const unsigned int) {
ar& node_map;
ar& connection_event;
ar& received_beacons;
// TODO: Fix wifi_packet_received?
}
SERIALIZE_IMPL(NWM_UDS)
namespace ErrCodes {
enum {
NotInitialized = 2,

View file

@ -521,6 +521,14 @@ private:
struct Node {
bool connected;
u16 node_id;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& connected;
ar& node_id;
}
friend class boost::serialization::access;
};
std::map<MacAddress, Node> node_map;
@ -543,6 +551,12 @@ private:
// List of the last <MaxBeaconFrames> beacons received from the network.
std::list<Network::WifiPacket> received_beacons;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
};
} // namespace Service::NWM
SERVICE_CONSTRUCT(Service::NWM::NWM_UDS)
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_UDS)