我想制作一个可以启动的蓝牙服务器,其他设备可以与之配对。
我可以使代码正常编译,服务器可以启动,但是从android手机扫描蓝牙设备时看不到广告。
我想我需要打开可发现模式。
我尝试在hci_lib.h中搜索该函数,该函数可发现蓝牙但找不到它。
这是我到目前为止的代码。
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/rfcomm.h>
int main(int argc, char **argv)
{
struct sockaddr_rc loc_addr = { 0 }, rem_addr = { 0 };
char buf[1024] = { 0 };
int s, client, bytes_read,dev_id,sock;
socklen_t opt = sizeof(rem_addr);
dev_id = hci_get_route(NULL);
if (dev_id < 0) {
perror("No Bluetooth Adapter Available");
exit(1);
}
if (hci_devinfo(dev_id, &dev_info) < 0) {
perror("Can't get device info");
exit(1);
}
sock = hci_open_dev( …Run Code Online (Sandbox Code Playgroud) 我有一个TextView,我想在其顶部和底部边缘添加不同颜色的边框.我知道为了沿所有边缘添加一种颜色的边框,我们可以简单地使用以下代码:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#000000"/>
</shape>
</item>
<item
android:top="1dp" android:bottom="1dp">
<shape android:shape="rectangle">
<solid android:color="#ffffff"/>
</shape>
</item>
Run Code Online (Sandbox Code Playgroud)
但是如果我们需要不同颜色的边缘,需要做些什么呢?
我必须在img标签中更改类名
<img src="img/nex2.jpeg" class="name">
Run Code Online (Sandbox Code Playgroud)
现在在jquery中的悬停函数我想为它添加一个类名.所以在悬停后这个标签看起来应该是这样的
<img src="img/nex2.jpeg" class="name secondname">
Run Code Online (Sandbox Code Playgroud)
再次删除它应该改为
<img src="img/nex2.jpeg" class="name">
Run Code Online (Sandbox Code Playgroud)