当前位置:网站首页>openEuler Embedded SIG | 分布式软总线
openEuler Embedded SIG | 分布式软总线
2022-07-28 19:49:00 【InfoQ】
特性介绍
背景
架构

- 即插即用:快速便捷发现周边设备。
- 自由流转:各设备间自组网,任意建立业务连接,实现自由通信。
- 高效传输:通过WIFI、蓝牙设备下软硬件协同最大化发挥硬件传输性能。
应用指南
部署示意

服务端启动
softbus_server_mainopeneuler ~ # softbus_server_main >log.file &客户端API
/usr/include/dsoftbus/- discovery_service.h:发现模块头文件,支持应用主动探测和发布的API如下:

g\_capabilityMap- softbus_bus_center.h:组网模块头文件,支持获取组网内设备信息API如下:

- session.h:连接/传输模块头文件,支持创建session和数据传输API如下:

应用示例
- 编写客户端程序
- 安装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- 设置SDK环境变量
. /usr1/openeuler/myfiles/sdk/environment-setup-armv7a-openeuler-linux-gnueabi- 查看是否安装成功
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- 构建QEMU组网环境
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- 启动分布式软总线
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
编译指导
- 下载脚本所在仓库(例如下载到
src/yocto-meta-openeuler目录下)
git clone https://gitee.com/openeuler/yocto-meta-openeuler.git -b openEuler-22.03-LTS -v src/yocto-meta-openeuler- 执行下载脚本
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-openeuler限制约束
关注我们
边栏推荐
- How NPM switches Taobao source images
- CVPR 2022 | in depth study of batch normalized estimation offset in network
- Api 接口优化的几个技巧
- 移动端空余部位自动填充
- First week of internship diary
- 牛客打开摄像头几秒后画面消失 | 相机打开画面一闪一闪
- Ctfshow network lost track record (2)
- Guanghetong & Qualcomm Internet of things technology open day successfully held
- Leetcode linked list problem -- 142. circular linked list II (learn the linked list by one question and one article)
- Maintenance of delta hot metal detector principle analysis of v5g-jc-r1 laser measurement sensor / detector
猜你喜欢

(PMIC)全、半桥驱动器CSD95481RWJ PDF 规格

Eureka registers with each other, only showing each other or only showing problems in one

How to build a foreign environment for the self-supporting number of express evaluation? How much does it cost?

Ctfshow network lost track record (1)

技术选型Rust——事后分析

Confession of a graduate student: why am I addicted to opengauss community?

(PMIC) full and half bridge drive csd95481rwj PDF specification

Ijcai2022 tutorial | dialogue recommendation system

Discussion: if you want to land Devops, is it enough to only consider a good PAAS container platform?

Study and use of cobalt strike
随机推荐
实习日记第一周
[input ID number] is replaced by an asterisk, and input is cut into multiple small squares (similar)
Using El date picker to report errors in sub components
酷派主动终止针对小米公司的专利侵权诉讼
Uniapp progress bar customization
Uncaught Error:Invalid geoJson format Cannot read property ‘length‘ of undefind
国产芯片厂商助力,2020年白牌TWS耳机出货已达6亿部
CVPR 2022 | 网络中批处理归一化估计偏移的深入研究
Achieve waterfall effect
How does lazada store make up orders efficiently? (detailed technical explanation of evaluation self-supporting number)
Paging function (board)
百度搜索为什么只抓取,却不展现页面?
The framing efficiency of setpreviewcallbackwithbuffer will become lower
LeetCode链表问题——142.环形链表II(一题一文学会链表)
The development of smart home industry pays close attention to edge computing and applet container technology
Ijcai2022 tutorial | dialogue recommendation system
Young freshmen yearn for more open source | here comes the escape guide from open source to employment!
工业通讯领域的总线、协议、规范、接口、数据采集与控制系统
High salary in the workplace | "intermediate and advanced test" interview questions
MySQL