embedded-framework/application/MissionManager/src/McuMonitor.cpp
2024-06-20 12:25:24 +08:00

70 lines
2.4 KiB
C++

/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "McuMonitor.h"
#include "ILog.h"
#include "IMcuManager.h"
#include <memory>
void McuMonitor::Init(std::shared_ptr<VMcuMonitor> &monitor)
{
IMcuManager::GetInstance()->SetMcuMonitor(monitor);
}
void McuMonitor::UnInit(void)
{
}
void McuMonitor::RecvIpcMissionEvent(std::shared_ptr<VMcuRecv> &recv, const IpcMission &mission)
{
}
void McuMonitor::RecvMcuHeartBeatEvent(std::shared_ptr<VMcuRecv> &recv)
{
}
void McuMonitor::RecvGetIntervalStartEvent(std::shared_ptr<VMcuRecv> &recv)
{
LogInfo("RecvGetIntervalStartEvent\n");
std::shared_ptr<McuRecv<McuGetIntervalStart>> recvData =
std::dynamic_pointer_cast<McuRecv<McuGetIntervalStart>>(recv);
if (recvData) {
recvData->mDataRecvReply.mHour = 10;
recvData->mDataRecvReply.mMin = 10;
recvData->mDataRecvReply.mSecond = 10;
recv->ReplyFinished(true);
}
recv->ReplyFinished(false);
}
void McuMonitor::RecvGetDateTime(std::shared_ptr<VMcuRecv> &recv)
{
LogInfo("RecvGetDateTime\n");
std::shared_ptr<McuRecv<McuReplyDateTime>> recvData = std::dynamic_pointer_cast<McuRecv<McuReplyDateTime>>(recv);
if (recvData) {
recvData->mDataRecvReply.mYear = 2024;
recvData->mDataRecvReply.mMon = 10;
recvData->mDataRecvReply.mDay = 10;
recvData->mDataRecvReply.mHour = 10;
recvData->mDataRecvReply.mMin = 10;
recvData->mDataRecvReply.mSecond = 10;
recv->ReplyFinished(true);
}
recv->ReplyFinished(false);
}
void McuMonitor::RecvGetPirSensitivity(std::shared_ptr<VMcuRecv> &recv)
{
LogInfo("RecvGetPirSensitivity\n");
std::shared_ptr<McuRecv<McuGetPirSensitivity>> recvData =
std::dynamic_pointer_cast<McuRecv<McuGetPirSensitivity>>(recv);
if (recvData) {
recvData->mDataRecvReply.mSensitivity = 9;
recv->ReplyFinished(true);
}
recv->ReplyFinished(false);
}