• 大小: 1.87MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-09-01
  • 语言: C#
  • 标签: c#  blender  

资源简介

C# ble 4.0 低能耗 蓝牙交互 蓝牙连接 适配 服务 特征 编程,通过windows模块配对蓝牙进行数据交互

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Devices.Bluetooth;
using Windows.Devices.Bluetooth.GenericAttributeProfile;
using Windows.Devices.Enumeration;
using Windows.Foundation;
using Windows.Networking;
using Windows.Networking.Proximity;
using Windows.Networking.Sockets;
using Windows.Security.Cryptography;
using Windows.Storage.Streams;

namespace BleSolution
{
    public class BleCore
    {
        private Boolean asyncLock = false;

        /// 
        /// 搜索蓝牙设备对象
        /// 

        private DeviceWatcher deviceWatcher;

        /// 
        /// 当前连接的服务
        /// 

        public GattDeviceService CurrentService { get; set; }

        /// 
        /// 当前连接的蓝牙设备
        /// 

        public BluetoothLEDevice CurrentDevice { get; set; }

        /// 
        /// 写特征对象
        /// 

        public GattCharacteristic CurrentWriteCharacteristic { get; set; }

        /// 
        /// 通知特征对象
        /// 

        public GattCharacteristic CurrentNotifyCharacteristic { get; set; }

        /// 
        /// 特性通知类型通知启用
        /// 

        private const GattClientCharacteristicConfigurationDescriptorValue CHARACTERISTIC_NOTIFICATION_TYPE = GattClientCharacteristicConfigurationDescriptorValue.Notify;

        /// 
        /// 存储检测到的设备
        /// 

        private List DeviceList = new List();

        /// 
        /// 定义搜索蓝牙设备委托
        /// 

        public delegate void DeviceWatcherChangedEvent(MsgType type BluetoothLEDevice bluetoothLEDevice);

        /// 
        /// 搜索蓝牙事件
        /// 

        public event DeviceWatcherChangedEvent DeviceWatcherChanged;

        /// 
        /// 获取服务委托
        /// 

        public delegate void GattDeviceServiceAddedEvent(GattDeviceService gattDeviceService);

        /// 
        /// 获取服务事件
        /// 

        public event GattDeviceServiceAddedEvent GattDeviceServiceAdded;

        /// 
        /// 获取特征委托
        /// 

        public delegate void CharacteristicAddedEvent(GattCharacteristic gattCharacteristic);

        /// 
        /// 获取特征事件
        /// 

        public event CharacteristicAddedEvent CharacteristicAdded;

        /// 
        /// 提示信息委托
        /// 

        public delegate void MessAgeChangedEvent(MsgType type string message byte[] data = null);

        /// 
        /// 提示信息事件
        /// 

        public event MessAgeChangedEvent MessAgeChanged;

        /// 
        /// 当前连接的蓝牙Mac
        /// 

        private string CurrentDeviceMAC { get; set; }

        public BleC

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-07-03 11:43  BleSolution\
     目录           0  2020-07-03 11:43  BleSolution\.vs\
     目录           0  2020-07-03 11:43  BleSolution\.vs\BleSolution\
     目录           0  2020-07-03 11:43  BleSolution\.vs\BleSolution\v14\
     文件      109568  2020-12-11 10:17  BleSolution\.vs\BleSolution\v14\.suo
     目录           0  2020-12-14 15:59  BleSolution\BleSolution\
     文件         189  2020-07-03 11:43  BleSolution\BleSolution\App.config
     文件       14294  2020-12-11 09:16  BleSolution\BleSolution\BleCore.cs
     文件         251  2020-07-03 11:43  BleSolution\BleSolution\BleEnum.cs
     文件        4725  2020-12-11 09:13  BleSolution\BleSolution\BleSolution.csproj
     文件         228  2020-07-03 11:43  BleSolution\BleSolution\BleSolution.csproj.user
     文件       17672  2020-12-14 15:58  BleSolution\BleSolution\BluetoothLECode.cs
     文件        9243  2020-10-15 11:32  BleSolution\BleSolution\Form1.Designer.cs
     文件       10848  2020-10-15 11:34  BleSolution\BleSolution\Form1.cs
     文件        5817  2020-10-15 10:27  BleSolution\BleSolution\Form1.resx
     文件        5179  2020-12-11 09:54  BleSolution\BleSolution\Form2.Designer.cs
     文件        3622  2020-12-14 15:59  BleSolution\BleSolution\Form2.cs
     文件        5817  2020-12-11 09:54  BleSolution\BleSolution\Form2.resx
     文件         536  2020-12-11 09:37  BleSolution\BleSolution\Program.cs
     目录           0  2020-07-03 11:43  BleSolution\BleSolution\Properties\
     文件        1320  2020-07-03 11:43  BleSolution\BleSolution\Properties\AssemblyInfo.cs
     文件        2864  2020-07-14 09:44  BleSolution\BleSolution\Properties\Resources.Designer.cs
     文件        5612  2020-07-03 11:43  BleSolution\BleSolution\Properties\Resources.resx
     文件        1112  2020-07-14 09:44  BleSolution\BleSolution\Properties\Settings.Designer.cs
     文件         249  2020-07-03 11:43  BleSolution\BleSolution\Properties\Settings.settings
     目录           0  2020-07-14 09:43  BleSolution\BleSolution\bin\
     目录           0  2020-12-11 14:09  BleSolution\BleSolution\bin\Debug\
     文件       28216  2012-09-26 03:16  BleSolution\BleSolution\bin\Debug\System.Runtime.WindowsRuntime.dll
     文件       76981  2018-10-15 11:17  BleSolution\BleSolution\bin\Debug\System.Runtime.WindowsRuntime.xml
     文件     6852608  2019-03-18 17:33  BleSolution\BleSolution\bin\Debug\Windows.winmd
     文件       22696  2020-07-14 09:41  BleSolution\BleSolution\bin\Debug\WindowsFormsApplication1.vshost.exe
............此处省略27个文件信息

评论

共有 条评论