当前位置:网站首页>Openeuler embedded sig | distributed soft bus
Openeuler embedded sig | distributed soft bus
2022-07-28 21:55:00 【InfoQ】
Feature introduction
background
framework

- Plug and play: Quickly and conveniently discover peripheral devices .
- Free circulation: Ad hoc network among equipment , Establish any business connection , Realize free communication .
- Efficient transmission: adopt WIFI、 Under Bluetooth device, hardware and software cooperate to maximize hardware transmission performance .
Application Guide
Deployment diagram

Server startup
softbus_server_mainopeneuler ~ # softbus_server_main >log.file &client API
/usr/include/dsoftbus/- discovery_service.h: Found module header file , Support application active detection and release API as follows :

g\_capabilityMap- softbus_bus_center.h: Networking module header file , Support to obtain equipment information in the network API as follows :

- session.h: Connect / Transfer module header file , Support the creation of session And data transfer API as follows :

Application example
- Write client program
- install SDK
sh openeuler-glibc-x86_64-openeuler-image-aarch64-qemu-aarch64-toolchain-22.03.sh/opt/openeuler/<openeuler version>/sh ./openeuler-glibc-x86_64-openeuler-image-armv7a-qemu-arm-toolchain-22.03.sh``
openEuler embedded(openEuler Embedded Reference Distro) SDK installer version 22.03
================================================================
Enter target directory for SDK (default: /opt/openeuler/22.03): sdk
You are about to install the SDK to "/usr1/openeuler/sdk". Proceed [Y/n]? y
Extracting SDK...............................................done
Setting it up...SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
. /usr1/openeuler/sdk/environment-setup-armv7a-openeuler-linux-gnueabi- Set up SDK environment variable
. /usr1/openeuler/myfiles/sdk/environment-setup-armv7a-openeuler-linux-gnueabi- Check whether the installation is successful
arm-openeuler-linux-gnueabi-gcc -vmain.c#include "dsoftbus/softbus_bus_center.h"
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int32_t infoNum = 10;
NodeBasicInfo **testInfo = malloc(sizeof(NodeBasicInfo *) * infoNum);
int ret = GetAllNodeDeviceInfo("testClient", testInfo, &infoNum);
if (ret != 0) {
printf("Get node device info fail.\n");
return 0;
}
printf("Get node num: %d\n", infoNum);
for (int i = 0; i < infoNum; i++) {
printf("\t networkId: %s, deviceName: %s, deviceTypeId: %d\n",
testInfo[i]->networkId,
testInfo[i]->deviceName,
testInfo[i]->deviceTypeId);
}
for (int i = 0; i < infoNum; i++) {
FreeNodeInfo(testInfo[i]);
}
free(testInfo);
testInfo = NULL;
return 0;
}CMakeLists.txtproject(dsoftbus_hello C)
add_executable(dsoftbus_hello main.c)
target_link_libraries(dsoftbus_hello dsoftbus_bus_center_service_sdk.z)mkdir build
cd build
cmake ..
makedsoftbus_hello- structure QEMU Networking environment
brctl addbr br0qemu-system-aarch64 -M virt-4.0 -m 1G -cpu cortex-a57 -nographic -kernel zImage -initrd <openeuler-image-qemu-xxx.cpio.gz> -device virtio-net-device,netdev=tap0,mac=52:54:00:12:34:56 -netdev bridge,id=tap0failed to parse default acl file `/usr/local/libexec/../etc/qemu/bridge.conf'
qemu-system-aarch64: bridge helper failedecho "allow br0" > /usr/local/libexec/../etc/qemu/bridge.confqemu-system-aarch64 -M virt-4.0 -m 1G -cpu cortex-a57 -nographic -kernel zImage -initrd openeuler-image-qemu-aarch64-20220331025547.rootfs.cpio.gz -device virtio-net-device,netdev=tap1,mac=52:54:00:12:34:78 -netdev bridge,id=tap1ifconfig br0 192.168.10.1 upifconfig eth0 192.168.10.2ifconfig eth0 192.168.10.3- Start the distributed soft bus
softbus_server_main >log.file &scp dsoftbus_hello [email protected]:/
scp dsoftbus_hello [email protected]:/[LNN]NodeStateCbCount is 10
[LNN]BusCenterClientInit init OK!
[DISC]Init success
[TRAN]init tcp direct channel success.
[TRAN]init succ
[COMM]softbus server register service success!
[COMM]softbus sdk frame init success.
Get node num: 1
networkId: 714373d691265f9a736442c01459ba39236642c743a71750bb63eb73cde24f5f, deviceName: UNKNOWN, deviceTypeId: 0
[LNN]NodeStateCbCount is 10
[LNN]BusCenterClientInit init OK!
[DISC]Init success
[TRAN]init tcp direct channel success.
[TRAN]init succ
[COMM]softbus server register service success!
[COMM]softbus sdk frame init success.
Get node num: 1
networkId: eaf591f64bab3c20304ed3d3ff4fe1d878a0fd60bf8c85c96e8a8430d81e4076,deviceName: UNKNOWN, deviceTypeId: 0
Compilation guide
- The warehouse where the script is downloaded ( For example, download to
src/yocto-meta-openeulerUnder the table of contents )
git clone https://gitee.com/openeuler/yocto-meta-openeuler.git -b openEuler-22.03-LTS -v src/yocto-meta-openeuler- Execute the download script
sh src/yocto-meta-openeuler/scripts/download_code.sh dsoftbusyocto-meta-openeulerdsoftbus/_standardyocto-embedded-toolssh src/yocto-meta-openeuler/scripts/compile.sh dsoftbusdsoftbus/_builddsoftbus/_outputyocto-meta-openeulerRestriction constraint
Pay attention to our
边栏推荐
- 这种动态规划你见过吗——状态机动态规划之股票问题(下)
- LeetCode链表问题——面试题02.07.链表相交(一题一文学会链表)
- 网格数据生成函数meshgrid
- Research on intangible cultural heritage image classification based on multimodal fusion
- Cy3/cy5/cy5.5/cy7 fluorescent labeling antibody / protein Kit (10~100mg labeling amount)
- Professional Committee of agricultural water and soil engineering of China Association of Agricultural Engineering - 12th session - Notes
- 基于多模态融合的非遗图片分类研究
- Rhcsa first day
- Cy3/Cy5/Cy5.5/Cy7荧光标记抗体/蛋白试剂盒(10~100mg标记量)
- 中国农业工程学会农业水土工程专业委员会-第十二届-笔记
猜你喜欢

日志瘦身神操作:从5G优化到1G到底是怎么做到的!(荣耀典藏版)

Pytorch learning record (4): over fitting, convolution neural network CNN

PyQt5快速开发与实战 5.4 网页交互

msfvenom制作主控与被控端

Is it necessary to calibrate the fluke dtx-1800 test accuracy?

LeetCode链表问题——142.环形链表II(一题一文学会链表)

Uniapp progress bar customization

Meta opens the project aria pilot dataset and will develop real-time 3D maps in the future

LeetCode链表问题——面试题02.07.链表相交(一题一文学会链表)

Talk about row storage and column storage of database
随机推荐
Meeting notice of OA project (Query & whether to attend the meeting & feedback details)
分而治之,大型文件分片上传
Divide and conquer, upload large files in pieces
Research on weapon equipment attribute extraction based on attribute word completion
详解visual studio 2015在局域网中远程调试程序
Detailed explanation of JVM memory layout (glory collection version)
LeetCode链表问题——142.环形链表II(一题一文学会链表)
Modify the port number of MySQL (is there a problem modifying the port number of MySQL)
Mesh data generation function meshgrid
Why does Baidu search only crawl, but not show the page?
【英雄哥七月集训】第 28天:动态规划
It is said that Microsoft has obtained the supply license for Xianghua! Will Huawei usher in the full lifting of the ban?
1945. sum of digits after string conversion
Construction of Chinese traditional embroidery classification model based on xception TD
节省70%的显存,训练速度提高2倍!浙大&阿里提出在线卷积重新参数化OREPA,代码已开源!(CVPR 2022 )
Standard C language learning summary 10
[极客大挑战 2019]Secret File&文件包含常用伪协议以及姿势
1162. Map analysis - non recursive method
The University was abandoned for three years, the senior taught himself for seven months, and found a 12K job
Skiasharp's WPF self drawn drag ball (case version)