当前位置:网站首页>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
边栏推荐
- 中文招聘文档中专业技能词抽取的跨域迁移学习
- fluke dtx-1800测试精度有必要进行原厂校准吗?
- C process control statement
- 分而治之,大型文件分片上传
- Object based real-time spatial audio rendering - Dev for dev column
- I have been in the industry for 4 years and changed jobs twice. I have understood the field of software testing~
- [英雄星球七月集训LeetCode解题日报] 第28日 动态规划
- Week 6 Linear Models for Classification (Part B)
- 纳米金偶联抗体/蛋白试剂盒(20nm,1mg/100μg/500 μg偶联量)的制备
- Explain C language 12 in detail (C language series)
猜你喜欢

株洲市九方中学开展防溺水、消防安全教育培训活动

Uniapp progress bar customization

Detailed explanation of JVM memory layout (glory collection version)
![Leetcode interview question 02.07. Linked list intersection [knowledge points: Double pointers, stack]](/img/51/ec623bb609f5f57150e7244cf5f9b7.png)
Leetcode interview question 02.07. Linked list intersection [knowledge points: Double pointers, stack]

Matlab | basic knowledge summary I

纳米金偶联抗体/蛋白试剂盒(20nm,1mg/100μg/500 μg偶联量)的制备

聊一聊数据库的行存与列存

8、 QoS queue scheduling and message discarding

Adventures of little mouse: behind the scenes gags of moss 2

基于属性词补全的武器装备属性抽取研究
随机推荐
如何高效、精准地进行图片搜索?看看轻量化视觉预训练模型
Vimtutor编辑
基于BRNN的政务APP评论端到端方面级情感分析方法
Pytorch学习记录(四):过拟合、卷积神经网络CNN
Is it necessary to calibrate the fluke dtx-1800 test accuracy?
How to understand data mesh
Discussion: if you want to land Devops, is it enough to only consider a good PAAS container platform?
Miscellaneous records of powersploit, evaluation, weevery and other tools in Kali
聊一聊数据库的行存与列存
小程序开发需要什么技术
Divide and conquer, upload large files in pieces
LeetCode·581.最短无序连续子数组·双指针
Leetcode linked list question - interview question 02.07. linked list intersection (learn linked list by one question and one article)
微信小程序开发公司你懂得选择吗?
二 RedisTemplate的序列和反序列化机制讲解
国产芯片厂商助力,2020年白牌TWS耳机出货已达6亿部
For the next generation chromebook, MediaTek launched new chipsets mt8192 and mt8195
First week of internship diary
C process control statement
openEuler Embedded SIG | 分布式软总线