Atitit 搜索蓝牙设备 powershell的实现 java noede.js python 先用脚本语言python nodejs,不好实现。。Java 也不好实现。。 Netcore可以,

Atitit 搜索蓝牙设备 powershell的实现  java noede.js python

 

先用脚本语言python nodejs,不好实现。。Java 也不好实现。。

Netcore可以,但是找不到config

 

只好使用powershell了。。

 

 

 

"halo"

[reflection.assembly]::LoadFile("C:\0workspace\bluetoothPrj\InTheHand.Net.Personal.dll")

Add-Type –Path "C:\0workspace\bluetoothPrj\InTheHand.Net.Personal.dll"

Add-Type -AssemblyName mscorlib

#Add-Type -AssemblyName "C:\0workspace\bluetoothPrj\InTheHand.Net.Personal"

$Blueclient = New-Object InTheHand.Net.Sockets.BluetoothClient

 

# $BuleRadio = BluetoothRadio.PrimaryRadio;

$Devices = $Blueclient.DiscoverDevices();

$Devices

 

 

返回

 

PS C:\Windows\System32\WindowsPowerShell\v1.0> C:\Windows\SysWOW64\WindowsPowerShell\v1.0\无标题1.ps1

halo

 

GAC    Version        Location                                                                                                                                                                                    

---    -------        --------                                                                                                                                                                                    

False  v2.0.50727     C:\0workspace\bluetoothPrj\InTheHand.Net.Personal.dll                                                                                                                                       

 

DeviceAddress     : D467D39B9344

DeviceName        : OPPO A7x

ClassOfDevice     : 5A020C

Rssi              : -2147483648

InstalledServices : {00001105-0000-1000-8000-00805f9b34fb, 0000110a-0000-1000-8000-00805f9b34fb, 0000110c-0000-1000-8000-00805f9b34fb, 0000110e-0000-1000-8000-00805f9b34fb...}

Connected         : False

Remembered        : True

Authenticated     : True

LastSeen          : 2019/9/20 17:03:13

LastUsed          : 2019/9/12 16:14:28

 

22

 

 

 

_______________________________________________________________________________________________________________________________________________________________________________________________________________

 

 

Atitit 蓝牙开发 搜索蓝牙设备 java noede.js python

 

先查询跨语言类库wmi 结果貌似没有

没有shell工具

java资料bluecove

Node.js但是需要替换驱动麻烦。。

搜索Python库看看

需要安装替换vc sdk ,pass

Powershell 试试看  貌似没有提示不好做

 

安装vscode  net包管理器插件paket,然后下载蓝牙库32feet.NET

 

C:\Users\aaa.ATTILAXPC188\.vscode\extensions\ionide.ionide-paket-1.12.0\bin\paket.exe add nuget 32feet.NET

 

 

 

using System;

using System.Collections.Generic;

using InTheHand.Net;

using InTheHand.Net.Bluetooth;

using InTheHand.Net.Sockets;

using Newtonsoft.Json;

using System.Configuration;

using System.IO;

using System.Reflection;

 

namespace eee

{

    class Program

    {

        static void Main(string[] args)

        {

 

                 //  #pragma comment(lib, "dll\System.Configuration.dll");

                  var path = new FileInfo(Assembly.GetExecutingAssembly().Location);

                 var a = Assembly.LoadFile(Path.Combine(path.DirectoryName"lib\\System.Configuration.dll"));

                //InTheHand.Net.Sockets.BluetoothClient

                 Console.WriteLine(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5);

               

                BluetoothClient Blueclient = new BluetoothClient();

                Dictionary<stringBluetoothAddressdeviceAddresses = new Dictionary<stringBluetoothAddress>();

 

           //     Newtonsoft.JsonConvert

                BluetoothRadio BuleRadio = BluetoothRadio.PrimaryRadio;

                BuleRadio.Mode = RadioMode.Connectable;

                BluetoothDeviceInfo[] Devices = Blueclient.DiscoverDevices();

                //  System.Configuration.dll

                Console.WriteLine(    Newtonsoft.Json.JsonConvert.SerializeObject(Devices) );

                Console.WriteLine("Hello World!");

        }

    }

}

 

 

 

用C#调用蓝牙编程 - ZWmaqing - 博客园.mhtml

如何在C#中仅发现打印机蓝牙设备? - 问答 - 云+社区 - 腾讯云.mhtml

 

posted @ 2019-09-21 01:04  attilaxAti  阅读(46)  评论(0编辑  收藏  举报