Bind NWM_UDS service in the constructor

This commit is contained in:
Hamish Milne 2020-01-05 16:42:04 +00:00 committed by zhupengfei
parent 96432589bd
commit 7019561fd5
2 changed files with 10 additions and 10 deletions

4
TODO
View File

@ -93,7 +93,7 @@
✔ VM Manager @started(19-08-13 16:46) @done(20-01-04 21:09) @lasted(20w4d5h23m42s)
Just need to figure out backing_mem (a u8*)
✔ Wait object @done(19-08-13 16:46)
☐ Service @started(19-12-23 12:49)
✔ Service @started(19-12-23 12:49) @done(20-01-05 16:41) @lasted(1w6d3h52m17s)
✔ AC @started(19-12-23 12:48) @done(19-12-24 22:38) @lasted(1d9h50m3s)
✔ ACT @done(19-12-24 23:17)
✔ AM @started(19-12-24 23:17) @done(19-12-24 23:53) @lasted(36m8s)
@ -125,7 +125,7 @@
✔ NIM @done(19-12-31 21:08)
✔ NS @done(20-01-01 00:46)
✔ NWM @done(20-01-01 21:31)
☐ Fix wifi_packet_received?
✔ Fix wifi_packet_received @done(20-01-05 16:41)
✔ PM @done(20-01-01 22:14)
✔ PS @done(20-01-01 00:54)
✔ PTM @done(20-01-01 22:36)

View File

@ -31,7 +31,7 @@ void NWM_UDS::serialize(Archive& ar, const unsigned int) {
ar& node_map;
ar& connection_event;
ar& received_beacons;
// TODO: Fix wifi_packet_received?
// wifi_packet_received set in constructor
}
SERIALIZE_IMPL(NWM_UDS)
@ -637,13 +637,6 @@ ResultVal<std::shared_ptr<Kernel::Event>> NWM_UDS::Initialize(
recv_buffer_memory = std::move(sharedmem);
ASSERT_MSG(recv_buffer_memory->GetSize() == sharedmem_size, "Invalid shared memory size.");
if (auto room_member = Network::GetRoomMember().lock()) {
wifi_packet_received = room_member->BindOnWifiPacketReceived(
[this](const Network::WifiPacket& packet) { OnWifiPacketReceived(packet); });
} else {
LOG_ERROR(Service_NWM, "Network isn't initalized");
}
{
std::lock_guard lock(connection_status_mutex);
@ -1408,6 +1401,13 @@ NWM_UDS::NWM_UDS(Core::System& system) : ServiceFramework("nwm::UDS"), system(sy
system.Kernel().GetSharedPageHandler().SetMacAddress(mac);
system.Kernel().GetSharedPageHandler().SetWifiLinkLevel(SharedPage::WifiLinkLevel::BEST);
if (auto room_member = Network::GetRoomMember().lock()) {
wifi_packet_received = room_member->BindOnWifiPacketReceived(
[this](const Network::WifiPacket& packet) { OnWifiPacketReceived(packet); });
} else {
LOG_ERROR(Service_NWM, "Network isn't initalized");
}
}
NWM_UDS::~NWM_UDS() {