hunting/middleware/AppManager/src/IAppManager.cpp
2024-06-17 15:38:44 +08:00

220 lines
6.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 "IAppManager.h"
#include "ILog.h"
#include "StatusCode.h"
#include <memory>
#include <string>
#include <vector>
app_get_product_info::app_get_product_info()
{
}
app_get_device_attr::app_get_device_attr()
{
}
app_get_media_info::app_get_media_info()
{
mPort = -1;
}
app_get_sd_card_info::app_get_sd_card_info()
{
mStatus = SdCardStatus::END;
mFree = 0;
mTotal = 0;
}
app_get_battery_info::app_get_battery_info()
{
mCapacity = 0;
mChargeStatus = ChargeStatus::END;
}
app_get_param_value::app_get_param_value()
{
mRec = SwitchStatus::END;
mMicStatus = SwitchStatus::END;
}
app_get_capability::app_get_capability()
{
mGpsCapability = GpsCapability::END;
mDeviceType = DeviceType::END;
mAlbum = DashAlbum::END;
mAppLock = AppLock::END;
mDeleteLock = DeleteLock::END;
mDeviceMode = DeviceMode::END;
mPlaybackType = PlaybackType::END;
mPhotographCapability = PhotographCapability::END;
mWifiCapability = WifiCapability::END;
mFileCopy = FileCopy::END;
}
app_get_storage_info::app_get_storage_info()
{
mIndex = -1;
mType = StorageType::END;
mFree = 0;
mTotal = 0;
}
app_get_file_info::app_get_file_info()
{
mStartIndex = 0;
mStopIndex = 0;
mEvent = StorageFileEvent::END;
}
app_get_file_list::app_get_file_list()
{
mDuration = 0;
mSize = 0;
mCreateTime_s = 0;
mType = StorageFileType::END;
}
app_set_param_value::app_set_param_value()
{
mValue = -1;
}
app_set_date_time::app_set_date_time(const unsigned int year, const unsigned int month, const unsigned int day,
const unsigned int hour, const unsigned int minute, const unsigned int second)
: mYear(year), mMonth(month), mDay(day), mHour(hour), mMinute(minute), mSecond(second)
{
}
app_upload_file::app_upload_file(const std::string filePath, const UploadCommand command)
: mFilePath(filePath), mCommand(command)
{
mResult = ResposeResult::END;
}
app_get_thumbnail::app_get_thumbnail(const std::string file) : mFile(file)
{
}
app_param::app_param(const char *ip, const int &httpPort, const int &tcpPort)
: mIP(ip), mHttpPort(httpPort), mTcpPort(tcpPort)
{
}
void VAppClient::SetRecordingStatus(const RecordingStatus &status)
{
}
void VAppClient::SetMicrophoneStatus(const MicrophoneStatus &status)
{
}
void VAppClient::SetBatteryStatus(const BatteryStatus &status, const int &batteryCapacity)
{
}
void VAppClient::SetSdCardStatus(const SdCardStatus &status)
{
}
void VAppClient::DeletedFileMessage(const std::string &file, const StorageFileType &type)
{
}
void VAppClient::CreatedFileMessage(const std::string &file, const StorageFileType &type)
{
}
StatusCode VAppMonitor::GetProductInfo(AppGetProductInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetDeviceAttr(AppGetDeviceAttr &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetMediaInfo(AppGetMediaInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetSdCardInfo(AppGetSdCardInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetBatteryInfo(AppGetBatteryInfo &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetParamValue(AppParamValue &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetCapability(AppGetCapability &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetLockVideoStatus(LockVideoStatus &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetStorageInfo(std::vector<AppGetStorageInfo> &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::SetDateTime(const AppSetDateTime &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::SetTimeZone(const unsigned int &zone)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::SetParamValue(const AppSetParamValue &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::EnterRecorder(void)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::AppPlayback(const PlayBackEvent &event)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::UploadFile(AppUploadFile &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::GetThumbnail(AppGetThumbnail &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode VAppMonitor::AppClientConnected(std::shared_ptr<VAppClient> &client)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
std::shared_ptr<IAppManager> &IAppManager::GetInstance(std::shared_ptr<IAppManager> *impl)
{
static auto instance = std::make_shared<IAppManager>();
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;
}
const StatusCode IAppManager::Init(const AppParam &param)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
const StatusCode IAppManager::UnInit(void)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
const StatusCode IAppManager::SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}
StatusCode IAppManager::SetSdCardStatus(const SdCardStatus &status)
{
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
}