Improve:AppManager include cleaner.

This commit is contained in:
Fancy code 2024-06-17 15:38:44 +08:00
parent 5fa12e5021
commit 9a5c945797
10 changed files with 48 additions and 7 deletions

View File

@ -16,9 +16,9 @@
#define HALMAKEPTR_H #define HALMAKEPTR_H
#include "IHal.h" #include "IHal.h"
#include "IHalCpp.h" #include "IHalCpp.h"
#include "StatusCode.h"
#include "KeyControl.h" #include "KeyControl.h"
#include "LedControl.h" #include "LedControl.h"
#include "StatusCode.h"
#include <memory> #include <memory>
class HalMakePtr class HalMakePtr
{ {

View File

@ -23,7 +23,8 @@ public:
virtual ~SdCardHal() = default; virtual ~SdCardHal() = default;
void SetSdCardMonitor(std::shared_ptr<VSdCardHalMonitor> &monitor) override; void SetSdCardMonitor(std::shared_ptr<VSdCardHalMonitor> &monitor) override;
SdCardHalStatus GetSdCardStatus(void) override; SdCardHalStatus GetSdCardStatus(void) override;
StatusCode GetCapacity(unsigned long long &totalSizeMB, unsigned long long &freeSizeMB, unsigned long long &usedSizeMB) override; StatusCode GetCapacity(unsigned long long &totalSizeMB, unsigned long long &freeSizeMB,
unsigned long long &usedSizeMB) override;
void Init(void); void Init(void);
void UnInit(void); void UnInit(void);
void DevDetectingThread(void); void DevDetectingThread(void);

View File

@ -13,9 +13,12 @@
* limitations under the License. * limitations under the License.
*/ */
#include "AppClient.h" #include "AppClient.h"
#include "IAppManager.h"
#include "IAppProtocolHandle.h" #include "IAppProtocolHandle.h"
#include "ILog.h" #include "ILog.h"
#include "TcpModule.h" #include "TcpModule.h"
#include <memory>
#include <string>
AppClient::AppClient(const void *clientObject) : mClientObject(clientObject) AppClient::AppClient(const void *clientObject) : mClientObject(clientObject)
{ {
} }

View File

@ -15,10 +15,15 @@
#include "AppManager.h" #include "AppManager.h"
#include "AppClient.h" #include "AppClient.h"
#include "AppManagerMakePtr.h" #include "AppManagerMakePtr.h"
#include "IAppManager.h"
#include "IAppProtocolHandle.h"
#include "IHalCpp.h" #include "IHalCpp.h"
#include "ILog.h" #include "ILog.h"
#include "StatusCode.h"
#include "TcpModule.h" #include "TcpModule.h"
#include "WebServer.h" #include "WebServer.h"
#include <memory>
#include <sys/types.h>
AppManager::AppManager() : mTcpServer(nullptr), mInitRuning(false) AppManager::AppManager() : mTcpServer(nullptr), mInitRuning(false)
{ {
} }

View File

@ -14,7 +14,11 @@
*/ */
#include "AppManagerMakePtr.h" #include "AppManagerMakePtr.h"
#include "AppManager.h" #include "AppManager.h"
#include "IAppManager.h"
#include "IAppProtocolHandle.h"
#include "ILog.h" #include "ILog.h"
#include "StatusCode.h"
#include <memory>
// extern bool CreateProtocolHandleImpl(); // extern bool CreateProtocolHandleImpl();
bool CreateAppManagerModule(void) bool CreateAppManagerModule(void)
{ {

View File

@ -14,6 +14,10 @@
*/ */
#include "IAppManager.h" #include "IAppManager.h"
#include "ILog.h" #include "ILog.h"
#include "StatusCode.h"
#include <memory>
#include <string>
#include <vector>
app_get_product_info::app_get_product_info() app_get_product_info::app_get_product_info()
{ {
} }

View File

@ -13,7 +13,12 @@
* limitations under the License. * limitations under the License.
*/ */
#include "IAppProtocolHandle.h" #include "IAppProtocolHandle.h"
#include "IAppManager.h"
#include "ILog.h" #include "ILog.h"
#include "WebServer.h"
#include <cstdlib>
#include <memory>
#include <string>
protocol_packet::~protocol_packet() protocol_packet::~protocol_packet()
{ {
if (nullptr != mData) { if (nullptr != mData) {

View File

@ -13,11 +13,21 @@
* limitations under the License. * limitations under the License.
*/ */
#include "SixFrameHandle.h" #include "SixFrameHandle.h"
#include "IAppManager.h"
#include "IAppProtocolHandle.h"
#include "ILog.h" #include "ILog.h"
#include <WebServer.h>
#include <cJSON.h>
#include <cstdlib>
#include <cstring> #include <cstring>
#include <functional>
#include <map>
#include <memory>
#include <sstream> #include <sstream>
#include <stdio.h> #include <stdio.h>
#include <string>
#include <time.h> #include <time.h>
#include <vector>
using std::placeholders::_1; using std::placeholders::_1;
using std::placeholders::_2; using std::placeholders::_2;
using std::placeholders::_3; using std::placeholders::_3;
@ -1004,10 +1014,8 @@ std::shared_ptr<ProtocolPacket> SixFrameHandle::MakePacket(const cJSON *json)
if (nullptr != resultStr) { if (nullptr != resultStr) {
return std::make_shared<ProtocolPacket>(resultStr, strlen(resultStr)); return std::make_shared<ProtocolPacket>(resultStr, strlen(resultStr));
} }
else { LogError("MakePacket failed.\n");
LogError("MakePacket failed.\n"); return std::make_shared<ProtocolPacket>();
return std::make_shared<ProtocolPacket>();
}
} }
void SixFrameHandle::SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor) void SixFrameHandle::SetAppMonitor(std::shared_ptr<VAppMonitor> &monitor)
{ {

View File

@ -13,8 +13,12 @@
* limitations under the License. * limitations under the License.
*/ */
#include "SixFrameMakePtr.h" #include "SixFrameMakePtr.h"
#include "AppManagerMakePtr.h"
#include "IAppProtocolHandle.h"
#include "ILog.h" #include "ILog.h"
#include "SixFrameHandle.h" #include "SixFrameHandle.h"
#include "StatusCode.h"
#include <memory>
bool CreateProtocolHandleImpl(void) bool CreateProtocolHandleImpl(void)
{ {
LogInfo("CreateProtocolHandleImpl SixFrameMakePtr.\n"); LogInfo("CreateProtocolHandleImpl SixFrameMakePtr.\n");

View File

@ -14,9 +14,16 @@
*/ */
#include "WebServer.h" #include "WebServer.h"
#include "ILog.h" #include "ILog.h"
#include "StatusCode.h"
#include "goahead.h" #include "goahead.h"
#include "js.h" #include "osdep.h"
#include <errno.h>
#include <signal.h> #include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
static int finished = 0; static int finished = 0;
static HttpHandleCallback gHttpHandle = NULL; static HttpHandleCallback gHttpHandle = NULL;
constexpr int UNKNOWN_LENGTH = -1; constexpr int UNKNOWN_LENGTH = -1;