蓝牙系统

车载蓝牙音频系统测试 随着汽车影音娱乐信息技术的发展,车载音频系统的需求趋势越来越明显。因此,针对汽车音频娱乐系统的新兴技术,对应的测试需求也在不断提升。本文将针对汽车车机的蓝牙音频系统和车机A2B总线系统,做出相应的应用测试介绍。 阅读详情

首先,先放上布局文件

activity_main布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.bawei.a1508abluetooth.MainActivity_old">

    <TextView
        android:id="@+id/searchBlueTooth"
        android:text="点击搜索蓝牙"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <TextView

        android:id="@+id/devices_list"
        android:visibility="gone"
        android:layout_below="@+id/searchBlueTooth"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
          />
    <ListView
        android:id="@+id/bluetooth_devices_list"
        android:layout_below="@+id/searchBlueTooth"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    </ListView>
</RelativeLayout>

list_item布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.bawei.a1508abluetooth.MainActivity">

</RelativeLayout>

MainActivity

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    public static final String TAG = "ABCDE";
    private List<String> dataSource  = new ArrayList<>();
    private TextView devices_list;
    private BluetoothAdapter bluetoothAdapter;
    private Set<BluetoothDevice> bondedDevices;
    private TextView searchBlueTooth;
    private ListView bluetooth_devices_list;
    //第二部开启广播并且进行获取周边蓝牙并输出到TextView
    private final BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            bluetoothAdapter.isEnabled();
            String action = intent.getAction();
            //获取已经搜索到的设备
            if (BluetoothDevice.ACTION_FOUND.equals(action)) {
                BluetoothDevice bluetoothDevice = (BluetoothDevice) intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                if (/*bluetoothDevice.getBondState() != BluetoothDevice.BOND_BONDED*/true) {
                    String address = bluetoothDevice.getAddress();//获取蓝牙的MAC地址
                    String name = bluetoothDevice.getName();//获取蓝牙的名称
                    String name_address= name + ":" + address;
                    dataSource.add(name_address);
//                    devices_list.append(name + ":" + address + "\n");//将蓝牙的地址和名称设置到TextView上
                }
            } else if (bluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
                devices_list.append("搜索完毕");
                MyListViewAdapter  myListViewAdapter = new MyListViewAdapter(MainActivity.this,dataSource);
                bluetooth_devices_list.setAdapter(myListViewAdapter);

            }
        }
    };


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        //启动子线程创建蓝牙服务器


        IntentFilter intentFilter = new IntentFilter();//广播接收者的过滤器
        intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);//添加
        intentFilter.addAction(BluetoothDevice.ACTION_FOUND);//添加发现蓝牙设备的action动作
        intentFilter.addAction(bluetoothAdapter.ACTION_DISCOVERY_FINISHED);//扫描蓝牙设备完毕
        this.registerReceiver(receiver, intentFilter);//注册蓝牙广播

        //第一步打开蓝牙并且将获取到的信息输出
        bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取蓝牙适配器
        bondedDevices = bluetoothAdapter.getBondedDevices();//将搜索到的蓝牙设备放入Set集合中
       /* for (BluetoothDevice device : bondedDevices) {
            String address = device.getAddress();//获取蓝牙的MAC地址
            String name = device.getName();//获取蓝牙的名称
            devices_list.append(name + ":" + address + "\n");//将蓝牙的地址和名称设置到TextView上

        }*/

        BluetoothServerSocketThread bluetoothServerSocketThread = new BluetoothServerSocketThread();
        bluetoothServerSocketThread.start();//开启子线程


    }

    //第三部进行实例化
    private void initView() {
        devices_list = (TextView) findViewById(R.id.devices_list);
        searchBlueTooth = (TextView) findViewById(R.id.searchBlueTooth);
        searchBlueTooth.setOnClickListener(this);
        bluetooth_devices_list = (ListView) findViewById(R.id.bluetooth_devices_list);


        //为ListView添加点击事件,事件的具体内容上是建立蓝牙客户端,客户端给服务器发送一条消息
        bluetooth_devices_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             String TAG = "ABCDE";

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Log.i(TAG,"0");
                String devices_name_addresss = dataSource.get(position);//从扫描到的蓝牙设备中拿到蓝牙设备的地址和名称
                Log.i(TAG,"1");
                //   bw:11.22222.444
                String devices_addresss = devices_name_addresss.substring(devices_name_addresss.indexOf(":") + 1);
                Log.i(TAG,"2");
                //getRemoteDevice(String address)
                //通过蓝牙设备的地址创建蓝牙设备
                BluetoothDevice remoteDevice = bluetoothAdapter.getRemoteDevice(devices_addresss);
                Log.i(TAG,"3");
                // createRfcommSocketToServiceRecord(UUID uuid)
                UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
                Log.i(TAG,"4");
                try {
                    //根据已经创建的蓝牙设备创建一个该蓝牙设备的客户端,这里的uuid相当于是一个IP地址,通过地址就可以找到服务器
                    BluetoothSocket devicesClient = remoteDevice.createRfcommSocketToServiceRecord(uuid);
                    Log.i(TAG,"5");
                    devicesClient.connect();//链接到蓝牙服务器
                    Log.i(TAG,"6");

                    OutputStream outputStream = devicesClient.getOutputStream();
                    Log.i(TAG,"7");
                    outputStream.write("发送信息到蓝牙设备".getBytes());
                    Log.i(TAG,"8");
                    outputStream.flush();
                    Log.i(TAG,"9");


                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });



    }


    //点击搜索周围的蓝牙
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.searchBlueTooth://点击按钮开始搜索周边的蓝牙

                if (bluetoothAdapter.isDiscovering()) {//如果正在搜索蓝牙就停止搜索
                    bluetoothAdapter.cancelDiscovery();
                }
                bluetoothAdapter.startDiscovery();//使用蓝牙适配器搜索周边蓝牙
                break;
        }
    }

    //自定义一个展示发现的蓝牙设备的LListView控件的适配器
    class MyListViewAdapter extends BaseAdapter {

        private Context context;
        private List<String> dataSource ;

        public MyListViewAdapter(Context context, List<String> dataSource) {
            this.context = context;
            this.dataSource = dataSource;
        }

        @Override
        public int getCount() {//获取item条目的个数
            return dataSource.size();
        }

        @Override
        public Object getItem(int position) {
            return dataSource.get(position);
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                LayoutInflater inflater = LayoutInflater.from(context);
                convertView = inflater.inflate(R.layout.list_item, null);
            }
            TextView item = (TextView) convertView.findViewById(R.id.item);
            item.setText(dataSource.get(position));
            return convertView;
        }
    }

    private class BluetoothServerSocketThread extends Thread {
        private BluetoothServerSocket bluetoothServerSocket;
        private BluetoothSocket clientSocket;
        private InputStream inputStream;
        private OutputStream outputStream;

        public BluetoothServerSocketThread( ) {
            //listenUsingRfcommWithServiceRecord(String name, UUID uuid)
//            UUID uuid = UUID.randomUUID();
            try {
                //创建蓝牙服务器,第一个参数是服务器的名称,第二个是一个唯一标识当前服务器的ID,相当于是一个IP地址
                UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
                bluetoothServerSocket = bluetoothAdapter.listenUsingRfcommWithServiceRecord("1508a_Service", uuid);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        @Override
        public void run() {
            super.run();
            try {
                clientSocket = bluetoothServerSocket.accept();//监听客户端的链接
                inputStream = clientSocket.getInputStream();
                outputStream = clientSocket.getOutputStream();


                while (true) {

                    byte[] buffer = new byte[1024];
                    int count = inputStream.read(buffer);
                    String message = new String(buffer, 0, count, "utf-8");
                    Looper.prepare();
                    Toast.makeText(MainActivity.this,message,Toast.LENGTH_LONG).show();
                    Looper.loop();

                }



            } catch (IOException e) {
                e.printStackTrace();
            }


        }
    }
}

同样注释掉的代码可以去掉!!!
MainActivity_old
这个activity的布局什么都没有,我就不上传了

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;

public class MainActivity_old extends AppCompatActivity implements View.OnClickListener {
    private List<String> deviceList = new ArrayList<>();

    private TextView devices_list;

    private BluetoothAdapter bluetoothAdapter;
    private Set<BluetoothDevice> bondedDevices;
    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);

        }
    };

    private final BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            //获取已经搜索到的设备
            if (BluetoothDevice.ACTION_FOUND.equals(action)) {
                BluetoothDevice bluetoothDevice = (BluetoothDevice) intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                if (bluetoothDevice.getBondState() != BluetoothDevice.BOND_BONDED) {
                    String address = bluetoothDevice.getAddress();//获取蓝牙的MAC地址
                    String name = bluetoothDevice.getName();//获取蓝牙的名称
                    String name_address = name + ":" + address;
                    deviceList.add(name_address);
//                    devices_list.append(name + ":" + address + "\n");//将蓝牙的地址和名称设置到TextView上
                }
            } else if (bluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
                devices_list.append("搜索完毕");
                MyAdapter myAdapter = new MyAdapter(MainActivity_old.this, deviceList);
                bluetooth_devices_list.setAdapter(myAdapter);
            }
        }
    };
    private TextView searchBlueTooth;
    private ListView bluetooth_devices_list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();

        IntentFilter intentFilter = new IntentFilter();//广播接收者的过滤器
        intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);//添加
        intentFilter.addAction(BluetoothDevice.ACTION_FOUND);//添加发现蓝牙设备的action动作
        intentFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);//添加发现蓝牙设备的action动作
        this.registerReceiver(receiver, intentFilter);//注册蓝牙广播

        bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();//获取蓝牙适配器
        bondedDevices = bluetoothAdapter.getBondedDevices();//将搜索到的蓝牙设备放入Set集合中
        for (BluetoothDevice device : bondedDevices) {
            String address = device.getAddress();//获取蓝牙的MAC地址
            String name = device.getName();//获取蓝牙的名称
            devices_list.append(name + ":" + address + "\n");//将蓝牙的地址和名称设置到TextView上

        }
        AcceptThread acceptThread = new AcceptThread();
        acceptThread.start();

    }

    private void initView() {
        devices_list = (TextView) findViewById(R.id.devices_list);
        searchBlueTooth = (TextView) findViewById(R.id.searchBlueTooth);
        searchBlueTooth.setOnClickListener(this);
        bluetooth_devices_list = (ListView) findViewById(R.id.bluetooth_devices_list);
//        bluetooth_devices_list.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.searchBlueTooth://点击按钮开始搜索周边的蓝牙

                if (bluetoothAdapter.isDiscovering()) {//如果正在搜索蓝牙就停止搜索
                    bluetoothAdapter.cancelDiscovery();
                }

                bluetoothAdapter.startDiscovery();//使用蓝牙适配器搜索周边蓝牙
                break;
        }
    }

    private class AcceptThread extends Thread {
        private BluetoothServerSocket serverSocket;
        private BluetoothSocket socket;
        private InputStream is;
        private OutputStream os;

        public AcceptThread() {
            UUID uuid = UUID.randomUUID();
            try {
                serverSocket = bluetoothAdapter.listenUsingInsecureRfcommWithServiceRecord("name", uuid);
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

        @Override
        public void run() {
            super.run();
            try {
                socket = serverSocket.accept();
                is = socket.getInputStream();
                os = socket.getOutputStream();
                while (true) {
                    byte[] buffer = new byte[1024];
                    int count = is.read(buffer);
                    Message msg = new Message();
                    msg.obj = new String(buffer, 0, count, "utf-8");
                    handler.sendMessage(msg);

                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    class MyAdapter extends BaseAdapter {

        private Context context;
        private List<String> deviceList;

        public MyAdapter(Context context, List<String> deviceList) {
            this.context = context;
            this.deviceList = deviceList;
        }


        @Override
        public int getCount() {
            return deviceList.size();
        }

        @Override
        public Object getItem(int position) {
            return null;
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {

            if (convertView == null) {
                convertView = LayoutInflater.from(context).inflate(R.layout.devices_list, null);
            }
            TextView item = (TextView) convertView.findViewById(R.id.devices_item);
            item.setText(deviceList.get(position));
            return convertView;
        }
    }
}

这个代码是蓝牙和广播一起用的

关于Ubantu系统中蓝牙问题及一些解决思路 当我们想要在Ubantu系统(可能别的系统也会遇到)中打开蓝牙的时候,可能会提示: 没有检测到蓝牙适配器 / 蓝牙守护进程未启动 / BlueZ未运行 等等信息。 这时我们可以用命令: systemctl status bluetooth.service 来检查我们的蓝牙服务是否处于运行状态。 如果提示: ● bluetooth.service - Bluetooth service Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; 阅读详情

相关推荐

windows ubuntu18.04 双系统共用蓝牙LE的鼠标

由于由于双系统的缘故,一个蓝牙鼠标并不能无缝的在ubuntu和windows之间切换。由于现在市场上很多是bluetooth LE鼠标,所以网上的方法都会失效。这里以华为蓝牙鼠标为例,给出一种可行的解决方案。 1.在windows下连接蓝牙鼠标 先让蓝牙鼠标和windows配对,这样可以在注册表中找到对应的蓝牙信息。 2.在ubuntu下链接蓝牙鼠标 切换到ubuntu系统连接到你的蓝牙鼠标,这时...

qq_41196737的博客 3583

【物联网】蓝牙简介

蓝牙技术在日常生活和工作中发挥着越来越重要的作用,如无线耳机让人们摆脱了线缆的束缚,蓝牙音箱为人们带来了更加便捷的音乐体验等。当然,蓝牙技术的应用远不止于此。随着技术的不断进步和创新,蓝牙技术在许多领域都展现出了巨大的潜力和价值。

大雨淅淅的博客 8225

Ubuntu和Windows双系统连接罗技蓝牙键盘

后记: 写完这篇文章后又先后重新连接过两次, 每次都会下意识担心, 完了完了这次可能再也连不上了(想起当初一直连不上双系统,被蓝牙键盘支配的日日夜夜), 结果我按着自己写的这篇文章来搞, 还不是每次都成功了hh. 一、参考文献 为了方便查阅,先列出参考文献。这些文章中有的内容已经过时,有的是配置的环境不一样。 1.Ubuntu和Windows双系统蓝牙键盘配对——2014 2.Ubunt...

qq_33054139的博客 1万+

蓝牙基础(二):蓝牙核心系统架构

查看蓝牙核心规范文档,都会看到一个复杂的核心系统架构图,蓝牙核心系统架构图概括了蓝牙的基本工作原理。对于初学者,初看这图,不可避免有点令人望而却步,这未免太过于晦涩?本文我们将尝试对它进行拆开分解,以便于能更好地理解蓝牙的基本工作原理。

Biao 1226

如何搭建简易蓝牙定位系统

本文简单介绍了如何搭建一套蓝牙定位系统,可供移动客户端(包括android和iOS)定位。

chadeltu的专栏 1万+

蓝牙协议分析(针对蓝牙电机系统)

BLE协议栈采用。

qq_45707027的博客 1505

知识整理1----初次认知蓝牙

蓝牙模块可分为:经典蓝牙模块(v1.1/1.2/2.0/2.1/3.0)、低功耗蓝牙模块(v4.0/4.1/4.2/5.0)和双模蓝牙模块(支持蓝牙所有版本)

Jackyin0720的博客 1618

蓝牙之七-蓝牙子系统启动

bluedroid蓝牙子系统启动过程1)init进程启动;2)Native服务启动;3)System server,Android服务启动;4)Home启动。JAVApackages\apps\Bluetooth\src\com\android\bluetooth\btservice\ AdapterService.javapublic class AdapterService extends Se

shichaog的专栏 5822

ble系统知识介绍(较为完整,持续更新中)

蓝牙技术自2000年以来就一直存在。最初是为了让两个设备在无需任何中间网络设备的情况下进行无线数据交换,很快就被应用于产品,如无线鼠标和汽车免提套件。后者是音频产品,而音频证明了这种原始版本的蓝牙技术的成功应用。多年来一直如此。这种第一版蓝牙技术,在最早的蓝牙产品中使用,正式称为蓝牙BR(基本速率)。它在物理层上提供了1百万比特每秒(1 mb/s)的原始数据速率。后来,定义了更快的蓝牙技术版本,称为蓝牙BR / EDR(增强型数据速率)。

留下虚度光阴的一些证据。 6032

RK3568平台开发系列讲解(蓝牙篇)蓝牙系统结构

Android平台中的蓝牙系统是基于BlueZ实现的,BlueZ是通过Linux中的一套完整的蓝牙协议栈开源实现的。在Linux 2.6内核中已经包含了完整的BlueZ协议栈,在Android系统中已经移植并嵌入进了BlueZ的用户空间实现,并且随着硬件技术的发展而不断更新。Android的应用程序框架提供了访问蓝牙功能的APIs。在Android平台中,蓝牙系统从上到下主要包括Java框架中的Bluetooth类、Android适配库、BlueZ库、驱动程序和协议,这几部分的具体结构如图。

内核笔记 4163

AI 生成 CAN 通信测试用例实战

本文分享了AI辅助汽车电子测试用例编写的实战经验。通过某车企CAN网络测试项目案例,对比传统方式(需27天)与AI辅助方式(仅5天)的效率差异,展示81%的效率提升。文章详细介绍了从DBC文件提取信号信息的方法,包括DBC文件结构解析、信号定义说明,并提供了完整的Python解析脚本代码,可将信号信息导出为JSON或Excel格式,为后续AI批量生成测试用例奠定基础。

小明的博客 698

系统性简述BLE蓝牙

这里写自定义目录标题蓝牙简介蓝牙分类蓝牙技术蓝牙协议框架BLE协议栈框架ATT协议ATT协议分层新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 蓝牙简介 蓝牙因为历史问题,分类太多太杂,这里主要讲BLE蓝牙(毕竟现在BLE

盜版摩羯 6350

傻白入门芯片设计,SystemVerilog Assertion(SVA)学习(二十一)

对SVA(SystemVerilogt Assertion)有了更深刻的认识,对经典的AveMC形式验证工具进行了介绍

qq_46675545的博客 8474

双系统蓝牙连接问题

本次双系统蓝牙连接冲突问题,是由于两个操作系统对同一蓝牙适配器初始化身份不一致所导致的。通过采取在Linux系统中彻底禁用蓝牙服务的“隔离控制”策略,成功解决了Windows系统下的蓝牙稳定性问题。蓝牙设备通过与主机蓝牙适配器的唯一MAC地址进行配对和识别。一个物理蓝牙适配器在两个操作系统中表现出两个不同的“逻辑身份”,导致信任关系破裂和连接状态不稳定。用户根据自身需求(主要使用Windows的蓝牙功能,对Linux下蓝牙无需求),选择了。该方案被成功执行,系统反馈表明蓝牙服务已被正确停止、禁用和屏蔽。

m0_74365985的博客 1185

ROS2前置基础教程 | 小鱼教你用CMake依赖查找流程

上面我们用g++、make、cmake三种方式来编译ros2的C++节点。用cmake虽然成功了,但是CMakeLists.txt的内容依然非常的臃肿,我们需要将其进一步的简化。将上面的CmakLists.txt改成下面的样子 接着继续生成和编译 是不是非常的神奇,为什么可以浓缩成那么短的几句指令呢?find_package查找路径对应的环境变量如下。 打开终端,输入指令: 结果 观察PATH变量,你会发现赫然在其中,中的路径如果以或结尾,则自动回退到上一级目录,接着检查这些目录下的 cmake找到这些目录

生活不止眼前的苟且 7165

从CST到AD:高效PCB阵列设计与介质优化实战

本文详细解析了从CST电磁仿真软件到Altium Designer(AD)的PCB阵列设计全流程,重点解决毫米波天线等精密设计中模型导出、介质优化和阵列构建的核心难题。通过实战技巧,指导工程师高效处理DXF文件导入、复杂铜皮填充、空气介质实现等关键步骤,确保高精度设计从仿真到制造的顺利转换,提升工作效率与设计可靠性。

weixin_28256233的博客 443

Windows系统Ble蓝牙通信

我的基本思路是,双模蓝牙设备的edr和ble的mac地址要一致或者要有对应关系,使用windows的api枚举出已经连接的edr设备并获取到mac地址,再根据mac地址去发现对应ble设备的实例地址。其实代码在官方提供的代码里面有,但都是异步写法的,我这里改成了同步的。之前做的一个项目需求就是,windows系统的pc连接双模的蓝牙设备,根据已经连接的edr蓝牙去跟对应的ble蓝牙进行通信。其实这个路径在设备管理器里面也有类似的,在设备管理器中找到连接的蓝牙设备在。的值,就可以免去上面的步骤了。

dkaoer的博客 4799

工程创新训练大赛智能网联车辆赛道LKA+自动驾驶9000+分数分案例

/获取主车在主车路径上的ST坐标。if (status == AVPStatus::eForwarding) // approaching the parking space接近阶段。if (status == AVPStatus::eForwarding) // approaching the parking space接近阶段。if (status == AVPStatus::eForwarding) // approaching the parking space接近阶段。

handsomeboyou的博客 1135

蓝牙键盘连接linux,命令行 蓝牙_蓝牙键盘接入UOS系统的方法

点击上方蓝色字关注我们~ 一直没有腾出时间写这篇分享,上个月收到了UOS系统的个人授权码,本想着体验一下这款由deepin深度系统打底的新系统,但又不想折腾现在在使用的Windows系统台式机,于是找了一台旧的ThinkPad安装了UOS系统。习惯了机械键盘,笔记本自带的键盘不顺手,于是便把为iPad准备的罗技K480蓝牙键盘拿来连接UOS系统。可能是处于安全考虑,基于Linux核心的系统基本都...

weixin_29358723的博客 1472

手把手教你学Simulink——基于通信协议与标准的场景实例:卫星通信中的网络安全协议(IPSec)仿真

随着卫星通信在国防、金融、应急指挥、能源管网等关键领域的广泛应用,其安全性已成为系统设计的核心要求。然而,卫星链路具有广播特性、长距离传输、地面站分布广等特点,极易遭受窃听、篡改、重放、中间人攻击等网络威胁。传统的“信任链路层安全”已不足以应对现代网络攻击。为此,国际标准组织(如IETF、ETSI、CCSDS)推荐在卫星通信中部署协议,实现端到端的数据机密性、完整性、身份认证和抗重放保护。本文将手把手教你如何在中构建一个符合标准的仿真系统,涵盖从明文传输到加密隧道的完整安全链路建模。本文完整实现了。

MHD0815的博客 151

智能车浅谈 电磁组——环岛处理

第十七届全国大学生智能车电磁四轮部分经验分享

qq_41954556的博客 1万+

android中蓝牙系统总述

蓝牙(Bluetooth)提供移动设备及其配件之间低功耗、低成本的无线通信连接。蓝牙技术的核心,是根据蓝牙标准所实现的蓝牙协议栈。蓝牙能同时进行异步数据及同步语音传输,它的底层协议层包括众多协议,如逻辑链路控制和适配协议(L2CAP)、服务发现协议(SDP)、串口模拟协议(RFCOMM)等,一起为上层提供传输支持。而主要控制接口则由主机控制接口层(HCI)体现,它是蓝牙协议中软硬件之间的接口。在各

一颗西瓜的博客 401

华为OD机试双机位C卷:日志排序 (Py/C/C++/Java/Js/Go)

华为OD机试双机C卷真题【日志排序】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解。华为OD机试-日志排序。

qq_45776114的博客 1754

蓝牙温度检测系统(基于BT08-B蓝牙模块)

蓝牙温度检测系统(基于BT08-B蓝牙模块) 闲暇之余做的一个小作品,希望能和大家分享一下我的经验和想法,一起学习

qq_45416203的博客 1万+

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

命令行 蓝牙_蓝牙键盘接入UOS系统的方法

点击上方蓝色字关注我们~一直没有腾出时间写这篇分享,上个月收到了UOS系统的个人授权码,本想着体验一下这款由deepin深度系统打底的新系统,但又不想折腾现在在使用的Windows系统台式机,于是找了一台旧的ThinkPad安装了UOS系统。习惯了机械键盘,笔记本自带的键盘不顺手,于是便把为iPad准备的罗技K480蓝牙键盘拿来连接UOS系统。可能是处于安全考虑,基于Linux核心的系统...

weixin_39673184的博客 3276

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Android8.0 蓝牙系统

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34293902的博客 654

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

上一篇: 一篇简单的实用的代码,教你如何写GPS
下一篇: Toolbar+DrawerLayout+Fragment结合使用
枫爻筝
博客等级 码龄9年 7粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值