hunting/middleware/AppManager/src/IAppProtocolHandle.cpp
2024-06-15 08:35:07 +08:00

81 lines
2.9 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 "IAppProtocolHandle.h"
#include "ILog.h"
protocol_packet::~protocol_packet()
{
if (nullptr != mData) {
free(mData);
mData = nullptr;
}
}
std::shared_ptr<IAppProtocolHandle> &IAppProtocolHandle::GetInstance(std::shared_ptr<IAppProtocolHandle> *impl)
{
static auto instance = std::make_shared<IAppProtocolHandle>();
if (impl) {
if (instance.use_count() == 1) {
LogInfo("Instance changed succeed.\n");
instance = *impl;
}
else {
LogError("Can't changing the instance becase of using by some one.\n");
}
}
return instance;
}
void IAppProtocolHandle::Init(void)
{
}
void IAppProtocolHandle::UnInit(void)
{
}
void IAppProtocolHandle::RequestHandle(const char *url, const unsigned int &urlLength, ResponseHandle responseHandle,
void *context)
{
}
void IAppProtocolHandle::RequestHandleTcp(const char *data, const unsigned int &dataLength,
ResponseHandle responseHandle, void *context)
{
}
void IAppProtocolHandle::SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor)
{
}
std::shared_ptr<ProtocolPacket> IAppProtocolHandle::SetRecordingStatus(const RecordingStatus &status)
{
return std::make_shared<ProtocolPacket>();
}
std::shared_ptr<ProtocolPacket> IAppProtocolHandle::SetMicrophoneStatus(const MicrophoneStatus &status)
{
return std::make_shared<ProtocolPacket>();
}
std::shared_ptr<ProtocolPacket> IAppProtocolHandle::SetBatteryStatus(const BatteryStatus &status,
const int &batteryCapacity)
{
return std::make_shared<ProtocolPacket>();
}
std::shared_ptr<ProtocolPacket> IAppProtocolHandle::SetSdCardStatus(const SdCardStatus &status)
{
return std::make_shared<ProtocolPacket>();
}
std::shared_ptr<ProtocolPacket> IAppProtocolHandle::DeletedFileMessage(const std::string &file,
const StorageFileType &type)
{
return std::make_shared<ProtocolPacket>();
}
std::shared_ptr<ProtocolPacket> IAppProtocolHandle::CreatedFileMessage(const std::string &file,
const StorageFileType &type)
{
return std::make_shared<ProtocolPacket>();
}