mirror of
https://gitee.com/jiuyilian/embedded-framework.git
synced 2025-01-06 10:16:51 -05:00
Backup.
This commit is contained in:
parent
b4d5fa020d
commit
7233841a4a
|
@ -36,6 +36,10 @@ StatusCode IHalCpp::GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode IHalCpp::GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)
|
StatusCode IHalCpp::GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
}
|
||||||
|
StatusCode IHalCpp::GetWifiHal(std::shared_ptr<VWifiHal> &wifi)
|
||||||
{
|
{
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
|
@ -50,6 +50,13 @@ public:
|
||||||
VLedHal() = default;
|
VLedHal() = default;
|
||||||
virtual ~VLedHal() = default;
|
virtual ~VLedHal() = default;
|
||||||
};
|
};
|
||||||
|
class VWifiHal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VWifiHal() = default;
|
||||||
|
virtual ~VWifiHal() = default;
|
||||||
|
virtual StatusCode OpenApMode(void) { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); }
|
||||||
|
};
|
||||||
class IHalCpp
|
class IHalCpp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -60,5 +67,6 @@ public:
|
||||||
virtual StatusCode UnInit(void);
|
virtual StatusCode UnInit(void);
|
||||||
virtual StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds);
|
virtual StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds);
|
||||||
virtual StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys);
|
virtual StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys);
|
||||||
|
virtual StatusCode GetWifiHal(std::shared_ptr<VWifiHal> &wifi);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
14
hal/src/WifiHal.cpp
Normal file
14
hal/src/WifiHal.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
24
hal/src/WifiHal.h
Normal file
24
hal/src/WifiHal.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#ifndef WIFI_HAL_H
|
||||||
|
#define WIFI_HAL_H
|
||||||
|
#include "IHalCpp.h"
|
||||||
|
class WifiHal : public VWifiHal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WifiHal() = default;
|
||||||
|
virtual ~WifiHal() = default;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -15,6 +15,7 @@
|
||||||
#include "AppManager.h"
|
#include "AppManager.h"
|
||||||
#include "AppManagerMakePtr.h"
|
#include "AppManagerMakePtr.h"
|
||||||
// #include "FxHttpServer.h"
|
// #include "FxHttpServer.h"
|
||||||
|
#include "IHalCpp.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "WebServer.h"
|
#include "WebServer.h"
|
||||||
AppManager::AppManager()
|
AppManager::AppManager()
|
||||||
|
@ -24,11 +25,18 @@ AppManager::AppManager()
|
||||||
}
|
}
|
||||||
const StatusCode AppManager::Init(const AppParam ¶m)
|
const StatusCode AppManager::Init(const AppParam ¶m)
|
||||||
{
|
{
|
||||||
|
std::shared_ptr<VWifiHal> wifi;
|
||||||
|
IHalCpp::GetInstance()->GetWifiHal(wifi);
|
||||||
|
if (!wifi) {
|
||||||
|
LogError("Get wifi hal failed.\n");
|
||||||
|
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||||
|
}
|
||||||
|
wifi->OpenApMode();
|
||||||
AppManagerMakePtr::GetInstance()->CreateProtocolHandle(mProtocolHandle);
|
AppManagerMakePtr::GetInstance()->CreateProtocolHandle(mProtocolHandle);
|
||||||
HttpServerStart(param);
|
HttpServerStart(param);
|
||||||
return CreateStatusCode(STATUS_CODE_OK);
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
}
|
}
|
||||||
const StatusCode AppManager::UnInit(void)
|
const StatusCode AppManager::UnInit(void)
|
||||||
{
|
{
|
||||||
HttpServerStop();
|
HttpServerStop();
|
||||||
mProtocolHandle.reset();
|
mProtocolHandle.reset();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user