diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 116432d0..ecbc83fd 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -9,14 +9,13 @@ include_directories( ./include ${UTILS_SOURCE_PATH}/StatusCode/include ${UTILS_SOURCE_PATH}/Log/include + ${UTILS_SOURCE_PATH}/LinuxApi/include ) #do not rely on any other library # link_directories( # ${EXTERNAL_SOURCE_PATH}/curl/curl-8.1.2/build/lib # ) - - aux_source_directory(./abstract ABSTRACT_SRC_FILES) aux_source_directory(./src IMPL_SRC_FILES) diff --git a/hal/src/HalCpp.cpp b/hal/src/HalCpp.cpp index 09f21bcd..252d766c 100644 --- a/hal/src/HalCpp.cpp +++ b/hal/src/HalCpp.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ #include "HalCpp.h" +#include "HalMakePtr.h" #include "ILog.h" StatusCode HalCpp::Init(void) { @@ -24,4 +25,8 @@ StatusCode HalCpp::UnInit(void) LogInfo("HalCpp::UnInit\n"); return CreateStatusCode(STATUS_CODE_OK); } -StatusCode HalCpp::GetWifiHal(std::shared_ptr &wifi) { return CreateStatusCode(STATUS_CODE_OK); } +StatusCode HalCpp::GetWifiHal(std::shared_ptr &wifi) +{ + HalMakePtr::GetInstance()->CreateWifiHal(wifi); + return CreateStatusCode(STATUS_CODE_OK); +} diff --git a/hal/src/HalMakePtr.cpp b/hal/src/HalMakePtr.cpp index 13c3e1c1..c6087537 100644 --- a/hal/src/HalMakePtr.cpp +++ b/hal/src/HalMakePtr.cpp @@ -16,6 +16,7 @@ #include "Hal.h" #include "HalCpp.h" #include "ILog.h" +#include "WifiHal.h" StatusCode CreateHalModule(void) { IHal *hal = NULL; @@ -73,4 +74,10 @@ StatusCode HalMakePtr::CreateHalSharePtr(std::shared_ptr &impl) LogWarning("IHalCpp is default.\n"); impl = std::make_shared(); return CreateStatusCode(STATUS_CODE_OK); +} +StatusCode HalMakePtr::CreateWifiHal(std::shared_ptr &impl) +{ + LogWarning("CreateWifiHal.\n"); + impl = std::make_shared(); + return CreateStatusCode(STATUS_CODE_OK); } \ No newline at end of file diff --git a/hal/src/HalMakePtr.h b/hal/src/HalMakePtr.h index a35df79d..491fdcb1 100644 --- a/hal/src/HalMakePtr.h +++ b/hal/src/HalMakePtr.h @@ -28,5 +28,6 @@ public: virtual StatusCode UnInit() { return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION); } virtual StatusCode CreateHalPtr(IHal **hal); virtual StatusCode CreateHalSharePtr(std::shared_ptr &impl); + virtual StatusCode CreateWifiHal(std::shared_ptr &impl); }; #endif \ No newline at end of file diff --git a/hal/src/WifiHal.cpp b/hal/src/WifiHal.cpp index f297c002..737d6f22 100644 --- a/hal/src/WifiHal.cpp +++ b/hal/src/WifiHal.cpp @@ -11,4 +11,14 @@ * 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. - */ \ No newline at end of file + */ +#include "WifiHal.h" +#include "LinuxApi.h" +StatusCode WifiHal::OpenApMode(void) +{ + fx_system("ifconfig wlan0 192.168.175.1 netmask 255.255.255.0"); + fx_system("hostapd -d /etc/hostapd.conf &"); + fx_system("touch /var/lib/misc/udhcpd.leases"); + fx_system("udhcpd -f /etc/udhcpd.conf &"); + return CreateStatusCode(STATUS_CODE_OK); +} \ No newline at end of file diff --git a/hal/src/WifiHal.h b/hal/src/WifiHal.h index 70384bc1..7cb38840 100644 --- a/hal/src/WifiHal.h +++ b/hal/src/WifiHal.h @@ -20,5 +20,6 @@ class WifiHal : public VWifiHal public: WifiHal() = default; virtual ~WifiHal() = default; + StatusCode OpenApMode(void) override; }; #endif \ No newline at end of file diff --git a/tools/clang-tidy/README.md b/tools/clang-tidy/README.md new file mode 100644 index 00000000..fd34a6c9 --- /dev/null +++ b/tools/clang-tidy/README.md @@ -0,0 +1,7 @@ +# 1. llvm系列工具 + +   git clone时可能会非常慢,且频繁失败(网速快时可正常),失败后请多次重试。最好在保证网速的情况下进行下载源码。 + +## 1.1. 使用说明 + +1. 在工程根目录执行make compile_llvm;会下载源码,编译,并把llvm源码包(含生成的工具文件)拷贝到用户根目录,以方便不同目录的源码工程可以复用llvm工具; \ No newline at end of file