├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── custom.md
│ └── feature_request.md
├── HiLens_framework
├── Atlas500使用说明.MD
├── CMakeLists.txt
├── HiLens Framework SDK.MD
├── HiLens_Framework.png
├── License
│ ├── LICENSE.txt
│ └── Open Source Software Notice.md
├── README.MD
├── README_ch.md
├── VERSION
├── build.sh
├── common
│ ├── include
│ │ ├── apigateway
│ │ │ ├── RequestParams.h
│ │ │ ├── constants.h
│ │ │ ├── hasher.h
│ │ │ ├── header.h
│ │ │ ├── signer.h
│ │ │ └── utils.h
│ │ ├── hilens_errorcode.h
│ │ ├── hstring.h
│ │ ├── message_mgr.h
│ │ ├── sf_common.h
│ │ ├── sfw_log.h
│ │ └── utils.h
│ └── lib
│ │ └── libhilens_common.so
├── deploy
│ ├── decode.graph
│ ├── encode.graph
│ ├── infer.graph
│ ├── install.sh
│ ├── logger.conf
│ ├── scc.conf
│ └── sfw.conf
├── engine
│ └── lib
│ │ ├── infer_engine.so
│ │ └── relay_engine.so
├── hda
│ └── hdacli
│ │ ├── python2
│ │ ├── hdacli_internal.py
│ │ ├── hdacli_wrap.cxx
│ │ └── hdacli_wrap.h
│ │ └── python3
│ │ ├── hdacli_internal.py
│ │ └── hdacli_wrap.cxx
├── hilens_media
│ ├── include
│ │ ├── HiLensAudioRpc.h
│ │ ├── HiLensMedia.h
│ │ ├── MediaComm.h
│ │ ├── MediaLog.h
│ │ └── MediaUtils.h
│ └── lib
│ │ └── libhilens_media.so
├── hilens_security
│ ├── include
│ │ ├── auth.h
│ │ ├── check_license.h
│ │ ├── conf.h
│ │ ├── device_utils.h
│ │ ├── hilens_security.h
│ │ ├── vdecoder.h
│ │ ├── vencoder.h
│ │ └── wsclient.h
│ └── lib
│ │ ├── libhilens_security.so
│ │ ├── libsc-common.so
│ │ ├── libsc-kmc.so
│ │ ├── libsc-pwdpolicy.so
│ │ ├── libsc-sdp.so
│ │ ├── libsc-secrypto.so
│ │ ├── libsc-securec.so
│ │ ├── libsc-zlog.so
│ │ └── libsc-zlog.so.1.2
├── include
│ ├── audio_capture.h
│ ├── audio_output.h
│ ├── ei_services.h
│ ├── errors.h
│ ├── hilens.h
│ ├── log.h
│ ├── media_process.h
│ ├── model.h
│ ├── output.h
│ ├── resource.h
│ └── video_capture.h
├── libhilens
│ ├── BlockingQueue.h
│ ├── CMakeLists.txt
│ ├── VideoCaptureEx.cpp
│ ├── VideoCaptureEx.h
│ ├── audio_capture.cpp
│ ├── audio_output.cpp
│ ├── audio_play.cpp
│ ├── audio_play.h
│ ├── display_hdmi.cpp
│ ├── display_hdmi.h
│ ├── dvpp_decoder.cpp
│ ├── dvpp_decoder.h
│ ├── dvpp_encoder.cpp
│ ├── dvpp_encoder.h
│ ├── ei_services.cpp
│ ├── ei_utils.cpp
│ ├── ei_utils.h
│ ├── encode_src_engine.cpp
│ ├── encode_src_engine.h
│ ├── file_audio.cpp
│ ├── file_audio.h
│ ├── h264_writer.cpp
│ ├── h264_writer.h
│ ├── hiai_common.cpp
│ ├── hiai_common.h
│ ├── hilens.cpp
│ ├── ipc_capture.cpp
│ ├── ipc_capture.h
│ ├── license_video_capture.cpp
│ ├── license_video_capture.h
│ ├── local_audio.cpp
│ ├── local_audio.h
│ ├── local_camera.cpp
│ ├── local_camera.h
│ ├── log.cpp
│ ├── media_process.cpp
│ ├── model.cpp
│ ├── model_impl.cpp
│ ├── model_impl.h
│ ├── mp4_reader.cpp
│ ├── mp4_reader.h
│ ├── obszilla
│ │ ├── obsutils.cpp
│ │ ├── obsutils.h
│ │ ├── obszilla.cpp
│ │ ├── obszilla.h
│ │ ├── request.cpp
│ │ └── request.h
│ ├── output.cpp
│ ├── relay_dvpp_engine.cpp
│ ├── relay_dvpp_engine.h
│ ├── resource.cpp
│ ├── route.cpp
│ ├── route.h
│ ├── rtmp_publisher.cpp
│ ├── rtmp_publisher.h
│ ├── rtsp_puller.cpp
│ ├── rtsp_puller.h
│ ├── src_engine.h
│ ├── src_engines.cpp
│ ├── uvc_capture.cpp
│ ├── uvc_capture.h
│ ├── vdecfactory.cpp
│ ├── vdecfactory.h
│ └── video_capture.cpp
├── python
│ ├── CMakeLists.txt
│ ├── hilens.i
│ ├── hilens.py
│ ├── hilens_internal.py
│ ├── hilens_wrap.cxx
│ ├── numpy.i
│ ├── wrapper.cpp
│ └── wrapper.h
└── third_party
│ ├── README.md
│ ├── README_ch.md
│ └── third_install.sh
├── LICENSE
├── README.md
├── contrib
└── README.MD
├── docs
├── HiLens 模型支持列表 - ddk893.MD
├── HiLens 部署 模型转换 算子网络支持清单.xlsx
├── HiLens常见问题-第1期.MD
├── README.md
└── pics
│ ├── FAQ_1.png
│ ├── FAQ_2.png
│ ├── FAQ_3.png
│ ├── FAQ_4.png
│ ├── FAQ_5.png
│ ├── FAQ_6.PNG
│ ├── Thumbs.db
│ ├── hilens.png
│ ├── hilens_platform.jpg
│ ├── hilens_size.png
│ ├── hilens_str.png
│ └── qr_code.png
├── official_examples
├── ModelArts + HiLens 端云协同,开发手势识别AI应用
│ ├── README.md
│ ├── gesture_main.py
│ └── img
│ │ ├── HiLens_authorize.PNG
│ │ ├── Hilens_Kit_connectwifi.png
│ │ ├── Hilens_Kit_connectwifi2.png
│ │ ├── connect_to_computer.png
│ │ ├── connect_to_computer2.PNG
│ │ ├── connect_to_computer3.png
│ │ ├── console.png
│ │ ├── convert_model.png
│ │ ├── create_obs.png
│ │ ├── create_skill.png
│ │ ├── create_skill2.png
│ │ ├── default_gateway.png
│ │ ├── default_gateway2.png
│ │ ├── delete_skill.PNG
│ │ ├── delete_skill2.PNG
│ │ ├── deploy.PNG
│ │ ├── flow.jpg
│ │ ├── hdactl.png
│ │ ├── ies.jpg
│ │ ├── import_model.png
│ │ ├── ma_pipeline.png
│ │ ├── maincode.png
│ │ ├── mobaxterm.PNG
│ │ ├── ping.png
│ │ ├── ping_hilens_kit_ip.png
│ │ ├── set_IP_adress.png
│ │ ├── set_IP_adress2.png
│ │ ├── sign_up_HiLens.PNG
│ │ ├── skillmanager.PNG
│ │ ├── skillmanager2.PNG
│ │ ├── stop_skill.PNG
│ │ ├── trainjob-parameter.png
│ │ ├── trainjob-source.png
│ │ ├── trainjob-test.png
│ │ └── update_HiLens.PNG
├── 一键部署AI模型到端侧设备Hilens Kit
│ ├── README.md
│ └── img
│ │ ├── HiLens_authorize.PNG
│ │ ├── Hilens_Kit_connectwifi.png
│ │ ├── Hilens_Kit_connectwifi2.png
│ │ ├── connect_to_computer.png
│ │ ├── connect_to_computer2.PNG
│ │ ├── connect_to_computer3.png
│ │ ├── console.png
│ │ ├── convert_model.png
│ │ ├── create_obs.png
│ │ ├── create_skill.png
│ │ ├── create_skill2.png
│ │ ├── default_gateway.png
│ │ ├── default_gateway2.png
│ │ ├── delete_skill.PNG
│ │ ├── delete_skill2.PNG
│ │ ├── deploy.PNG
│ │ ├── deploy2.PNG
│ │ ├── flow.jpg
│ │ ├── flow.png
│ │ ├── hdactl.png
│ │ ├── ies.jpg
│ │ ├── import_model.png
│ │ ├── ma_pipeline.png
│ │ ├── maincode.png
│ │ ├── mobaxterm.PNG
│ │ ├── ping.png
│ │ ├── ping_hilens_kit_ip.png
│ │ ├── purchase_1.PNG
│ │ ├── purchase_2.PNG
│ │ ├── set_IP_adress.png
│ │ ├── set_IP_adress2.png
│ │ ├── sign_up_HiLens.PNG
│ │ ├── skillmanager.PNG
│ │ ├── skillmanager2.PNG
│ │ ├── start.PNG
│ │ ├── stop_skill.PNG
│ │ ├── trainjob-parameter.png
│ │ ├── trainjob-source.png
│ │ ├── trainjob-test.png
│ │ ├── update_HiLens.PNG
│ │ ├── 人脸检测.PNG
│ │ └── 参数.PNG
└── 技能模板
│ ├── Face_Detection_Template
│ ├── main.py
│ ├── models
│ │ └── face_detection_demo.om
│ └── postprocess.py
│ ├── Face_Landmarks_Detection_Template
│ ├── index.py
│ ├── models
│ │ ├── centerface_template_model.om
│ │ └── landmark68_template_model.om
│ └── utils.py
│ ├── Helmet_Detection_Template
│ ├── index.py
│ ├── models
│ │ └── helmet_template_model.om
│ └── utils.py
│ ├── Single_Human_Pose_Template
│ ├── index.py
│ ├── models
│ │ └── pose_template_model.om
│ └── utils.py
│ └── Static_Gesture_Recognition_Template
│ ├── index.py
│ ├── models
│ └── gesture_template_model.om
│ └── utils.py
└── tools
├── HiLens Kit + ROS
├── README.MD
├── ROS程序编译指导文档.MD
├── install_rpm.sh
└── pics
│ ├── pic_1.png
│ ├── pic_10.png
│ ├── pic_11.png
│ ├── pic_12.png
│ ├── pic_13.png
│ ├── pic_14.png
│ ├── pic_15.png
│ ├── pic_16.png
│ ├── pic_17.png
│ ├── pic_18.png
│ ├── pic_19.png
│ ├── pic_2.png
│ ├── pic_3.png
│ ├── pic_4.png
│ ├── pic_5.png
│ ├── pic_6.png
│ ├── pic_7.png
│ ├── pic_8.png
│ ├── pic_9.png
│ ├── ros_1.png
│ ├── ros_2.png
│ ├── ros_3.png
│ └── ros_4.png
├── HiLens Kit - yum
├── README.MD
└── rpm.zip
├── HiLens Kit-gdb
├── README.MD
└── gdb.rar
└── README.MD
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/custom.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Custom issue template
3 | about: Describe this issue template's purpose here.
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/HiLens_framework/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0)
2 |
3 | project(SkillFramework)
4 |
5 | # 使用C++11标准
6 | set(CMAKE_CXX_STANDARD 11)
7 |
8 | #ADD_DEFINITIONS(-g)
9 |
10 | # 当CLOUD为ON时,编译Studio版本
11 | if(CLOUD)
12 | message("\nBuilding Framework for studio...\n")
13 | add_definitions(-DCLOUD)
14 | endif()
15 |
16 | if(CLOUD)
17 | set(DDK_Version "893")
18 | set(JsonLib "jsoncpp-cloud")
19 | set(log4cpluslib "log4cplus-cloud")
20 | else()
21 | # 使用B887版本DDK的HOST侧库需要加上此编译选项
22 | add_compile_options(-D_GLIBCXX_USE_CXX11_ABI=0)
23 | set(DDK_Version "887")
24 | set(JsonLib "jsoncpp")
25 | set(log4cpluslib "log4cplus")
26 | endif()
27 |
28 | if(CMAKE_BUILD_TYPE MATCHES DEBUG)
29 | set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
30 | endif()
31 |
32 | # 添加安全编译选项
33 | add_compile_options(-fstack-protector-strong)
34 | set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
35 | set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now,-z,noexecstack -pie")
36 |
37 | # 不自动添加rpath
38 | set(CMAKE_SKIP_RPATH TRUE)
39 | set(CMAKE_SKIP_BUILD_RPATH TRUE)
40 | set(CMAKE_SKIP_INSTALL_RPATH TRUE)
41 |
42 | # 当SFW_OFFLINE为ON时,编译离线版本
43 | if(SF_OFFLINE)
44 | message("\nBuilding offline package...\n")
45 | add_definitions(-DSF_OFFLINE)
46 | endif()
47 |
48 |
49 | include_directories(${CMAKE_SOURCE_DIR}/third_party/openssl/include)
50 | include_directories(${CMAKE_SOURCE_DIR}/third_party/curl/include)
51 | include_directories(${CMAKE_SOURCE_DIR}/third_party/ddk_${DDK_Version}/include/third_party/opencv/include)
52 |
53 | link_directories(${CMAKE_SOURCE_DIR}/third_party/ApiGateway/lib/${LIB_DIR})
54 | link_directories(${CMAKE_SOURCE_DIR}/third_party/srslibrtmp/lib/${LIB_DIR})
55 | link_directories(${CMAKE_SOURCE_DIR}/third_party/python/lib/${LIB_DIR})
56 | link_directories(${CMAKE_SOURCE_DIR}/third_party/curl/lib/${LIB_DIR})
57 | link_directories(${CMAKE_SOURCE_DIR}/third_party/ffmpeg/lib/${LIB_DIR})
58 | link_directories(${CMAKE_SOURCE_DIR}/third_party/${JsonLib}/lib/${LIB_DIR})
59 | link_directories(${CMAKE_SOURCE_DIR}/third_party/openssl/lib/${LIB_DIR})
60 | link_directories(${CMAKE_SOURCE_DIR}/third_party/${log4cpluslib}/lib/${LIB_DIR})
61 | link_directories(${CMAKE_SOURCE_DIR}/third_party/nanomsg/lib/${LIB_DIR})
62 | link_directories(${CMAKE_SOURCE_DIR}/third_party/json-c/lib/${LIB_DIR})
63 | link_directories(${CMAKE_SOURCE_DIR}/third_party/zlog/lib/${LIB_DIR})
64 | link_directories(${CMAKE_SOURCE_DIR}/third_party/ddk_${DDK_Version}/lib/host/${LIB_DIR})
65 | link_directories(${CMAKE_SOURCE_DIR}/third_party/boost/lib/${LIB_DIR})
66 | link_directories(${CMAKE_SOURCE_DIR}/hilens_media/lib/${LIB_DIR})
67 | link_directories(${CMAKE_SOURCE_DIR}/common/lib/${LIB_DIR})
68 | link_directories(${CMAKE_SOURCE_DIR}/hilens_security/lib/${LIB_DIR})
69 |
70 | add_subdirectory(libhilens)
71 | add_subdirectory(python)
72 |
--------------------------------------------------------------------------------
/HiLens_framework/HiLens Framework SDK.MD:
--------------------------------------------------------------------------------
1 | # Huawei HiLens Framework
2 | Huawei HiLens Framework开发工具包(Huawei HiLens Framework SDK,Huawei HiLens Framework Software Development Kit)是HiLens Kit上运行的HiLens Framework的c++开发包,使用户可以开发c++版本的技能并在HiLens Kit上运行。
3 |
4 | ## Huawei HiLens Framework 简介
5 |
6 | Huawei HiLens Framework通过封装底层接口、实现常用的管理功能,让开发者可以在Huawei HiLens管理控制台上方便地开发技能,培育AI生态。
7 | Huawei HiLens Framework的分层结构如图:
8 |
9 |

