159 lines
5.1 KiB
C++
159 lines
5.1 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 "AppMonitor.h"
|
|
#include "ILog.h"
|
|
#include <vector>
|
|
StatusCode AppMonitor::GetProductInfo(AppGetProductInfo ¶m)
|
|
{
|
|
LogInfo("AppMonitor::GetProductInfo.\n");
|
|
param.mModel = "test";
|
|
param.mCompany = "test";
|
|
param.mSoc = "test";
|
|
param.mSp = "test";
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
|
{
|
|
LogInfo("AppMonitor::GetDeviceAttr.\n");
|
|
param.mUUID = "test";
|
|
param.mSoftVersion = "test";
|
|
param.mOtaVersion = "test";
|
|
param.mHardwareVersion = "test";
|
|
param.mSSID = "test";
|
|
param.mBSSID = "test";
|
|
param.mCameraNumber = "test";
|
|
param.mCurrentCameraID = "test";
|
|
param.mWifiReboot = "test";
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetMediaInfo(AppGetMediaInfo ¶m)
|
|
{
|
|
LogInfo("AppMonitor::GetMediaInfo.\n");
|
|
param.mRtspUrl = "rtsp://192.168.169.1/live/0";
|
|
param.mTransport = "tcp";
|
|
param.mPort = APP_MANAGER_TCP_SERVER_PORT;
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
|
{
|
|
LogInfo("AppMonitor::GetSdCardInfo.\n");
|
|
SdCardInfo info;
|
|
IStorageManager::GetInstance()->GetSdCardInfo(info);
|
|
param.mStatus = SdCardStatusConvert(info.mEvent);
|
|
param.mFree = info.mFreeSizeMB;
|
|
param.mTotal = info.mTotalSizeMB;
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
|
{
|
|
LogInfo("AppMonitor::GetBatteryInfo.\n");
|
|
param.mCapacity = 0;
|
|
param.mChargeStatus = ChargeStatus::CHARGING;
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetParamValue(AppParamValue ¶m)
|
|
{
|
|
param.mMicStatus = SwitchStatus::ON;
|
|
param.mRec = SwitchStatus::OFF;
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetCapability(AppGetCapability ¶m)
|
|
{
|
|
param.mPlaybackType = PlaybackType::DOWNLOAD_PLAYBACK;
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetLockVideoStatus(LockVideoStatus ¶m)
|
|
{
|
|
param = LockVideoStatus::LOCK;
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetStorageInfo(std::vector<AppGetStorageInfo> ¶m)
|
|
{
|
|
AppGetStorageInfo info;
|
|
SdCardInfo sdInfo;
|
|
IStorageManager::GetInstance()->GetSdCardInfo(sdInfo);
|
|
info.mIndex = 0;
|
|
info.mName = "TF card 1";
|
|
info.mType = StorageType::SD_CARD_1;
|
|
info.mFree = sdInfo.mFreeSizeMB;
|
|
info.mTotal = sdInfo.mTotalSizeMB;
|
|
param.push_back(info);
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> ¶m)
|
|
{
|
|
if (StorageFileEvent::LOOP == fileInfo.mEvent) {
|
|
AppGetFileList file;
|
|
file.mCreateTime_s = 123456789;
|
|
file.mDuration = 182;
|
|
file.mName = "/DCIM/2024/01/15/20240115140207-20240115140509.mp4";
|
|
file.mSize = 1024 * 182;
|
|
file.mType = StorageFileType::VIDEO;
|
|
param.push_back(file);
|
|
AppGetFileList file2;
|
|
file2.mCreateTime_s = 123456789;
|
|
file2.mDuration = 0;
|
|
file2.mName = "/34a396526922a33e97906920dbfef2a5.jpg";
|
|
file2.mSize = 1024;
|
|
file2.mType = StorageFileType::PICTURE;
|
|
param.push_back(file2);
|
|
}
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::SetDateTime(const AppSetDateTime ¶m)
|
|
{
|
|
//
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::SetTimeZone(const unsigned int &zone)
|
|
{
|
|
//
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::SetParamValue(const AppSetParamValue ¶m)
|
|
{
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::EnterRecorder(void)
|
|
{
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::AppPlayback(const PlayBackEvent &event)
|
|
{
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::UploadFile(AppUploadFile ¶m)
|
|
{
|
|
//
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
StatusCode AppMonitor::GetThumbnail(AppGetThumbnail ¶m)
|
|
{
|
|
param.mThumbnail = "./34a396526922a33e97906920dbfef2a5.jpg";
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
SdCardStatus AppMonitor::SdCardStatusConvert(const StorageEvent &event)
|
|
{
|
|
switch (event) {
|
|
case StorageEvent::SD_CARD_INSERT:
|
|
return SdCardStatus::NORMAL;
|
|
case StorageEvent::SD_CARD_REMOVE:
|
|
return SdCardStatus::NOT_INSERTED;
|
|
case StorageEvent::SD_ABNORMAL:
|
|
return SdCardStatus::NOT_INSERTED;
|
|
default:
|
|
return SdCardStatus::END;
|
|
}
|
|
} |