Improve:Hal include cleaner.

This commit is contained in:
Fancy code 2024-06-17 19:35:40 +08:00
parent ac578c063a
commit 7659ad8cd2
7 changed files with 31 additions and 10 deletions

View File

@ -14,7 +14,10 @@
*/ */
#include "IHalCpp.h" #include "IHalCpp.h"
#include "ILog.h" #include "ILog.h"
#include "StatusCode.h"
#include <map>
#include <memory> #include <memory>
#include <string>
camera_report_event::camera_report_event(const std::string &fileName, const CameraType &cameraType) camera_report_event::camera_report_event(const std::string &fileName, const CameraType &cameraType)
: mFileName(fileName), mCameraType(cameraType) : mFileName(fileName), mCameraType(cameraType)
{ {

View File

@ -13,7 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include "CameraHal.h" #include "CameraHal.h"
#include "ILog.h" #include "IHalCpp.h"
#include "StatusCode.h"
CameraHal::CameraHal() : mTaskRuning(false), mAudioStreamCallback(nullptr), mVideoStreamCallback(nullptr) CameraHal::CameraHal() : mTaskRuning(false), mAudioStreamCallback(nullptr), mVideoStreamCallback(nullptr)
{ {
} }

View File

@ -13,7 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
#include "Hal.h" #include "Hal.h"
#include "IHal.h"
#include "ILog.h" #include "ILog.h"
#include "StatusCode.h"
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
StatusCode HalInit(IHal *hal) StatusCode HalInit(IHal *hal)

View File

@ -14,9 +14,15 @@
*/ */
#include "HalCpp.h" #include "HalCpp.h"
#include "HalMakePtr.h" #include "HalMakePtr.h"
#include "IHalCpp.h"
#include "ILog.h" #include "ILog.h"
#include "SdCardHal.h" #include "SdCardHal.h"
#include "StatusCode.h"
#include "WifiHal.h" #include "WifiHal.h"
#include <map>
#include <memory>
#include <string>
#include <utility>
StatusCode HalCpp::Init(void) StatusCode HalCpp::Init(void)
{ {
LogInfo("HalCpp::Init\n"); LogInfo("HalCpp::Init\n");

View File

@ -15,14 +15,21 @@
#include "HalMakePtr.h" #include "HalMakePtr.h"
#include "Hal.h" #include "Hal.h"
#include "HalCpp.h" #include "HalCpp.h"
#include "IHal.h"
#include "IHalCpp.h"
#include "ILog.h" #include "ILog.h"
#include "KeyControl.h"
#include "LedControl.h"
#include "SdCardHal.h" #include "SdCardHal.h"
#include "StatusCode.h"
#include "WifiHal.h" #include "WifiHal.h"
#include <memory>
#include <vector>
StatusCode CreateHalModule(void) StatusCode CreateHalModule(void)
{ {
IHal *hal = NULL; IHal *hal = nullptr;
StatusCode code = HalMakePtr::GetInstance()->CreateHalPtr(&hal); StatusCode code = HalMakePtr::GetInstance()->CreateHalPtr(&hal);
if (IsCodeOK(code) && NULL != hal) { if (IsCodeOK(code) && nullptr != hal) {
LogInfo("Create Hal instance ok.\n"); LogInfo("Create Hal instance ok.\n");
ResetHalImpl((IHal *)hal); ResetHalImpl((IHal *)hal);
} }

View File

@ -13,17 +13,19 @@
* limitations under the License. * limitations under the License.
*/ */
#include "SdCardHal.h" #include "SdCardHal.h"
#include "IHalCpp.h"
#include "ILog.h" #include "ILog.h"
#include "LinuxApi.h" #include "LinuxApi.h"
#include <errno.h> #include "StatusCode.h"
#include <chrono>
#include <fcntl.h> #include <fcntl.h>
#include <memory>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/statvfs.h> #include <sys/statfs.h>
#include <sys/types.h>
#include <sys/vfs.h> #include <sys/vfs.h>
#include <thread>
#include <unistd.h> #include <unistd.h>
const char *SD_CARD_DEVICE = SD_CARD_DEV; const char *SD_CARD_DEVICE = SD_CARD_DEV;
const char *SD_MOUNT_PATH = SD_CARD_MOUNT_PATH; const char *SD_MOUNT_PATH = SD_CARD_MOUNT_PATH;

View File

@ -15,6 +15,8 @@
#include "WifiHal.h" #include "WifiHal.h"
#include "ILog.h" #include "ILog.h"
#include "LinuxApi.h" #include "LinuxApi.h"
#include "StatusCode.h"
#include <chrono>
#include <dirent.h> #include <dirent.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -94,7 +96,5 @@ bool WifiHal::CheckWlan0IfExist(void)
if (wlan0_found) { if (wlan0_found) {
return true; return true;
} }
else {
return false; return false;
} }
}