10 |
11 | Huawei HiLens Framework封装了底层的多媒体处理库(摄像头/麦克风驱动模块Media_mini),以及D芯片相关的图像处理库(DVPP)和模型管理库(ModelManager),另外开发者也可以使用熟悉的视觉处理库OpenCV。在此之上,Huawei HiLens Framework提供了以下6个模块供开发者使用,方便开发诸如人形检测、人脸识别、疲劳驾驶检测等技能,模块说明如表所示:
12 |
13 |
14 | | 序号 | 模块 | 功能 |
15 | | --- | --- | --- |
16 | | 1 | Input Manager | 负责视频、音频等输入数据的接入管理|
17 | | 2 | Media Processor | 负责视频、音频等媒体数据的处理 |
18 | | 3 | Model Manager | 负责模型的初始化与推断任务 |
19 | | 4 | Output Manager | 负责流、文件、消息通知等输出任务的管理 |
20 | | 5 | Resource Manager | 负责文件、图片、模型等资源的路径管理 |
21 | | 6 | Logging System | 负责日志系统管理 |
22 |
23 | ## 环境准备
24 |
25 | ### 环境搭建
26 |
27 | 1. 查看您的编译机Linux系统环境。
28 | 执行uname -a可查看Linux系统信息,例如查看x86_64的ubuntu系统信息:
29 | Linux ubuntu 4.4.0-144-generic #170-Ubuntu SMP Thu Mar 14 11:56:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
30 | 2. 查看端侧设备HiLens Kit的系统环境。
31 | 登录端侧设备的系统环境请参见使用SSH连接到HiLens Kit。
32 | 例执uname -a,可得如下HiLens Kit系统环境:
33 | Linux Euler 4.19.36-vhulk1907.1.0.h448.eulerosv2r8.aarch #1 SMP Mon Jul 22 00.00.00 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
34 | 3. 下载交叉编译工具,并解压下载的压缩包。
35 | 如果您的编译机是x86_64的Linux系统,可以直接下载我们提供的交叉编译工具,里面已经包含了HiLens Kit上需要的库。
36 | 4. 进入交叉编译工具目录后,执行指令pwd获取路径位置,编译时设置编译器路径。
37 | 如果您的编译机是x86_64的Linux系统,路径位置是“.../aarch64-linux-gnu-gcc-7.3.0”,则编译时设置路径为:
38 | export CC=".../aarch64-linux-gnu-gcc-7.3.0/bin/aarch64-linux-gnu-gcc"
39 | export CXX=".../aarch64-linux-gnu-gcc-7.3.0/bin/aarch64-linux-gnu-g++"
40 | 详细的编译指导请参考步骤6中的示例代码。
41 | 5. 下载Huawei HiLens Framework SDK开发包:“cloud-c-sdk-HiLensFramework-1.0.4.tar.gz”,并解压,重命名文件名。
42 | Huawei HiLens Framework SDK软件包下载地址为:https://hilens-framework-sdk-demo.obs.cn-north-1.myhuaweicloud.com/sdk/cloud-c-sdk-HiLensFramework-1.0.4.tar.gz
43 | 6. 参考示例程序和接口调用说明进行代码开发,编译指导和示例代码说明,详见示例代码中的“README.md”。
44 | Huawei HiLens Framework示例代码下载地址为:https://hilens-framework-sdk-demo.obs.cn-north-1.myhuaweicloud.com/demo/license-plate-recognition-demo.zip
45 |
46 | *Note* :
47 |
48 | 1. 搭建环境时,下载SDK开发包和参考示例程序进行代码开发必须在编译机上进行安装、调试。
49 | 2. 开发过程中,您有任何问题可以在Huawei HiLens服务论坛中发帖求助
50 |
51 | ## 初始化 HiLens Framework
52 |
53 | 该接口用于初始化HiLens Framework。在调用HiLens Framework的其他接口之前,需要先做全局初始化。
54 |
55 | * 接口调用
56 |
57 | ```
58 | HiLensEC hilens::Init(const std::string & verify)
59 | ```
60 |
61 | * 参数说明
62 |
63 | | 参数名 | 说明|
64 | | --- | --- |
65 | |verify | 应与Huawei HiLens管理控制台上新建技能时,所填写的“基本信息”中的“检验值”一致。如果不一致,HiLens Framework会强制技能停止。|
66 |
67 | * 返回值
68 |
69 | HiLensEC,错误码。0为成功,其他为失败。
--------------------------------------------------------------------------------
/HiLens_framework/HiLens_Framework.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/huaweicloud/HiLens-Lab/2b0613db2a40ec86c267bc69076e9fb7987fc610/HiLens_framework/HiLens_Framework.png
--------------------------------------------------------------------------------
/HiLens_framework/VERSION:
--------------------------------------------------------------------------------
1 | 1.1.0
2 |
--------------------------------------------------------------------------------
/HiLens_framework/common/include/apigateway/RequestParams.h:
--------------------------------------------------------------------------------
1 | /* *
2 | * Copyright 2020 Huawei Technologies Co., Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef SRC_REQUESTPARAMS_H_
18 | #define SRC_REQUESTPARAMS_H_
19 | #include
20 | #include
21 | #include "header.h"
22 |
23 | class RequestParams {
24 | public:
25 | RequestParams();
26 | RequestParams(std::string method, std::string host, std::string uri, std::string queryParams);
27 | RequestParams(std::string method, std::string host, std::string uri, std::string queryParams, std::string payload);
28 | virtual ~RequestParams();
29 |
30 | const std::string getMethod();
31 | const std::string getHost();
32 | const std::string getUri();
33 | const std::string getQueryParams();
34 | const std::string getPayload();
35 | const std::set *getHeaders();
36 |
37 | void addHeader(Header &header);
38 | void addHeader(std::string key, std::string value);
39 | std::string initHeaders();
40 |
41 | private:
42 | /* HTTP Request Parameters */
43 | std::string mMethod;
44 | std::string mHost;
45 | std::string mUri;
46 | std::string mQueryParams;
47 | std::string mPayload;
48 |
49 | std::set mHeaders;
50 | };
51 |
52 | #endif /* SRC_REQUESTPARAMS_H_ */
53 |
--------------------------------------------------------------------------------
/HiLens_framework/common/include/apigateway/constants.h:
--------------------------------------------------------------------------------
1 | /* *
2 | * Copyright 2020 Huawei Technologies Co., Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef SRC_CONSTANTS_H_
18 | #define SRC_CONSTANTS_H_
19 |
20 | #include
21 | namespace defaults {
22 | static const std::string sdk_signing_algorithm = "SDK-HMAC-SHA256";
23 | static const std::string dateFormat = "X-Sdk-Date";
24 | static const std::string host = "Host";
25 | }
26 |
27 | #endif /* SRC_CONSTANTS_H_ */
28 |
--------------------------------------------------------------------------------
/HiLens_framework/common/include/apigateway/hasher.h:
--------------------------------------------------------------------------------
1 | /* *
2 | * Copyright 2020 Huawei Technologies Co., Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef SRC_HASHER_H_
18 | #define SRC_HASHER_H_
19 |
20 | #include
21 | #include "constants.h"
22 |
23 | class Hasher {
24 | public:
25 | Hasher();
26 | ~Hasher();
27 | const std::string hexEncode(unsigned char *md, size_t len);
28 | int hashSHA256(const std::string &str, int len, unsigned char *hash);
29 | unsigned char *hmac(const void *key, unsigned int keyLength, const std::string &data);
30 | };
31 |
32 | #endif /* SRC_HASHER_H_ */
33 |
--------------------------------------------------------------------------------
/HiLens_framework/common/include/apigateway/header.h:
--------------------------------------------------------------------------------
1 | /* *
2 | * Copyright 2020 Huawei Technologies Co., Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef SRC_HEADER_H_
18 | #define SRC_HEADER_H_
19 |
20 | #include
21 | #include
22 | #include "utils.h"
23 |
24 | class Header {
25 | public:
26 | Header(const std::string key)
27 | {
28 | mKey = key;
29 | }
30 |
31 | Header(const std::string &key, const std::string &value)
32 | {
33 | mKey = key;
34 | mValues = value;
35 | }
36 |
37 | std::string getKey()
38 | {
39 | return mKey;
40 | }
41 |
42 | const std::string &getValue()
43 | {
44 | return mValues;
45 | }
46 |
47 | void setValue(std::string value)
48 | {
49 | mValues = value;
50 | }
51 |
52 | bool operator < (const Header &r) const
53 | {
54 | if (toLowerCaseStr(this->mKey).compare(toLowerCaseStr(r.mKey)) < 0) {
55 | return true;
56 | } else {
57 | return false;
58 | }
59 | }
60 | ~Header() {}
61 |
62 | private:
63 | std::string mKey;
64 | std::string mValues;
65 | };
66 |
67 |
68 | #endif /* SRC_HEADER_H_ */
69 |
--------------------------------------------------------------------------------
/HiLens_framework/common/include/apigateway/signer.h:
--------------------------------------------------------------------------------
1 | /* *
2 | * Copyright 2020 Huawei Technologies Co., Ltd
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef SRC_SIGNER_H_
18 | #define SRC_SIGNER_H_
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include