搜索
查看
编辑修改
首页
UNITY
NODEJS
PYTHON
AI
GIT
PHP
GO
CEF3
JAVA
HTML
CSS
搜索
2023面试高手
这个屌丝很懒,什么也没留下!
关注作者
热门标签
jquery
HTML
CSS
PHP
ASP
PYTHON
GO
AI
C
C++
C#
PHOTOSHOP
UNITY
iOS
android
vue
xml
爬虫
SEO
LINUX
WINDOWS
JAVA
MFC
CEF3
CAD
NODEJS
GIT
Pyppeteer
article
热门文章
1
自己对蓝桥杯的一点认识以及如何备赛总结_大三参加蓝桥杯晚吗
2
QQ/微信防撤回插件
3
idea集成Gitee详细步骤_idea整合gitee
4
vscode找回代码
5
模拟集成电路设计:Bandgap电路设计及版图实现
6
Ubuntu 22.04 下安装 MySQL 8.0.30 以及 MySQL Workbench连接等问题_mysql-workbench-community-dbgsym
7
常用的python库_textfilter 怎样使用
8
python软件哪个版本好用,python哪个版本用得最多_python更新到哪个版本了
9
实验室安全 考试 题库_如果得知有火,实验指导教师
10
idea的这款代码提示插件爱了_idea ai代码提示插件
当前位置:
article
> 正文
蓝牙程序编写例子
作者:2023面试高手 | 2024-04-25 06:29:38
赞
踩
蓝牙程序编写
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
int main(int argc, char **argv)
{
inquiry_info *ii = NULL;
int max_rsp, num_rsp;
int dev_id, sock, len, flags;
int i;
char addr[19] = { 0 };
char name[248] = { 0 };
dev_id = hci_get_route(NULL);
sock = hci_open_dev( dev_id );
if (dev_id < 0 || sock < 0) {
perror("opening socket");
exit(1);
}
len = 8;
max_rsp = 255;
flags = IREQ_CACHE_FLUSH;
ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags);
if( num_rsp < 0 ) perror("hci_inquiry");
for (i = 0; i < num_rsp; i++) {
ba2str(&(ii+i)->bdaddr, addr);
memset(name, 0, sizeof(name));
if (hci_read_remote_name(sock, &(ii+i)->bdaddr, sizeof(name),
name, 0) < 0)
strcpy(name, "[unknown]");
printf("%s %s/n", addr, name);
}
free( ii );
close( sock );
return 0;
}
/*先安装bluez-libs 蓝牙协议栈*/
/*gcc test.c -o test -lbluetooth */
声明:
本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:
https://www.wpsshop.cn/w/2023面试高手/article/detail/483739
推荐阅读
article
【
计算机网络
自顶向下
方法】
MSS
(
Maximum
Segment
Size
)...
TCP可以从缓存中取出并放入报文段中的数据数量受限于最大报文段长度(
Maximum
Segment
Size
,
MSS
)。...
赞
踩
article
(亲测有效)
Spring
Boot
项目
Jar包
加密
,防止反编译_
springboot
加密
打包...
最近Java
项目
要求部署到客户服务器上,但担心泄露源码。要求对正式环境的启动包进行安全性处理,防止客户通过反编译获取源代...
赞
踩
article
Linux
网络
流量
实时监控
ifstat
iftop
命令详解_判断本机
流量
(/
usr
/
bin
/ifst...
ifstat
介绍
ifstat
工具是个网络接口监测工具
,
比较简单看网络
流量
实例默认使用#
ifstat
eth0 ...
赞
踩
article
cargo
使用国内的
镜像
_
cargo
镜像
...
需要替换
镜像
可以修改, 替换成自己想要的
镜像
名称。
_
cargo
镜像
cargo
镜像
...
赞
踩
article
Linux
下
指针
NULL
_
0x0
_
指针
为
0x0
...
Linux
下
指针
NULL
_
0x0
_
指针
为
0x0
指针
为
0x0
#include<stdio....
赞
踩
article
Vivado
FPGA
中的
全局
时序
约束
-
TCL
命令_
vivado
设置时钟
全局
约束
...
时序
约束
是硬件设计中关键的一环,它能够有效的保障
时序
的正确性,提高设计的稳定性和可靠性。通过合理设置
时序
约束
,可以提高设...
赞
踩
article
创建.
Text
Blog
的
自定义
Skin
...
作者:Eric Willis翻译:汉博网/东南大学先声网 陈希成原文:Http://weblogs.notevil.ne...
赞
踩
article
Hadoop
压缩配置_
hadoop
压缩配置
csdn
...
下载LZO支持包解压maven编译将编译好后的
hadoop
-lzo-0.4.20.jar 放入
hadoop
-2.7.2/...
赞
踩
article
FP
-
Growth
算法
全解析:理论基础与实战指导_
fpgrowth
算法
中
参数
positiveinde...
频繁项集是一个包含在多个事务
中
频繁出现的项(或物品)集合。例如,在购物篮分析
中
,「牛奶」和「面包」经常一起购买,因此{'...
赞
踩
article
数据结构
常用的
算法
_
数据结构
的
算法
...
冒泡排序,快速排序,插入排序,选择排序遍历查找,拆半(二分)查找,分块查找_
数据结构
的
算法
数据结构
的
算法
...
赞
踩
article
Vivado
用
ILA
抓波形保存为
CSV
文件
_
ila
导出
csv
数据
...
将
ILA
观察到的波形
数据
捕获为
CSV
文件
,抓10次,把
文件
合并,把源
文件
删除。运行方法:
Vivado
的 Tcl cons...
赞
踩
article
美业
连锁
门店
收银
系统
源码
-如何查看收款
门店
对应的
加盟商
?...
多
门店
管理 / 会员管理 / 预约管理 / 排班管理 / 商品管理 / 促销活动。PC管理后台、手机APP、iPad A...
赞
踩
article
算据
——实现
低碳
计算
的
一种路径_
算据
训练
...
基于数据复用与
低碳
计算
的
指导原则,重新定义了
算据
的
概念,通过预处理、预
训练
、脱敏、加密等技术将数据转化为
算据
,建立完善
的
...
赞
踩
article
Git
命令
大全:轻松掌握
Git
工具
,提高
代码
管理效率
_
git
命令
行
工具
...
随着现代科技的快速发展,计算机技术正在成为我们日常生活和工作中不可或缺的一部分。计算机编程已经成为了许多人生活和工作的重...
赞
踩
article
员工跳槽
面试
美团
,
两次
面试
通过
却被
offer
审核
放鸽子
,
结果蒙了...
可能有人会问我为什么愿意去花时间帮助大家实现求职梦想
,
因为我一直坚信时间是可以复制的。我牺牲了自己的大概十个小时写了这片...
赞
踩
article
MySQL
(
增删
查改-
进阶
)
_
数据库
增删
改查
进阶
...
一、
数据库
约束1.约束类型NOT NULL:表示某列不能存储NULL值 UNIQUE:保证某列的每行必须有唯一的值 DE...
赞
踩
article
一文揭秘
23
届字节、阿里、百度等
校招
技术
岗
薪资
_字节
校招
薪资
20
23
...
大家好,今天给大家分享下20
23
届
校招
技术
岗
薪资
汇总,给后续找工作的同学做个参考吧。这里的
技术
岗包括开发岗和算法岗,以下...
赞
踩
article
Hadoop
之
HDFS
详细教程
_
hdfs
详解...
Hadoop
分布式系统框架中,首要的基础功能就是文件系统,在
Hadoop
中使用FileSystem 这个抽象类来表...
赞
踩
article
Ubuntu 18.04使用过程遇到的问题
_
global
cap
_
ffmpeg
_
impl
.hpp:2...
pipy 下载numpy文件连接超时pip3 install numpy 始终出现连接超时错误,无法安装,采用国内镜像文...
赞
踩
article
树莓
派
与
stm32
通信
_
树莓
派
和
stm32
共地...
设备准备: 2.
树莓
派
怕 pi3 B3.stm开发板资料准备: 主要问题:1.
stm32
读编码器信息2.
stm32
与树...
赞
踩
相关标签
网络
tcp/ip
spring boot
jar
后端
rust
Linux
fpga开发
matlab
blog
css
asp.net
html
工作
url
hadoop
算法
数据结构
c语言
源代码管理
java
前端
php
系统架构